@leverege/build-tools 2.97.0 → 2.98.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.
@@ -3,7 +3,7 @@
3
3
  # Declare variables to be passed into your templates.
4
4
  image:
5
5
  pullPolicy: IfNotPresent
6
- registry: {{artifactRegistry}}
6
+ registry: {{hbsArtifactRegistry}}
7
7
  # Overrides the image tag whose default is the chart appVersion.
8
8
  tag: ""
9
9
 
@@ -32,12 +32,12 @@ fullnameOverride: ""
32
32
  # When multiple charts or pieces of software are used together to make one
33
33
  # application. For example, application software and a database to produce
34
34
  # a website. This can be set to the top level application being supported.
35
- partOf: "{{partOf}}"
35
+ partOf: {{hbsPartOf}} # leverege-stack or project-x - OPTIONAL
36
36
 
37
37
  # overwhelm will auto inject project_id, host and ingress into service
38
38
  service:
39
39
  project_id: set-in-values-yaml
40
- preemptible: false
40
+ preemptible: {{hbsServicePreemptible}} # true or false - OPTIONAL
41
41
  type: ClusterIP
42
42
 
43
43
  serviceAccount:
@@ -51,36 +51,17 @@ serviceAccount:
51
51
 
52
52
  # enable the service monitor for providing metrics to the prometheus operator
53
53
  serviceMonitor:
54
- enabled: false
54
+ enabled: true
55
55
  interval: "60s"
56
56
  namespace: "default" # namespace where service to scrape resides
57
57
 
58
- # can be used to set load balancer to registered static IP
59
- loadbalancer:
60
- ip: ""
61
-
62
- udploadbalancer:
63
- ip: ""
64
-
65
58
  # liveness and readiness probe to prove k8s health
66
59
  probes:
67
60
  enabled: true
68
- livenessProbe:
69
- httpGet:
70
- path: /livenessProbe
71
- port: http
72
- initialDelaySeconds: 30
73
- periodSeconds: 60
74
- readinessProbe:
75
- httpGet:
76
- path: /healthz
77
- port: http
78
- initialDelaySeconds: 30
79
- periodSeconds: 10
80
61
 
81
62
  # this tells calico that redis access is needed
82
63
  redis:
83
- enabled: {{redisEnabled}}
64
+ enabled: {{hbsRedisEnabled}}
84
65
 
85
66
  # setting to false will allow pod disk to mount read/write
86
67
  # setting this to false should only be done for debugging
@@ -101,7 +82,7 @@ resources:
101
82
 
102
83
  # use auto scaling for dynamically sized workloads
103
84
  autoscaling:
104
- enabled: false # set to false for static scaling
85
+ enabled: {{hbsAutoscalingEnabled}} # set to false for static scaling
105
86
  minReplicas: 2
106
87
  maxReplicas: 8
107
88
  averageCPU: 75
@@ -120,16 +101,10 @@ pdb:
120
101
 
121
102
  affinity: {}
122
103
 
123
- # typically handled by traefik, but not always
124
- ingressRoute:
125
- host: ""
104
+ tolerations: []
126
105
 
127
106
  nodeSelector: {}
128
107
 
129
108
  podAnnotations: {}
130
109
 
131
- tolerations: []
132
-
133
110
  workloadIdentity: {}
134
-
135
- canary: {}
package/src/k8scale.sh CHANGED
@@ -36,6 +36,8 @@ else
36
36
  overwhelm || { printf "\n\n***Aborting helmup...\n\n"; exit 1; }
37
37
  fi
38
38
 
39
+ GCP_PROJECT_ID="$(getProjectIdFromK8sContext)"
40
+
39
41
  printf " scaled => `color g $DIRECTION`\n\n"
40
42
  for DEPLOYMENT in "$@";
41
43
  do
@@ -1,124 +0,0 @@
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
- }