@leverege/build-tools 2.99.1 → 2.100.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.
- package/package.json +8 -6
- package/src/circle-orb-it/circle-orb-it.mjs +178 -0
- package/src/circle-orb-it/circle-orb.yml +27 -0
- package/src/circle-orb-it/dependabot.yml +7 -0
- package/src/dashboard/DashboardManager.mjs +126 -0
- package/src/dashboard/dashboard.mjs +36 -0
- package/src/dashboard/json/standard/cloudnative-pg-20417-rev4.json +8827 -0
- package/src/dashboard/json/standard/elasticsearch8.json +6404 -0
- package/src/dashboard/json/standard/gpu-autoscaling-dashboard-ui-import.json +319 -0
- package/src/dashboard/json/standard/k8s-api-latency.json +166 -0
- package/src/dashboard/json/standard/noc-rows-12.json +1241 -0
- package/src/dashboard/json/standard/pvc-all-usage.json +943 -0
- package/src/dashboard/json/standard/redis.json +1513 -0
- package/src/dashboard/json/standard/stackdriver.json +624 -0
- package/src/dashboard/json/standard/traefik-op.json +1575 -0
- package/src/dashboard/json/standard/valkey.json +2373 -0
- package/src/helm-charts/eso/helmup.bootstrap +59 -0
- package/src/helm-charts/eso/helmup.plugin +34 -0
- package/src/helm-charts/prom-operator/expand-pvc.sh +54 -0
- package/src/helm-charts/prom-operator/helmup.plugin +1 -1
- package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +6 -3
- package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +2 -2
- package/src/circle-orb/circle-orb.mjs +0 -55
- package/src/circle-orb/circle-orb.yml +0 -24
- package/src/circleate.sh +0 -599
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# One-time bootstrap for the External Secrets Operator (ESO).
|
|
4
|
+
# Creates the GCP SA, grants Secret Manager access, and binds workload identity
|
|
5
|
+
# to the k8s SA that the ESO Helm chart creates ('external-secrets').
|
|
6
|
+
#
|
|
7
|
+
# See => https://external-secrets.io/latest/provider/google-secrets-manager/
|
|
8
|
+
#
|
|
9
|
+
function installEsoEnvironment() {
|
|
10
|
+
ESO_NAMESPACE="external-secrets"
|
|
11
|
+
ESO_SA="eso-sa"
|
|
12
|
+
ESO_SA_EMAIL="$ESO_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
|
|
13
|
+
|
|
14
|
+
gcloud config set project $GCP_PROJECT_ID
|
|
15
|
+
|
|
16
|
+
# Guard against accidental SA deletion on re-runs (see cnpg-operator for war story)
|
|
17
|
+
gcloud iam service-accounts describe $ESO_SA_EMAIL --project $GCP_PROJECT_ID &> $DEVNULL
|
|
18
|
+
if [ $? -eq 0 ];
|
|
19
|
+
then
|
|
20
|
+
cat<<SKIP_ESO_SA_CREATION
|
|
21
|
+
|
|
22
|
+
$YELO_WARN The ESO SA `color y $ESO_SA` already exists - skipping creation
|
|
23
|
+
|
|
24
|
+
To force a clean reinstall, delete both the GCP and k8s SAs for ESO and
|
|
25
|
+
re-run helmup eso.
|
|
26
|
+
|
|
27
|
+
SKIP_ESO_SA_CREATION
|
|
28
|
+
else
|
|
29
|
+
printf "\nCreating the gcloud `color g $ESO_SA` service account\n"
|
|
30
|
+
gcloud iam service-accounts create $ESO_SA \
|
|
31
|
+
--project "$GCP_PROJECT_ID" \
|
|
32
|
+
--description "External Secrets Operator SA" \
|
|
33
|
+
--display-name "External Secrets Operator SA" &> $DEVNULL
|
|
34
|
+
exitOnError $? "Failed to create GCP SA `color y $ESO_SA`"
|
|
35
|
+
waitForSA "$ESO_SA" "$GCP_PROJECT_ID" 60
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
printf "\nBinding Secret Manager accessor role to `color g $ESO_SA_EMAIL`\n"
|
|
39
|
+
gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
|
|
40
|
+
--member="serviceAccount:$ESO_SA_EMAIL" \
|
|
41
|
+
--role="roles/secretmanager.secretAccessor" \
|
|
42
|
+
--condition=None &> $DEVNULL
|
|
43
|
+
warnOnError $? "gcloud problem binding IAM policy"
|
|
44
|
+
waitForIAM "$ESO_SA" "$GCP_PROJECT_ID" "roles/secretmanager.secretAccessor" 60
|
|
45
|
+
|
|
46
|
+
# The ESO chart creates a k8s SA named 'external-secrets' (not $ESO_SA), so we
|
|
47
|
+
# bind workload identity manually here rather than using bindWorkloadIdentity
|
|
48
|
+
# which assumes the k8s SA name matches the GCP SA name.
|
|
49
|
+
printf "\nBinding workload identity: `color g $GCP_PROJECT_ID.svc.id.goog[$ESO_NAMESPACE/external-secrets]`\n"
|
|
50
|
+
gcloud iam service-accounts add-iam-policy-binding \
|
|
51
|
+
--project $GCP_PROJECT_ID \
|
|
52
|
+
--member "serviceAccount:$GCP_PROJECT_ID.svc.id.goog[$ESO_NAMESPACE/external-secrets]" \
|
|
53
|
+
--role roles/iam.workloadIdentityUser $ESO_SA_EMAIL
|
|
54
|
+
warnOnError $? "gcloud workload identity binding may have failed"
|
|
55
|
+
|
|
56
|
+
createNamespaceIfNeeded $ESO_NAMESPACE
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
installEsoEnvironment
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# See => https://external-secrets.io/latest/introduction/getting-started/
|
|
4
|
+
#
|
|
5
|
+
showInstalling "External Secrets Operator"
|
|
6
|
+
|
|
7
|
+
ESO_VER="2.2.0" # 03/2026
|
|
8
|
+
ESO_NAMESPACE="external-secrets"
|
|
9
|
+
ESO_SA="eso-sa"
|
|
10
|
+
|
|
11
|
+
helm upgrade --install external-secrets \
|
|
12
|
+
oci://ghcr.io/external-secrets/charts/external-secrets \
|
|
13
|
+
--namespace $ESO_NAMESPACE \
|
|
14
|
+
--version $ESO_VER \
|
|
15
|
+
--set serviceAccount.annotations."iam\.gke\.io/gcp-service-account"="$ESO_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
|
|
16
|
+
$HELM_WHAT
|
|
17
|
+
|
|
18
|
+
kubectl rollout status deployment -n $ESO_NAMESPACE external-secrets
|
|
19
|
+
kubectl rollout status deployment -n $ESO_NAMESPACE external-secrets-webhook
|
|
20
|
+
kubectl rollout status deployment -n $ESO_NAMESPACE external-secrets-cert-controller
|
|
21
|
+
|
|
22
|
+
# The ClusterSecretStore is a cluster-wide bridge to GCP Secret Manager.
|
|
23
|
+
# Authentication is implicit via the workload identity binding established
|
|
24
|
+
# in helmup.bootstrap - no credentials needed in the store spec itself.
|
|
25
|
+
cat<<CLUSTER_SECRET_STORE | kubectl apply -f -
|
|
26
|
+
apiVersion: external-secrets.io/v1
|
|
27
|
+
kind: ClusterSecretStore
|
|
28
|
+
metadata:
|
|
29
|
+
name: gcp-secret-manager
|
|
30
|
+
spec:
|
|
31
|
+
provider:
|
|
32
|
+
gcpsm:
|
|
33
|
+
projectID: ${GCP_PROJECT_ID}
|
|
34
|
+
CLUSTER_SECRET_STORE
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Expands the Prometheus PVC without data loss.
|
|
4
|
+
# Pauses Prometheus, resizes the CRD + PVC, orphan-deletes the StatefulSet
|
|
5
|
+
# (so the Operator recreates it), then unpauses.
|
|
6
|
+
|
|
7
|
+
NAMESPACE="prometheus"
|
|
8
|
+
CRD_NAME="prometheus-stack-kube-prom-prometheus"
|
|
9
|
+
PVC_NAME="prometheus-prometheus-stack-kube-prom-prometheus-db-prometheus-prometheus-stack-kube-prom-prometheus-0"
|
|
10
|
+
DISK_SIZE="96Gi"
|
|
11
|
+
|
|
12
|
+
# Pause Prometheus
|
|
13
|
+
kubectl patch prometheus "$CRD_NAME" -n "$NAMESPACE" \
|
|
14
|
+
--type merge -p '{"spec":{"paused":true}}'
|
|
15
|
+
|
|
16
|
+
# Resize storage in the Prometheus CRD
|
|
17
|
+
kubectl patch prometheus "$CRD_NAME" -n "$NAMESPACE" \
|
|
18
|
+
--type merge \
|
|
19
|
+
-p "{\"spec\":{\"storage\":{\"volumeClaimTemplate\":{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"$DISK_SIZE\"}}}}}}}"
|
|
20
|
+
|
|
21
|
+
# Resize the underlying PVC
|
|
22
|
+
kubectl patch pvc "$PVC_NAME" -n "$NAMESPACE" \
|
|
23
|
+
--type merge \
|
|
24
|
+
-p "{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"$DISK_SIZE\"}}}}"
|
|
25
|
+
|
|
26
|
+
# Orphan-delete the StatefulSet so the Operator recreates it with the new size
|
|
27
|
+
kubectl delete statefulset "prometheus-$CRD_NAME" -n "$NAMESPACE" --cascade=orphan
|
|
28
|
+
|
|
29
|
+
# Unpause Prometheus
|
|
30
|
+
kubectl patch prometheus "$CRD_NAME" -n "$NAMESPACE" \
|
|
31
|
+
--type merge \
|
|
32
|
+
-p '{"spec":{"paused":false}}'
|
|
33
|
+
|
|
34
|
+
cat <<EOF
|
|
35
|
+
|
|
36
|
+
PVC resize complete.
|
|
37
|
+
|
|
38
|
+
Don't forget: update the storage size in prometheus-stack.yaml.ovh
|
|
39
|
+
|
|
40
|
+
(prometheus.prometheusSpec.storageSpec.volumeClaimTemplate.spec.resources.requests.storage)
|
|
41
|
+
|
|
42
|
+
retention: 30d
|
|
43
|
+
storageSpec:
|
|
44
|
+
volumeClaimTemplate:
|
|
45
|
+
spec:
|
|
46
|
+
accessModes: ["ReadWriteOnce"]
|
|
47
|
+
resources:
|
|
48
|
+
requests:
|
|
49
|
+
storage: 96Gi
|
|
50
|
+
^^^^
|
|
51
|
+
Adjust size as needed
|
|
52
|
+
|
|
53
|
+
to match DISK_SIZE=$DISK_SIZE, then run helm upgrade to keep the release in sync.
|
|
54
|
+
EOF
|
|
@@ -8,7 +8,7 @@ showInstalling "The Prometheus Operator (kube-prometheus-stack)"
|
|
|
8
8
|
|
|
9
9
|
# https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
|
|
10
10
|
OCI_CHART="oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack"
|
|
11
|
-
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="82.
|
|
11
|
+
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="82.15.0"
|
|
12
12
|
helm upgrade $NS --install prometheus-stack $OCI_CHART \
|
|
13
13
|
--values prom-operator/prometheus-stack.yaml \
|
|
14
14
|
--version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
|
|
@@ -57,8 +57,9 @@ kubelet:
|
|
|
57
57
|
# prober_probe_duration_seconds is high-cardinality (1 histogram per
|
|
58
58
|
# container probe × node) and not referenced by any alerts or dashboards
|
|
59
59
|
- sourceLabels: [__name__]
|
|
60
|
-
regex: prober_probe_duration_seconds.*
|
|
60
|
+
regex: prober_probe_duration_seconds.*|kubelet_runtime_operations_duration_seconds.*
|
|
61
61
|
action: drop
|
|
62
|
+
|
|
62
63
|
defaultRules:
|
|
63
64
|
create: true
|
|
64
65
|
rules:
|
|
@@ -118,7 +119,7 @@ prometheus:
|
|
|
118
119
|
accessModes: ["ReadWriteOnce"]
|
|
119
120
|
resources:
|
|
120
121
|
requests:
|
|
121
|
-
storage:
|
|
122
|
+
storage: 50Gi # Adjust size as needed
|
|
122
123
|
|
|
123
124
|
# External access to prometheus may be enabled by creating an htpasswd secret
|
|
124
125
|
# by running this example command:
|
|
@@ -168,7 +169,7 @@ grafana:
|
|
|
168
169
|
enabled: true
|
|
169
170
|
service:
|
|
170
171
|
port: 3000
|
|
171
|
-
# -- the grafana admin password
|
|
172
|
+
# -- the grafana admin password 1st time
|
|
172
173
|
adminPassword: leverege-monitoring
|
|
173
174
|
defaultDashboardsEnabled: false
|
|
174
175
|
persistence:
|
|
@@ -179,6 +180,8 @@ grafana:
|
|
|
179
180
|
sidecar:
|
|
180
181
|
dashboards:
|
|
181
182
|
enabled: true
|
|
183
|
+
env:
|
|
184
|
+
GF_SERVER_ROOT_URL: https://${PROJECT_NAME}-monitoring.${HOST}.com
|
|
182
185
|
extraObjects:
|
|
183
186
|
- apiVersion: traefik.io/v1alpha1
|
|
184
187
|
kind: IngressRoute
|
|
@@ -306,8 +306,8 @@ spec:
|
|
|
306
306
|
VALUE = {{ $value }}
|
|
307
307
|
LABELS = {{ $labels }}
|
|
308
308
|
- alert: PrometheusTimeseriesCardinality
|
|
309
|
-
expr: label_replace(count by(__name__) ({__name__=~".+"}), "name", "$1", "__name__", "(.+)") >
|
|
310
|
-
for:
|
|
309
|
+
expr: label_replace(count by(__name__) ({__name__=~".+"}), "name", "$1", "__name__", "(.+)") > 15000
|
|
310
|
+
for: 10m
|
|
311
311
|
labels:
|
|
312
312
|
severity: warning
|
|
313
313
|
annotations:
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable */ // for now, we can relax this rule since ...
|
|
3
|
-
/* eslint-disable security/detect-non-literal-fs-filename */
|
|
4
|
-
import fs from 'node:fs'
|
|
5
|
-
|
|
6
|
-
import { program } from 'commander'
|
|
7
|
-
import chalk from 'chalk'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
analyzeRepository,
|
|
11
|
-
condir,
|
|
12
|
-
enableDebug,
|
|
13
|
-
errorExit,
|
|
14
|
-
log,
|
|
15
|
-
} from '../Utils.mjs'
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.name( 'circle-orb' )
|
|
19
|
-
.description( 'updates a .circle/circle.yml to use the leverge orb' )
|
|
20
|
-
.option( '--debug', 'Enable debug logging - use BUILD_TOOLS_DEBUG=1 for global' )
|
|
21
|
-
.parse()
|
|
22
|
-
|
|
23
|
-
const options = program.opts()
|
|
24
|
-
if ( options.debug ) {
|
|
25
|
-
enableDebug() // enables debugging in the Utils functions
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const repo = await analyzeRepository()
|
|
29
|
-
if ( !repo.isGitRepo ) {
|
|
30
|
-
errorExit( '***ERROR: This command must be run inside a git repository - run "git init" to proceed' )
|
|
31
|
-
}
|
|
32
|
-
const Container = repo.containerName
|
|
33
|
-
const chartwright = new Chartwright( { Container, debug : options.debug } )
|
|
34
|
-
|
|
35
|
-
// If there isn't an existing helm chart then we just bootstrap the new chart structure
|
|
36
|
-
// from the current helm template and we're done. This will most likely be the case after
|
|
37
|
-
// a new service has been bootstrapped with ignition.
|
|
38
|
-
if ( !repo.helmChart ) {
|
|
39
|
-
await chartwright.bootstrap( { Container } )
|
|
40
|
-
process.exit( 0 )
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Safety First: if there is already an older helm chart, we don't want to overwrite it - we
|
|
44
|
-
// want the user to review / intervene before proceeding.
|
|
45
|
-
const packageRoot = repo.currentDir
|
|
46
|
-
if ( fs.existsSync( `${packageRoot}/helm-old` ) ) {
|
|
47
|
-
errorExit( '***ERROR: An old helm chart structure already exists - cannot proceed' )
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const {
|
|
51
|
-
Chart,
|
|
52
|
-
Values,
|
|
53
|
-
valuesText : ValuesText,
|
|
54
|
-
imageRegistry : Registry,
|
|
55
|
-
} = repo.helmChart
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# See => https://bitbucket.org/leverege/circle-nodejs-ci/src/development/
|
|
2
|
-
version: 2.1
|
|
3
|
-
|
|
4
|
-
orbs:
|
|
5
|
-
leverege: leverege/circle-nodejs-ci@0.3.0
|
|
6
|
-
|
|
7
|
-
workflows:
|
|
8
|
-
build-and-verify:
|
|
9
|
-
jobs:
|
|
10
|
-
- leverege/install-dependencies:
|
|
11
|
-
context: npm
|
|
12
|
-
- leverege/code-analysis:
|
|
13
|
-
requires:
|
|
14
|
-
- leverege/install-dependencies
|
|
15
|
-
- leverege/code-coverage:
|
|
16
|
-
coverage-threshold: 70
|
|
17
|
-
context: leverege-gcp # 👈 attaches the secure secrets access to GCP_SA_KEY_JSON
|
|
18
|
-
enable-redis: false
|
|
19
|
-
cache-config: '{"type":"inMemory"}' # '{"type":"redis"}'
|
|
20
|
-
requires:
|
|
21
|
-
- leverege/install-dependencies
|
|
22
|
-
- leverege/generate-docs:
|
|
23
|
-
requires:
|
|
24
|
-
- leverege/install-dependencies
|