@leverege/build-tools 2.86.2 → 2.87.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.86.2",
3
+ "version": "2.87.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -77,14 +77,14 @@
77
77
  "ignore": "^7.0.5",
78
78
  "inquirer": "^12.9.6",
79
79
  "js-yaml": "^4.1.0",
80
- "jsdoc": "^4.0.4",
80
+ "jsdoc": "^4.0.5",
81
81
  "ms": "^2.1.3",
82
82
  "npm-registry-fetch": "^19.0.0",
83
83
  "ora": "^9.0.0",
84
84
  "p-limit": "^7.1.1",
85
85
  "package-up": "^5.0.0",
86
86
  "readline-sync": "^1.4.10",
87
- "semver": "^7.7.2",
87
+ "semver": "^7.7.3",
88
88
  "shell-quote": "^1.8.3",
89
89
  "simple-git": "^3.28.0",
90
90
  "sloc": "^0.3.2",
package/src/bash-funcs CHANGED
@@ -150,6 +150,55 @@ REPOADD
150
150
  helm repo update &> $DEVNULL
151
151
  }
152
152
 
153
+ # waitForSA SVC_ACCT PROJECT [TIMEOUT_SECONDS]
154
+ function waitForSA() {
155
+ local svcAcct="$1" project="$2" timeout="${3:-120}"
156
+ local svcAcctEmail="$svcAcct@$project.iam.gserviceaccount.com"
157
+ local start=$(date +%s) delay=2
158
+
159
+ echo "⏳ waiting for SA ${svcAcct} in project ${project} (timeout ${timeout}s)..." >&2
160
+ while true; do
161
+ if gcloud iam service-accounts describe "$svcAcctEmail" --project "$project" &> "$DEVNULL";
162
+ then
163
+ echo "✅ SA is visible: ${svcAcct}" >&2
164
+ return 0
165
+ fi
166
+ if (( $(date +%s) - start >= timeout ));
167
+ then
168
+ echo "❌ timed out waiting for SA ${svcAcct}" >&2
169
+ return 1
170
+ fi
171
+ sleep "$delay"; (( delay = delay < 20 ? delay * 2 : 20 ))
172
+ done
173
+ }
174
+
175
+ # waitForIAM SVC_ACCT PROJECT ROLE [TIMEOUT_SECONDS]
176
+ # Example MEMBER: "serviceAccount:my-sa@proj.iam.gserviceaccount.com"
177
+ function waitForIAM() {
178
+ local svcAcct="$1" project="$2" role="$3" timeout="${4:-120}"
179
+ local svcAcctEmail="serviceAccount:${svcAcct}@${project}.iam.gserviceaccount.com"
180
+ local start=$(date +%s) delay=2
181
+
182
+ echo "⏳ waiting for IAM binding ${role} → ${svcAcct} on project ${project} (timeout ${timeout}s)..." >&2
183
+ while true; do
184
+ # If the binding exists, the formatted value will be non-empty.
185
+ local found
186
+ found="$(gcloud projects get-iam-policy "${project}" \
187
+ --flatten="bindings[].members" \
188
+ --filter="bindings.role=${role} AND bindings.members=${svcAcctEmail}" \
189
+ --format="value(bindings.role)" 2> "$DEVNULL")"
190
+ if [[ -n "$found" ]]; then
191
+ echo "✅ IAM binding active: ${role} → ${svcAcct}" >&2
192
+ return 0
193
+ fi
194
+ if (( $(date +%s) - start >= timeout )); then
195
+ echo "❌ timed out waiting for IAM binding ${role} → ${svcAcct}" >&2
196
+ return 1
197
+ fi
198
+ sleep "$delay"; (( delay = delay < 20 ? delay * 2 : 20 ))
199
+ done
200
+ }
201
+
153
202
  # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
154
203
  # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
155
204
  # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
@@ -13,12 +13,9 @@ import {
13
13
  debug,
14
14
  log,
15
15
  shellCmd,
16
- } from '../../Utils.mjs'
17
- const auditProjects = [
18
- 'leverege-cnpg-20240729',
19
- ]
16
+ } from '../Utils.mjs'
20
17
 
