@leverege/build-tools 2.96.8 → 2.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.vscode/launch.json +21 -1
  2. package/package.json +10 -10
  3. package/src/Utils.mjs +6 -1
  4. package/src/artifacts/Utils.mjs +5 -2
  5. package/src/build-cnpg-image.mjs +0 -1
  6. package/src/chart-compass.yaml +1 -1
  7. package/src/chart-to-registry.mjs +10 -1
  8. package/src/helm-charts/api-server/values-local.yaml +3 -0
  9. package/src/helm-charts/cnpg-db-psql-stack/cluster.yaml.ovh +37 -32
  10. package/src/helm-charts/cnpg-db-psql-stack/pooler.yaml +2 -0
  11. package/src/helm-charts/cnpg-db-recovery/cluster.yaml.ovh +1 -1
  12. package/src/helm-charts/cnpg-db-tsdb-basic/cluster.yaml.ovh +50 -46
  13. package/src/helm-charts/cnpg-db-tsdb-basic/pooler.yaml +2 -0
  14. package/src/helm-charts/cnpg-db-tsdb-dense/cluster.yaml.ovh +55 -47
  15. package/src/helm-charts/cnpg-db-tsdb-dense/pooler.yaml +2 -0
  16. package/src/helm-charts/cnpg-operator/helmup.bootstrap +8 -0
  17. package/src/helm-charts/cnpg-operator/helmup.plugin +29 -4
  18. package/src/helm-charts/db-curator/values-local.yaml +9 -1
  19. package/src/helm-charts/elasticsearch8/elasticsearch-local.yaml +54 -51
  20. package/src/helm-charts/emailer/values-local.yaml +4 -1
  21. package/src/helm-charts/messenger/values-local.yaml +1 -5
  22. package/src/helm-charts/pgbouncer/values-local.yaml +8 -3
  23. package/src/helm-charts/prom-operator/helmup.bootstrap +8 -5
  24. package/src/helm-charts/prom-operator/helmup.plugin +1 -1
  25. package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +51 -11
  26. package/src/helm-charts/prom-operator/rules/elasticsearch-rules.yaml +1 -1
  27. package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +1 -1
  28. package/src/helm-charts/push-notifier/values-local.yaml +8 -0
  29. package/src/helm-charts/redis/values-local.yaml +2 -1
  30. package/src/helm-charts/traefik/values-local.yaml +1 -1
  31. package/src/helm-charts/transponder-dh/values-local.yaml +1 -0
  32. package/src/helm-charts/transponder-tsdb/values-local.yaml +1 -0
  33. package/src/helm-charts/velero/helmup.plugin +2 -2
  34. package/src/helm-charts/velero/values-local.yaml +17 -15
  35. package/src/helmdn.sh +1 -1
  36. package/src/helmup.sh +3 -3
  37. package/src/init-my-chart/Chartwright.mjs +69 -0
  38. package/src/init-my-chart/init-my-chart-v1.mjs +124 -0
  39. package/src/init-my-chart/init-my-chart.mjs +80 -0
  40. package/src/init-my-chart/leaf-chart-templates/Chart.yaml.hbs +10 -0
  41. package/src/init-my-chart/leaf-chart-templates/templates/configmap.yaml +1 -0
  42. package/src/init-my-chart/leaf-chart-templates/templates/deployment.yaml +1 -0
  43. package/src/init-my-chart/leaf-chart-templates/templates/hpa.yaml +1 -0
  44. package/src/init-my-chart/leaf-chart-templates/templates/pdb.yaml +1 -0
  45. package/src/init-my-chart/leaf-chart-templates/templates/service.yaml +1 -0
  46. package/src/init-my-chart/leaf-chart-templates/templates/serviceaccount.yaml +1 -0
  47. package/src/init-my-chart/leaf-chart-templates/templates/servicemonitor.yaml +1 -0
  48. package/src/init-my-chart/leaf-chart-templates/values.schema.json +623 -0
  49. package/src/init-my-chart/leaf-chart-templates/values.yaml.hbs +135 -0
  50. package/src/init-my-chart/legacy-helm-template/Chart.yaml +5 -0
  51. package/src/init-my-chart/legacy-helm-template/templates/NOTES.txt +5 -0
  52. package/src/init-my-chart/legacy-helm-template/templates/_helpers.tpl +135 -0
  53. package/src/init-my-chart/legacy-helm-template/templates/configmap.yaml +10 -0
  54. package/src/init-my-chart/legacy-helm-template/templates/deployment.yaml +125 -0
  55. package/src/init-my-chart/legacy-helm-template/templates/hpa.yaml +26 -0
  56. package/src/init-my-chart/legacy-helm-template/templates/ingressroute.yaml +18 -0
  57. package/src/init-my-chart/legacy-helm-template/templates/pdb.yaml +22 -0
  58. package/src/init-my-chart/legacy-helm-template/templates/service.yaml +15 -0
  59. package/src/init-my-chart/legacy-helm-template/templates/serviceaccount.yaml +13 -0
  60. package/src/init-my-chart/legacy-helm-template/templates/servicemonitor.yaml +23 -0
  61. package/src/init-my-chart/legacy-helm-template/values.yaml +152 -0
  62. package/src/testOauthLogic.mjs +12 -0
  63. package/leverege-build-tools-2.21.13.tgz +0 -0
  64. package/lib/server/build-tools.js +0 -138
  65. package/lib/server/firebaseDeploy.js +0 -195
  66. package/lib/server/firebaseServe.js +0 -116
  67. package/lib/server/getfbcfg.js +0 -25
  68. package/lib/server/getjson.js +0 -70
  69. package/lib/server/overwhelm.js +0 -447
  70. package/lib/server/push-my-chart.js +0 -18
  71. package/lib/server/refresh-npm-token.js +0 -135
  72. package/lib/server/tag-release.js +0 -681
  73. package/lib/server/unleash.js +0 -50
  74. package/lib/web/build-tools.js +0 -138
  75. package/lib/web/firebaseDeploy.js +0 -195
  76. package/lib/web/firebaseServe.js +0 -116
  77. package/lib/web/getfbcfg.js +0 -25
  78. package/lib/web/getjson.js +0 -70
  79. package/lib/web/overwhelm.js +0 -447
  80. package/lib/web/push-my-chart.js +0 -18
  81. package/lib/web/refresh-npm-token.js +0 -135
  82. package/lib/web/tag-release.js +0 -681
  83. package/lib/web/unleash.js +0 -50
  84. package/src/helm-charts/prom-operator/rules/awesome-base/elasticsearch-rules.yaml +0 -219
  85. package/src/helm-charts/prom-operator/rules/awesome-base/google-cadvisor.yaml +0 -108
  86. package/src/helm-charts/prom-operator/rules/awesome-base/kubestate-exporter.yaml +0 -394
  87. package/src/helm-charts/prom-operator/rules/awesome-base/prometheus-rules.yaml +0 -318
  88. package/src/helm-charts/prom-operator/rules/awesome-base/redis-rules.yaml +0 -142
  89. package/src/helm-charts/prom-operator/rules/awesome-base/traefik-rules.yaml +0 -43
  90. package/src/init-my-chart.mjs +0 -18
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable security/detect-non-literal-fs-filename */
3
+
4
+ // failed first attempt just keeping for reference - see Chartwright
5
+ //
6
+ import fs from 'node:fs'
7
+ import path from 'node:path'
8
+
9
+ import { program } from 'commander'
10
+ import chalk from 'chalk'
11
+ import handlebars from 'handlebars'
12
+
13
+ import {
14
+ BUILD_TOOLS_ROOT,
15
+ analyzeRepository,
16
+ condir,
17
+ debug,
18
+ enableDebug,
19
+ errorExit,
20
+ log,
21
+ } from '../Utils.mjs'
22
+
23
+ program
24
+ .name( 'init-my-chart' )
25
+ .description( 'Initialize a helm chart based on the latest Leverege leaf template' )
26
+ .option( '--dry-run', 'Print output to console instead of generating the char' )
27
+ .option( '--debug', 'Enable debug logging - use BUILD_TOOLS_DEBUG=1 for global' )
28
+ .parse()
29
+
30
+ const options = program.opts()
31
+
32
+ const DEFAULT_LIVENESS = {
33
+ httpGet : {
34
+ path : '/livenessProbe',
35
+ port : 'http'
36
+ },
37
+ initialDelaySeconds : 30,
38
+ periodSeconds : 60
39
+ }
40
+ const DEFAULT_READINESS = {
41
+ httpGet : {
42
+ path : '/healthz',
43
+ port : 'http'
44
+ },
45
+ initialDelaySeconds : 30,
46
+ periodSeconds : 10
47
+ }
48
+
49
+ const initMyChartRoot = `${BUILD_TOOLS_ROOT}/init-my-chart`
50
+ const repo = await analyzeRepository()
51
+
52
+ if ( !repo.isGitRepo ) {
53
+ errorExit( '***ERROR: This command must be run inside a git repository - run "git init" to proceed' )
54
+ }
55
+
56
+ if ( options.debug ) {
57
+ enableDebug()
58
+ }
59
+
60
+ if ( !repo.helmChart ) {
61
+ log( '*** Bootstrap with the Default Helm Template' ) // TODO: finish this
62
+ process.exit( 1 )
63
+ }
64
+
65
+ const { Chart, Values, Registry, } = repo.helmChart
66
+ const gitRoot = repo.gitRoot
67
+
68
+ if ( fs.existsSync( `${gitRoot}/helm-old` ) ) {
69
+ errorExit( '***ERROR: An old helm chart structure already exists - cannot proceed' )
70
+ }
71
+
72
+ let movedOldHelm = false
73
+ if ( fs.existsSync( `${gitRoot}/helm` ) && !options.dryRun ) {
74
+ fs.renameSync( `${gitRoot}/helm`, `${gitRoot}/helm-old` )
75
+ movedOldHelm = true
76
+ }
77
+
78
+ debug( { initMyChartRoot, movedOldHelm, repo }, '<==InitMyChart Root Variables' )
79
+
80
+ // initialize the chart templating engine
81
+ const helmTemplates = `${initMyChartRoot}/leaf-chart-templates`
82
+ const chartTemplateContent = fs.readFileSync( `${helmTemplates}/Chart.yaml.hbs`, 'utf8' )
83
+ const chartTemplate = handlebars.compile( chartTemplateContent )
84
+ const valuesTemplateContent = fs.readFileSync( `${helmTemplates}/values.yaml.hbs`, 'utf8' )
85
+ const valuesTemplate = handlebars.compile( valuesTemplateContent )
86
+
87
+ // perform handlebars replacements
88
+ const chartOutput = chartTemplate( {
89
+ containerName : Chart.name,
90
+ chartVersion : Chart.version || '0.1.0',
91
+ chartAppVersion : Chart.appVersion || 'v0.1.0',
92
+ } )
93
+
94
+ const valuesOutput = valuesTemplate( {
95
+ artifactRegistry : repo.helmChart.imageRegistry,
96
+ partOf : repo.helmChart.partOf,
97
+ redisEnabled : repo.redisEnabled,
98
+ } )
99
+
100
+ if ( options.dryRun ) {
101
+ condir( { Chart, Values, Registry, }, chalk.green( '=== Analyzed Repository Helm Chart Info ===' ) )
102
+ condir( { chartOutput, valuesOutput }, chalk.green( '=== Generated Helm Chart Outputs ===' ) )
103
+ log( { chartOutput }, chalk.green( '=== Chart.yaml ===' ) )
104
+ log( { valuesOutput }, chalk.green( '=== values.yaml ===' ) )
105
+ process.exit( 0 )
106
+ }
107
+
108
+ // Start building up the new chart structure
109
+ const helmDir = `${gitRoot}/helm`
110
+ if ( !fs.existsSync( helmDir ) ) {
111
+ fs.mkdirSync( helmDir )
112
+ }
113
+
114
+ // Copy over all the template files and then apply customizations to Chart and values
115
+ fs.cpSync( helmTemplates, helmDir, {
116
+ recursive : true,
117
+ filter : ( src, dest ) => path.extname( src ) !== '.hbs', // ignore handlebars templates
118
+ } )
119
+ fs.writeFileSync( `${helmDir}/Chart.yaml`, chartOutput, 'utf8' )
120
+ fs.writeFileSync( `${helmDir}/values.yaml`, valuesOutput, 'utf8' )
121
+
122
+ if ( movedOldHelm ) {
123
+ log( chalk.yellow( 'An existing helm chart was detected and moved to helm-old. Please review and migrate any customizations as needed.' ) )
124
+ }
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable security/detect-non-literal-fs-filename */
3
+
4
+ import fs from 'node:fs'
5
+ import path from 'node:path'
6
+
7
+ import { program } from 'commander'
8
+ import chalk from 'chalk'
9
+ import handlebars from 'handlebars'
10
+
11
+ import {
12
+ analyzeRepository,
13
+ condir,
14
+ debug,
15
+ enableDebug,
16
+ errorExit,
17
+ log,
18
+ } from '../Utils.mjs'
19
+
20
+ import { Chartwright } from './Chartwright.mjs'
21
+
22
+ program
23
+ .name( 'init-my-chart' )
24
+ .description( 'Initialize a helm chart based on the latest Leverege leaf template' )
25
+ .option( '--dry-run', 'Print output to console instead of generating the char' )
26
+ .option( '--debug', 'Enable debug logging - use BUILD_TOOLS_DEBUG=1 for global' )
27
+ .parse()
28
+
29
+ const options = program.opts()
30
+ const chartwright = await( new Chartwright( { debug : options.debug } ) ).init()
31
+
32
+ const repo = await analyzeRepository()
33
+
34
+ if ( !repo.isGitRepo ) {
35
+ errorExit( '***ERROR: This command must be run inside a git repository - run "git init" to proceed' )
36
+ }
37
+
38
+ if ( options.debug ) {
39
+ enableDebug()
40
+ }
41
+
42
+ if ( !repo.helmChart ) {
43
+ log( '*** Bootstrap with the Default Helm Template' ) // TODO: finish this
44
+ process.exit( 1 )
45
+ }
46
+
47
+ const { Chart, Values, Registry, } = repo.helmChart
48
+ const gitRoot = repo.gitRoot
49
+
50
+ if ( fs.existsSync( `${gitRoot}/helm-old` ) ) {
51
+ errorExit( '***ERROR: An old helm chart structure already exists - cannot proceed' )
52
+ }
53
+
54
+ let movedOldHelm = false
55
+ if ( fs.existsSync( `${gitRoot}/helm` ) && !options.dryRun ) {
56
+ fs.renameSync( `${gitRoot}/helm`, `${gitRoot}/helm-old` )
57
+ movedOldHelm = true
58
+ }
59
+
60
+ debug( { initMyChartRoot, movedOldHelm, repo }, '<==InitMyChart Root Variables' )
61
+
62
+ if ( options.dryRun ) {
63
+ condir( { Chart, Values, Registry, }, chalk.green( '=== Analyzed Repository Helm Chart Info ===' ) )
64
+ condir( { chartOutput, valuesOutput }, chalk.green( '=== Generated Helm Chart Outputs ===' ) )
65
+ chartwright.dump()
66
+ log( { chartOutput }, chalk.green( '=== Chart.yaml ===' ) )
67
+ log( { valuesOutput }, chalk.green( '=== values.yaml ===' ) )
68
+ process.exit( 0 )
69
+ }
70
+
71
+ // TODO: I needed to reset this effort because I didn't like the direction it was
72
+ // going in - I want to focus on the transformation of the existing chart to
73
+ // the new structure, and less on the templating aspect. The templating can be
74
+ // a secondary step that we add after we have the transformation working. For
75
+ // now, I will focus on the analysis and transformation of the existing chart,
76
+ // and then we can add the templating aspect later.
77
+
78
+ if ( movedOldHelm ) {
79
+ log( chalk.yellow( 'An existing helm chart was detected and moved to helm-old. Please review and migrate any customizations as needed.' ) )
80
+ }
@@ -0,0 +1,10 @@
1
+ name: {{containerName}}
2
+ version: {{chartVersion}}
3
+ appVersion: {{chartAppVersion}}
4
+ description: A leaf chart that depends on the Leverege base chart
5
+ apiVersion: v2
6
+ icon: https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.svg
7
+ dependencies:
8
+ - name: leverege
9
+ version: "^1.0.0"
10
+ repository: "oci://us-docker.pkg.dev/leverege-registry/base-charts"
@@ -0,0 +1 @@
1
+ {{ include "leverege.configmap" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.deployment" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.hpa" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.pdb" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.service" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.serviceaccount" . }}
@@ -0,0 +1 @@
1
+ {{ include "leverege.servicemonitor" . }}