21
- const ALLauditProjects = [
18
+ const auditProjects = [
22
19
  'dev-controltek',
23
20
  'dev-cox-health',
24
21
  'dev-pitcrew',
@@ -94,7 +91,6 @@ const filterBitnamiImages = ( project, imagesJSON ) => {
94
91
  let img = c.image
95
92
 
96
93
  // Only keep bitnami images
97
- log( { img }, '<==IMAGE' )
98
94
  if ( !/bitnami/.test( img ) ) continue
99
95
 
100
96
  // Registry decluttering
@@ -5,7 +5,7 @@
5
5
  # - node tools/UpdateESMappingV2.js
6
6
  #
7
7
  image:
8
- tag: # v5.26.0
8
+ tag: # v5.26.10
9
9
 
10
10
  config:
11
11
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -4,7 +4,7 @@
4
4
  # - npm run sequelizeRunMigrations
5
5
  #
6
6
  image:
7
- tag: # v2.6.0
7
+ tag: # v2.6.1
8
8
 
9
9
  config:
10
10
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -52,6 +52,7 @@ SKIP_CNPG_SA_CREATION
52
52
  --description "CNPG Operands SA" \
53
53
  --display-name "CNPG Operands SA" &> $DEVNULL
54
54
  warnOnError $? "the GCP SA `color y $CNPG_SVC_ACCT` may already exist"
55
+ waitForSA "$CNPG_SVC_ACCT" "$GCP_PROJECT_ID" 60
55
56
 
56
57
  CNPG_OPS_ROLE="cnpg.operands"
57
58
  printf "\nCreating the `color g $CNPG_OPS_ROLE` IAM role\n"
@@ -96,15 +97,19 @@ SKIP_CNPG_SA_CREATION
96
97
  printf "\nBinding IAM role to the SA `color g $CNPG_SVC_EMAIL`\n"
97
98
  gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
98
99
  --member="serviceAccount:$CNPG_SVC_EMAIL" \
99
- --role "roles/storage.admin" &> $DEVNULL
100
+ --role "roles/storage.admin" \
101
+ --condition=None &> $DEVNULL
100
102
  # --role projects/$GCP_PROJECT_ID/roles/$CNPG_OPS_ROLE &> $DEVNULL
101
103
  # --role "roles/storage.admin" &> $DEVNULL
102
104
  warnOnError $? "gcloud problem binding IAM policy"
105
+ waitForIAM "$CNPG_SVC_ACCT" "$GCP_PROJECT_ID" "roles/storage.admin" 60
103
106
 
104
107
  printf "\nBinding IAM the Token Creator role to the SA `color g $CNPG_SVC_EMAIL`\n"
105
108
  gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
106
109
  --member="serviceAccount:$CNPG_SVC_EMAIL" \
107
- --role="roles/iam.serviceAccountTokenCreator"
110
+ --role="roles/iam.serviceAccountTokenCreator" \
111
+ --condition=None
112
+ waitForIAM "$CNPG_SVC_ACCT" "$GCP_PROJECT_ID" "roles/iam.serviceAccountTokenCreator" 60
108
113
 
109
114
  # workload binding will be performed by each cnpg operand on startup
110
115
 
@@ -180,11 +185,14 @@ CNPG_FETCH_CLEANUP_CRONJOB_YAML
180
185
  --description="Used for cronjob cleanup with Workload Identity" \
181
186
  --display-name="CNPG Cleanup SA" &> $DEVNULL
182
187
  warnOnError $? "the GCP SA $CNPG_CLEANUP_SA may already exist"
188
+ waitForSA "$CNPG_CLEANUP_SA" "$GCP_PROJECT_ID" 60
183
189
 
184
190
  gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
185
191
  --project="$GCP_PROJECT_ID" \
186
192
  --member="serviceAccount:$CNPG_CLEANUP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
187
- --role="roles/storage.objectViewer"
193
+ --role="roles/storage.objectViewer" \
194
+ --condition=None
195
+ waitForIAM "$CNPG_CLEANUP_SA" "$GCP_PROJECT_ID" "roles/storage.objectViewer" 60
188
196
 
189
197
  bindWorkloadIdentity "$CNPG_CLEANUP_SA" "$CNPG_NAMESPACE"
190
198
 
@@ -198,4 +206,4 @@ CNPG_CLEANUP_CRONJOB_APPLY
198
206
  }
199
207
  # Run it!
200
208
  installCnpgOperatorEnvironment
201
- installCnpgCleanupCronjob
209
+ installCnpgCleanupCronjob
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v6.0.0
2
+ tag: # v6.2.0
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -15,6 +15,13 @@ image:
15
15
  repository: leverege-registry/bitnami-mirror/images/elasticsearch
16
16
  # tag: 8.18.0
17
17
 
18
+ sysctlImage:
19
+ registry: us-docker.pkg.dev
20
+ repository: leverege-registry/bitnami-mirror/images/os-shell
21
+ volumePermissions:
22
+ image:
23
+ repository: leverege-registry/bitnami-mirror/images/os-shell
24
+
18
25
  global:
19
26
  security:
20
27
  allowInsecureImages: true
@@ -15,6 +15,13 @@ image:
15
15
  repository: leverege-registry/bitnami-mirror/images/elasticsearch
16
16
  # tag: 8.18.0
17
17
 
18
+ sysctlImage:
19
+ registry: us-docker.pkg.dev
20
+ repository: leverege-registry/bitnami-mirror/images/os-shell
21
+ volumePermissions:
22
+ image:
23
+ repository: leverege-registry/bitnami-mirror/images/os-shell
24
+
18
25
  global:
19
26
  security:
20
27
  allowInsecureImages: true
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v2.1.3
2
+ tag: # v2.1.4
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -32,12 +32,14 @@ function installStackdriverExporterEnvironment() {
32
32
  --project "$GCP_PROJECT_ID" \
33
33
  --display-name "Prometheus Stackdriver Exporter" &> $DEVNULL
34
34
  warnOnError $? "the GCP SA $SDEXP_SA may already exist"
35
+ waitForSA "$SDEXP_SA" "$GCP_PROJECT_ID" 60
35
36
 
36
37
  printf "\n*** Binding IAM role of $SDEXP_NS viewer to $SDEXP_SA in $GCP_PROJECT_ID\n"
37
38
  gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
38
39
  --role "roles/monitoring.viewer" \
39
- --member "serviceAccount:$SDEXP_EM" &> $DEVNULL
40
- sleep 2 # give the IAM binding a chance to complete before moving on
40
+ --member "serviceAccount:$SDEXP_EM" \
41
+ --condition=None --quiet &> $DEVNULL
42
+ waitForIAM "$SDEXP_SA" "$GCP_PROJECT_ID" "roles/monitoring.viewer" 60
41
43
 
42
44
  bindWorkloadIdentity $SDEXP_SA $SDEXP_NS
43
45
 
@@ -6,7 +6,7 @@ addHelmRepo prometheus-community https://prometheus-community.github.io/helm-cha
6
6
  NS="--namespace prometheus"
7
7
 
8
8
  showInstalling "The Prometheus Operator (kube-prometheus-stack)"
9
- [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="75"
9
+ [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="77"
10
10
 
11
11
  # https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
12
12
  helm upgrade $NS --install prometheus-stack prometheus-community/kube-prometheus-stack \
@@ -1,4 +1,51 @@
1
- enabled: true
1
+ crds:
2
+ # ─────────────────────────────────────────────────────────────────────────────
3
+ # CRD MANAGEMENT — kube-prometheus-stack
4
+ #
5
+ # Why this exists
6
+ # Helm can install CustomResourceDefinitions (CRDs) but will not upgrade them
7
+ # when you bump chart versions. This chart ships a CRD upgrade job that uses
8
+ # server-side apply (SSA) to reconcile CRDs to the versions bundled with the
9
+ # chart.
10
+ #
11
+ # Safe operating model
12
+ # ✅ Leave the upgrade job ENABLED if this chart is the sole owner of the
13
+ # Prometheus Operator CRDs.
14
+ # ⚠️ Keep "forceConflicts" DISABLED unless you hit a specific field-manager
15
+ # conflict that you’ve reviewed and want this chart to own.
16
+ # ❌ If another source manages CRDs (e.g., a separate CRD chart, GitOps
17
+ # bootstrap, platform repo), DISABLE the job to avoid ownership fights.
18
+ #
19
+ # Settings
20
+ # enabled: runs the SSA job on chart upgrade to reconcile CRDs.
21
+ # Recommended: true if chart owns the CRDs; false if
22
+ # another tool owns them.
23
+ #
24
+ # forceConflicts: adds `--force-conflicts` to SSA, overriding fields owned by
25
+ # another controller. Use only for a one-time conflict
26
+ # resolution. Can overwrite annotations and mask real
27
+ # incompatibilities if left true.
28
+ #
29
+ # Recommended defaults
30
+ # enabled: true
31
+ # forceConflicts: false
32
+ #
33
+ # Mini-runbook
34
+ # 1) Preflight:
35
+ # kubectl get crd | grep monitoring.coreos.com
36
+ # kubectl apply --server-side --dry-run=server -f <crd-dir/>
37
+ # 2) Upgrade with enabled: true, forceConflicts: false.
38
+ # 3) If job fails with conflicts:
39
+ # - confirm no other source manages these CRDs
40
+ # - temporarily set forceConflicts: true for this upgrade only
41
+ # - revert to false afterwards
42
+ # 4) Post-check: CRDs Established, operator healthy, alerts/rules normal
43
+ # ─────────────────────────────────────────────────────────────────────────────
44
+ enabled: true
45
+ upgradeJob:
46
+ enabled: true
47
+ forceConflicts: false # See README-CRD-UPGRADES.md
48
+
2
49
  kubeControllerManager:
3
50
  enabled: false
4
51
  nodeExporter:
@@ -31,6 +78,16 @@ defaultRules:
31
78
  prometheus: false
32
79
  prometheusOperator: false
33
80
 
81
+ # default is using kube-dns which is usually sufficient for our needs but
82
+ # can be switched over to CoreDNS if the need arises
83
+ coreDns:
84
+ enabled: false
85
+
86
+ # managed GKE does not provide direct access to the k8s scheduler so we
87
+ # can safely disable this here - see the Stackdrive Monitoring for more
88
+ kubeScheduler:
89
+ enabled: false
90
+
34
91
  prometheus:
35
92
  prometheusSpec:
36
93
  # image:
@@ -53,16 +110,6 @@ prometheus:
53
110
  requests:
54
111
  storage: 50Gi # Adjust size as needed
55
112
 
56
- # default is using kube-dns which is usually sufficient for our needs but
57
- # can be switched over to CoreDNS if the need arises
58
- coreDns:
59
- enabled: false
60
-
61
- # managed GKE does not provide direct access to the k8s scheduler so we
62
- # can safely disable this here - see the Stackdrive Monitoring for more
63
- kubeScheduler:
64
- enabled: false
65
-
66
113
  grafana:
67
114
  enabled: true
68
115
  service:
@@ -5,7 +5,7 @@
5
5
  # - npm run sequelizeRunMigrations
6
6
  #
7
7
  image:
8
- tag: # v1.16.0
8
+ tag: # v1.21.0
9
9
 
10
10
  config:
11
11
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v3.7.1
2
+ tag: # v3.7.4
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -32,36 +32,16 @@ metrics:
32
32
  interval: 30s
33
33
  namespace: prometheus
34
34
 
35
- # To enable the trafik dashboard uncomment the --api-secure switch, uncomment
36
- # the ports statment and the first block that defines the traefik port at 9000.
37
- # Redploy traefik and once it is stable port-forward:
38
- # kubectl port-forward -n traefik deployment/traefik 9000:9000
39
- # and open the dashboard on a browser:
40
- # http://localhost:9000/dashboard/
41
- # For more info:
42
- # https://doc.traefik.io/traefik/operations/api/
35
+ # Enable the traefik dashboard by enabling api.insecure.
36
+ # For more info => https://doc.traefik.io/traefik/operations/api/
37
+ # Dashboard URL => http://localhost:8080/dashboard/
43
38
  #
44
39
  additionalArguments:
45
- # - "--api.insecure=true" # uncomment for dashboard
40
+ - "--api.insecure=true" # uncomment for dashboard
46
41
 
47
42
  # enable read response timeouts
48
43
  # - "--entrypoints.web.transport.respondingTimeouts.readTimeout=300"
49
44
 
50
- # Custom entry points may be added here - the first one is for the traefik
51
- # dashboard (see comment above)two are port definitions
52
- # for both unsecured and secured MQTT ports used by connect. Note that the
53
- # mqtts port has TLS termination performed by traefik and both ports are then
54
- # forwarded to one open port (1883) on the target service. The vernemq service
55
- # chart provides the IngressRouteTCP chart to make this happen.
56
- #
57
- #ports:
58
- # traefik: # dashboard access!
59
- # port: 9000
60
- # expose:
61
- # default: true
62
- # eposedPort: 9000
63
- # protocol: TCP
64
- #
65
45
  # These port definitions are for both unsecured and secured MQTT ports used by
66
46
  # connect. Note that the mqtts port has TLS termination performed by traefik
67
47
  # and both ports are then forwarded to one open port (1883) on the target
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-bq
2
2
 
3
3
  image:
4
- tag: # v5.6.1
4
+ tag: # v5.7.0
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "bigQueryJson"
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-dh
2
2
 
3
3
  image:
4
- tag: # v5.6.0
4
+ tag: # v5.7.0
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "denseHistoryCombined"
@@ -1,7 +1,7 @@
1
1
  nameOverride: transponder-rt
2
2
 
3
3
  image:
4
- tag: # v5.6.1
4
+ tag: # v5.7.0
5
5
 
6
6
  config:
7
7
  TRANSPONDER_RUN_MODE: "rt"
@@ -7,7 +7,7 @@
7
7
  nameOverride: transponder-tsdb
8
8
 
9
9
  image:
10
- tag: # v5.6.0
10
+ tag: # v5.7.0
11
11
 
12
12
  config:
13
13
  TRANSPONDER_RUN_MODE: "timescale"
@@ -10,7 +10,7 @@ function installVeleroEnvironment() {
10
10
  gcloud config set project $GCP_PROJECT_ID
11
11
 
12
12
  ## The major chart version will determine the bucket suffix
13
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="10"
13
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="11"
14
14
 
15
15
  ## Create a bucket
16
16
  BUCKET="$GCP_PROJECT_ID-velero-$VELERO_CHART_VERSION"
@@ -27,8 +27,8 @@ function installVeleroEnvironment() {
27
27
  --description "Velero service account" &> $DEVNULL
28
28
  if [ $? -eq 0 ];
29
29
  then
30
- # no error means a new SA was created - slight delay to let it update
31
- sleep 2
30
+ # no error means a new SA was created - wait for it to become active
31
+ waitForSA "velero" "$GCP_PROJECT_ID" 60
32
32
  else
33
33
  printf "$YELO_WARN Failed to create the service account - does it already exist?"
34
34
  fi
@@ -77,6 +77,7 @@ function installVeleroEnvironment() {
77
77
  --condition 'None' \
78
78
  --role projects/$GCP_PROJECT_ID/roles/velero.server &> $DEVNULL
79
79
  warnOnError $? "gcloud problem binding IAM policy"
80
+ waitForIAM "velero" "$GCP_PROJECT_ID" "projects/$GCP_PROJECT_ID/roles/velero.server" 60
80
81
 
81
82
  printf "\nBinding workload identity IAM policy to the SA\n"
82
83
  gcloud iam service-accounts add-iam-policy-binding \
@@ -4,7 +4,7 @@ showInstalling "Velero Backup System"
4
4
 
5
5
  addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
6
6
 
7
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="10"
7
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="11"
8
8
  #
9
9
  # Build the bucket, region and SA email variables and use --set to mod the
10
10
  # chart values as opposed to using an ${label} approach. This eliminates