@leverege/build-tools 2.80.1 → 2.82.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 (53) hide show
  1. package/.vscode/launch.json +22 -0
  2. package/package.json +7 -6
  3. package/src/Utils.mjs +2 -2
  4. package/src/bash-funcs +21 -0
  5. package/src/bitnami-audit.mjs +169 -0
  6. package/src/bitnami-audit.sh +75 -0
  7. package/src/bitnami-to-leverege-artifacts.sh +140 -0
  8. package/src/count-lines-of-code.mjs +6 -4
  9. package/src/crane-lift.sh +11 -0
  10. package/src/helm-charts/argocd/.nohelm +0 -0
  11. package/src/helm-charts/argocd/.nohelmdn +0 -0
  12. package/src/helm-charts/argocd/helmup.bootstrap +3 -0
  13. package/src/helm-charts/argocd/helmup.plugin +3 -0
  14. package/src/helm-charts/cnpg-db-pgbench/helmup.bootstrap +11 -0
  15. package/src/helm-charts/cnpg-db-psql-stack/helmup.bootstrap +11 -0
  16. package/src/helm-charts/cnpg-db-psql-stack/helmup.plugin +1 -1
  17. package/src/helm-charts/cnpg-db-recovery/helmup.bootstrap +11 -0
  18. package/src/helm-charts/cnpg-db-recovery/helmup.plugin +1 -1
  19. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.bootstrap +11 -0
  20. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.plugin +1 -1
  21. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.bootstrap +11 -0
  22. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.plugin +1 -1
  23. package/src/helm-charts/cnpg-operator/helmdn.plugin +1 -1
  24. package/src/helm-charts/cnpg-operator/helmup.bootstrap +201 -0
  25. package/src/helm-charts/cnpg-operator/helmup.plugin +1 -1
  26. package/src/helm-charts/cnpg-operator/operand.bootstrap +41 -0
  27. package/src/helm-charts/elasticsearch8/elasticsearch-local-dev.yaml +9 -0
  28. package/src/helm-charts/elasticsearch8/elasticsearch-local-prd.yaml +9 -0
  29. package/src/helm-charts/elasticsearch8/helmup.plugin +3 -3
  30. package/src/helm-charts/pgbouncer/helmup.bootstrap +24 -0
  31. package/src/helm-charts/postgres/.nohelm +0 -0
  32. package/src/helm-charts/postgres/.nohelmdn +0 -0
  33. package/src/helm-charts/postgres/README.md +6 -0
  34. package/src/helm-charts/postgres/helmdn.plugin +3 -0
  35. package/src/helm-charts/postgres/helmup.plugin +21 -0
  36. package/src/helm-charts/postgres/postgres-local.yaml +51 -0
  37. package/src/helm-charts/prom-operator/helmup.bootstrap +47 -0
  38. package/src/helm-charts/prom-operator/rules/traefik-rules.yaml +2 -2
  39. package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +2 -1
  40. package/src/helm-charts/redis/helmup.plugin +2 -2
  41. package/src/helm-charts/redis/values-local.yaml +14 -0
  42. package/src/helm-charts/traefik/helmup.plugin +1 -1
  43. package/src/helm-charts/traefik/values-local.yaml +1 -1
  44. package/src/helm-charts/valkey/helmup.plugin +3 -3
  45. package/src/helm-charts/valkey/valkey-local.yaml +11 -1
  46. package/src/helm-charts/velero/helmup.bootstrap +104 -0
  47. package/src/helm-charts/velero/helmup.plugin +1 -1
  48. package/src/helmdn.sh +2 -1
  49. package/src/helmup.sh +65 -644
  50. package/src/init-my-chart.mjs +18 -0
  51. package/src/k8x.sh +4 -0
  52. package/src/overwhelm.mjs +1 -1
  53. package/.vscode/settings.json +0 -3
@@ -9,7 +9,7 @@ OPERATOR_SHUTDOWN
9
9
 
10
10
  yesToContinue "to delete the CNPG Operator"
11
11
 
12
- OPVER="1.24.0"
12
+ OPVER="1.26.0"
13
13
 
14
14
  clearlyWarn DO_NOT_CLEAR
15
15
 
@@ -0,0 +1,201 @@
1
+ #!/bin/bash
2
+ #
3
+ # lifted from helmup.sh
4
+ #
5
+ function installCnpgOperatorEnvironment() {
6
+ # See => https://github.com/cloudnative-pg/charts
7
+
8
+ gcloud config set project $GCP_PROJECT_ID
9
+
10
+ # create an SA in the cnpg namespace for the operands to bind to
11
+ CNPG_NAMESPACE="cnpg-operands"
12
+ CNPG_SVC_ACCT="$CNPG_NAMESPACE-sa"
13
+ CNPG_SVC_EMAIL="$CNPG_SVC_ACCT@$GCP_PROJECT_ID.iam.gserviceaccount.com"
14
+
15
+ # We used to delete the SA when we were doing clean installs but that bit
16
+ # me in the ass the time I moved the operator dir out of the way to run
17
+ # helmwhat to populate with latest operator version. The result? The SA
18
+ # was deleted and recreated and the existing system lost the ability to
19
+ # write to GCS which resulted in WAL failures. The deletion / recreation
20
+ # logic was only useful in the early days of creating / deleting for
21
+ # initial development.
22
+ #
23
+ # Synopsis: deleting an SA from an actual non-test system is BAD NEWS
24
+ # and if it happens then you will need to rebind the SA to
25
+ # workload identity by hand.
26
+ #
27
+ # kubectl delete serviceaccounts -n $CNPG_NAMESPACE $CNPG_SVC_ACCT &> $DEVNULL
28
+ # gcloud --quiet iam service-accounts delete $CNPG_SVC_EMAIL --project $GCP_PROJECT_ID&> $DEVNULL
29
+ kubectl describe serviceaccounts -n $CNPG_NAMESPACE $CNPG_SVC_ACCT &> $DEVNULL
30
+ if [ $? -eq 0 ];
31
+ then
32
+ cat<<SKIP_CNPG_SA_CREATION
33
+
34
+ $YELO_WARN The CNPG SA $CNPG_SVC_ACCT already exists
35
+
36
+ Deleting the SA for the purposes of upgrading the operator is going to
37
+ wreck someone's day (probably yours) if the desire is to simply upgrade
38
+ in place. To force a clean reinstall, delete both the k8s and gcp SA for
39
+ CNPG and try again. (see comments in helmup for more info)
40
+
41
+ SKIP_CNPG_SA_CREATION
42
+ return
43
+ fi
44
+
45
+ # Create the operands namespace and annotate to allow redis access
46
+ createNamespaceIfNeeded $CNPG_NAMESPACE
47
+
48
+ # Create GCP SA and bind policies
49
+ printf "\nCreating the gcloud `color g $CNPG_SVC_ACCT` service account (SA)\n"
50
+ gcloud iam service-accounts create $CNPG_SVC_ACCT \
51
+ --project "$GCP_PROJECT_ID" \
52
+ --description "CNPG Operands SA" \
53
+ --display-name "CNPG Operands SA" &> $DEVNULL
54
+ warnOnError $? "the GCP SA `color y $CNPG_SVC_ACCT` may already exist"
55
+
56
+ CNPG_OPS_ROLE="cnpg.operands"
57
+ printf "\nCreating the `color g $CNPG_OPS_ROLE` IAM role\n"
58
+ ## Attach roles
59
+ ROLE_PERMISSIONS=(
60
+ iam.serviceAccounts.actAs
61
+ iam.serviceAccounts.get
62
+ iam.serviceAccounts.getAccessToken
63
+ iam.serviceAccounts.getOpenIdToken
64
+ iam.serviceAccounts.implicitDelegation
65
+ iam.serviceAccounts.list
66
+ iam.serviceAccounts.signBlob
67
+ iam.serviceAccounts.signJwt
68
+ resourcemanager.projects.get
69
+ storage.buckets.create
70
+ storage.buckets.get
71
+ storage.buckets.getIamPolicy
72
+ storage.buckets.list
73
+ storage.buckets.update
74
+ storage.objects.create
75
+ storage.objects.delete
76
+ storage.objects.get
77
+ storage.objects.getIamPolicy
78
+ storage.objects.list
79
+ )
80
+ gcloud iam roles create $CNPG_OPS_ROLE \
81
+ --project $GCP_PROJECT_ID \
82
+ --title "CNPG Operands" \
83
+ --description "CNPG Operands" \
84
+ --permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &> $DEVNULL
85
+ if [ $? -ne 0 ];
86
+ then
87
+ # assume error is that role exists so try updating instead
88
+ printf "\nUpdating the permissions on the `color g $CNPG_OPS_ROLE` IAM role\n"
89
+ gcloud iam roles update $CNPG_OPS_ROLE \
90
+ --project $GCP_PROJECT_ID \
91
+ --title "CNPG Operands" \
92
+ --permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &> $DEVNULL
93
+ fi
94
+ warnOnError $? "Failed to add roles to $CNPG_OPS_ROLE - perhaps they already exist?"
95
+
96
+ printf "\nBinding IAM role to the SA `color g $CNPG_SVC_EMAIL`\n"
97
+ gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
98
+ --member="serviceAccount:$CNPG_SVC_EMAIL" \
99
+ --role "roles/storage.admin" &> $DEVNULL
100
+ # --role projects/$GCP_PROJECT_ID/roles/$CNPG_OPS_ROLE &> $DEVNULL
101
+ # --role "roles/storage.admin" &> $DEVNULL
102
+ warnOnError $? "gcloud problem binding IAM policy"
103
+
104
+ printf "\nBinding IAM the Token Creator role to the SA `color g $CNPG_SVC_EMAIL`\n"
105
+ gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
106
+ --member="serviceAccount:$CNPG_SVC_EMAIL" \
107
+ --role="roles/iam.serviceAccountTokenCreator"
108
+
109
+ # workload binding will be performed by each cnpg operand on startup
110
+
111
+ BARMAN_BUCKET="gs://$GCP_PROJECT_ID-barman"
112
+ gsutil ls -p $GCP_PROJECT_ID -b $BARMAN_BUCKET &> $DEVNULL
113
+ if [ "$?" -eq 0 ];
114
+ then
115
+ printf "\nBarman bucket `color g "$BARMAN_BUCKET"` already exists - skipping recreation\n"
116
+ else
117
+ printf "\nCreating a bucket for barman backups: `color g $BARMAN_BUCKET`\n"
118
+ gsutil mb -l $GCE_REGION $BARMAN_BUCKET &> $DEVNULL
119
+ gsutil iam ch serviceAccount:$CNPG_SVC_EMAIL:objectAdmin $BARMAN_BUCKET
120
+ gsutil ubla set on $BARMAN_BUCKET # uniform bucket access
121
+ fi
122
+
123
+ # define the snapshot storage class
124
+ printf "\nApplying the CNPG VolumeSnapshotClass `color g cnpg-snapshotclass` definition\n"
125
+ cat<<EOSNAPSC | kubectl apply -f -
126
+ apiVersion: snapshot.storage.k8s.io/v1
127
+ kind: VolumeSnapshotClass
128
+ metadata:
129
+ name: cnpg-snapshotclass
130
+ driver: pd.csi.storage.gke.io
131
+ deletionPolicy: Retain
132
+ EOSNAPSC
133
+
134
+ sleep 2 # hold up processing for a moment to allow IAM mods to propagate
135
+ }
136
+
137
+ # this function is a little convoluted in the way it attempts to install the
138
+ # scripts and yaml necessary for the CNPG cleanup activities - the idea is to
139
+ # be able to update the scripts without touching anything else since the target
140
+ # directory is the cnpg-operator setup
141
+ function installCnpgCleanupCronjob() {
142
+ CNPG_OPERATOR_DIR="cnpg-operator"
143
+ if [ ! -d "$CNPG_OPERATOR_DIR" ];
144
+ then
145
+ cat<<CNPG_OPERATOR_MISSING
146
+ `color r "The cnpg-operator must be installed before proceeding"`
147
+
148
+ CNPG_OPERATOR_MISSING
149
+ exit 1
150
+ fi
151
+
152
+ # create the destination bucket for k8s cronjob scripts
153
+ BUCKET_SUFFIX="k8s-cronjobs"
154
+ makeUniformBucketWithCors $BUCKET_SUFFIX
155
+
156
+ CNPG_CLEANUP_CRONJOB_OVH="cnpg-cleanup-cronjob.yaml.ovh"
157
+ CNPG_CLEANUP_CRONJOB="$CNPG_OPERATOR_DIR/$CNPG_CLEANUP_CRONJOB_OVH"
158
+ CNPG_CLEANUP_SCRIPT_BASH="cnpg-cleanup-script.sh"
159
+ CNPG_CLEANUP_SCRIPT="$CNPG_OPERATOR_DIR/$CNPG_CLEANUP_SCRIPT_BASH"
160
+ if [ ! -f "$CNPG_CLEANUP_SCRIPT" ];
161
+ then
162
+ cat<<CNPG_FETCH_CLEANUP_CRONJOB_YAML
163
+ `color y "Missing $CNPG_CLEANUP_SCRIPT_BASH - updating local cron setup scripts"`
164
+
165
+ CNPG_FETCH_CLEANUP_CRONJOB_YAML
166
+ CNPG_OP_ROOT="$(build-tools --reporoot)/src/helm-charts/cnpg-operator"
167
+ cp $CNPG_OP_ROOT/$CNPG_CLEANUP_CRONJOB_OVH $CNPG_CLEANUP_CRONJOB
168
+ cp $CNPG_OP_ROOT/$CNPG_CLEANUP_SCRIPT_BASH $CNPG_CLEANUP_SCRIPT
169
+ fi
170
+
171
+ # copy / update the script in the bucket referenced in the cronjob
172
+ printf "\ngsutil cp $CNPG_CLEANUP_SCRIPT gs://$GCP_PROJECT_ID-$BUCKET_SUFFIX\n"
173
+ gsutil cp $CNPG_CLEANUP_SCRIPT gs://$GCP_PROJECT_ID-$BUCKET_SUFFIX
174
+
175
+ local CNPG_NAMESPACE="cnpg-operands"
176
+ local CNPG_CLEANUP_SA="cnpg-cleanup-sa"
177
+
178
+ gcloud iam service-accounts create "$CNPG_CLEANUP_SA" \
179
+ --project="$GCP_PROJECT_ID" \
180
+ --description="Used for cronjob cleanup with Workload Identity" \
181
+ --display-name="CNPG Cleanup SA" &> $DEVNULL
182
+ warnOnError $? "the GCP SA $CNPG_CLEANUP_SA may already exist"
183
+
184
+ gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
185
+ --project="$GCP_PROJECT_ID" \
186
+ --member="serviceAccount:$CNPG_CLEANUP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
187
+ --role="roles/storage.objectViewer"
188
+
189
+ bindWorkloadIdentity "$CNPG_CLEANUP_SA" "$CNPG_NAMESPACE"
190
+
191
+ CNPG_CLEANUP_CRONJOB_YAML="$CNPG_OPERATOR_DIR/$(basename $CNPG_CLEANUP_CRONJOB_OVH .ovh)"
192
+ overwhelm -g # allow ovh -> yaml to occur
193
+ cat<<CNPG_CLEANUP_CRONJOB_APPLY
194
+ `color g "Creating cronjob =>"``color y " kubectl apply -f $CNPG_CLEANUP_CRONJOB_YAML"`
195
+
196
+ CNPG_CLEANUP_CRONJOB_APPLY
197
+ kubectl apply -f $CNPG_CLEANUP_CRONJOB_YAML
198
+ }
199
+ # Run it!
200
+ installCnpgOperatorEnvironment
201
+ installCnpgCleanupCronjob
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # See => https://cloudnative-pg.io/documentation/current/installation_upgrade/
4
4
  #
5
- OPVER="1.26.0" # 05/23/2025
5
+ OPVER="1.26.1" # 07/29/2025
6
6
 
7
7
  createNamespaceIfNeeded cnpg-system
8
8
 
@@ -0,0 +1,41 @@
1
+ #!/bin/bash
2
+ #
3
+ # Lifted from helmup.sh
4
+ #
5
+ # This function is used to randomly generate the postgresql database passwords
6
+ # for the postgres and imagine users in a cnpg operator configuration. Since
7
+ # the resultant passwords will live in the cnpg-operands namespace they will
8
+ # be mirrored to the default namespace via the reflector service. Lastly, the
9
+ # service account will have workload identity bound to it in the cnpg-operands
10
+ # namespace.
11
+ function initializeCnpgOperand() {
12
+ local CNPG_SERVICE="$1"
13
+ local CNPG_NAMESPACE="cnpg-operands"
14
+ local CNPG_SVC_ACCT="$CNPG_NAMESPACE-sa"
15
+ local IMAGINE_PW_NAME="$CNPG_SERVICE-imagine-pw"
16
+ local POSTGRES_PW_NAME="$CNPG_SERVICE-postgres-pw"
17
+
18
+ # TODO: we use postgres root password for access - that is bad - fix it?
19
+ # printf "\nCreating imagine db password for `color g $CNPG_SERVICE`\n"
20
+ # kubectl create secret generic -n $CNPG_NAMESPACE "$IMAGINE_PW_NAME" \
21
+ # --from-literal=username="imagine" \
22
+ # --from-literal=password="$(generatePassword)" &> $DEVNULL
23
+ # warnOnError $? "the `color y $IMAGINE_PW_NAME` secret may already exist"
24
+
25
+ # # reflect the secret to default namespace
26
+ # reflectSecretIntoNamespaces $IMAGINE_PW_NAME $CNPG_NAMESPACE "default"
27
+
28
+ printf "\nCreating postgres db password for `color g $CNPG_SERVICE`\n"
29
+ kubectl create secret generic -n $CNPG_NAMESPACE "$POSTGRES_PW_NAME" \
30
+ --from-literal=username="postgres" \
31
+ --from-literal=password="$(generatePassword)" &> $DEVNULL
32
+ warnOnError $? "the `color y $POSTGRES_PW_NAME` secret may already exist"
33
+
34
+ # reflect the secret to default namespace
35
+ reflectSecretIntoNamespaces $POSTGRES_PW_NAME $CNPG_NAMESPACE "default"
36
+
37
+ printf "\nBinding `color g $CNPG_SERVICE` to the `color y "$CNPG_SVC_ACCT"` SA\n"
38
+ bindWorkloadIdentity $CNPG_SVC_ACCT $CNPG_NAMESPACE $CNPG_SERVICE
39
+ }
40
+ # Run It!
41
+ initializeCnpgOperand "$SERVICE" # $SERVICE from helmup.sh
@@ -8,7 +8,16 @@
8
8
  # for each of the 4 ES node types in the cluster. See prd-recovr-auto for an
9
9
  # example of a big beefy system.
10
10
  #
11
+ # Moves us away from bitnami hosted charts/images
12
+ #
13
+ image:
14
+ registry: us-docker.pkg.dev
15
+ repository: leverege-registry/bitnami-mirror/images/elasticsearch
16
+ # tag: 8.18.0
17
+
11
18
  global:
19
+ security:
20
+ allowInsecureImages: true
12
21
  storageClass: "ssd"
13
22
 
14
23
  fullnameOverride: "elasticsearch8"
@@ -8,7 +8,16 @@
8
8
  # for each of the 4 ES node types in the cluster. See prd-recovr-auto for an
9
9
  # example of a big beefy system.
10
10
  #
11
+ # Moves us away from bitnami hosted charts/images
12
+ #
13
+ image:
14
+ registry: us-docker.pkg.dev
15
+ repository: leverege-registry/bitnami-mirror/images/elasticsearch
16
+ # tag: 8.18.0
17
+
11
18
  global:
19
+ security:
20
+ allowInsecureImages: true
12
21
  storageClass: "ssd"
13
22
 
14
23
  fullnameOverride: "elasticsearch8"
@@ -2,11 +2,11 @@
2
2
  #
3
3
  showInstalling "Elastic Search 8"
4
4
 
5
+ OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/elasticsearch"
6
+
5
7
  # *** WARNING TO FUTURE SELF *** v22 of the chart is ES v9!!!
6
8
  [ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.6.3"
7
9
 
8
- OCI_CHART="oci://registry-1.docker.io/bitnamicharts/elasticsearch"
9
-
10
10
  LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-dev.yaml"
11
11
  #LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-prd.yaml"
12
12
  [ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
@@ -14,4 +14,4 @@ LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-dev.yaml"
14
14
  helm upgrade --install elasticsearch8 $OCI_CHART \
15
15
  --namespace elastic --create-namespace \
16
16
  --values $LOCAL_ES_VALUES \
17
- --version $ELASTIC_CHART_VERSION $HELM_WHAT
17
+ --version $ELASTIC_CHART_VERSION $HELM_WHAT
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ function setupPgbouncerSecret() {
4
+ # pgbouncer uses a k8s secret for the user access list which is in the form
5
+ # of => "user" "password" - this function will create the pgbouncer secret
6
+ # if it does not exist by pulling the password from the PG_PASSWORD secret
7
+ # managed by the Google Secret Manager service.
8
+ USERLIST_SECRET='pgbouncer-userlist-secret'
9
+ kubectl get secret $USERLIST_SECRET &> $DEVNULL
10
+ [[ $? -eq 0 ]] && return # already exists - bail
11
+
12
+ cat<<PGB_SECRET
13
+
14
+ `color y "Creatng $USERLIST_SECRET k8s secret from secret manager PG_PASSWORD secret..."`
15
+
16
+ PGB_SECRET
17
+ DECODED_PSQL_PASSWORD=$(gcloud secrets versions access latest --secret=PG_PASSWORD --project $GCP_PROJECT_ID)
18
+ exitOnError $? "Failed to fetch PG_PASSWORD from the secret manager"
19
+
20
+ kubectl create secret generic $USERLIST_SECRET --from-literal=userlist.txt="\"postgres\" \"$DECODED_PSQL_PASSWORD\""
21
+ exitOnError $? "Failed to create the $USERLIST_SECRET k8s secret"
22
+ }
23
+
24
+ setupPgbouncerSecret
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ ## Legacy PostgreSQL 11
2
+
3
+ This configuration was temporarily resurrected for supporting the bitnami
4
+ migrations. There are still quite a few legacy deployments using this
5
+ ancient psql approach. We use this config to point the servers at the Leverege
6
+ artifact registry for the mirrored bitnami images.
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo 'NO!'
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+ #
3
+ showInstalling "PostgreSQL Database (legacy)"
4
+
5
+ errorIfMissingSecret authz-postgres
6
+
7
+ OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/postgresql"
8
+
9
+ [ -z "$PSQL_CHART_VERSION" ] && PSQL_CHART_VERSION="10.16.2"
10
+
11
+ helm upgrade --install postgres $OCI_CHART \
12
+ --values postgres/postgres-local.yaml \
13
+ --version $PSQL_CHART_VERSION $HELM_WHAT
14
+
15
+ #
16
+ # legacy
17
+ #helm upgrade --install postgres bitnami/postgresql \
18
+ # --values postgres/postgres-local.yaml \
19
+ # --version 10 $HELM_WHAT
20
+ #
21
+ #removeHelmRepo bitnami
@@ -0,0 +1,51 @@
1
+ # Moves us away from bitnami hosted charts/images
2
+ #
3
+ image:
4
+ registry: us-docker.pkg.dev
5
+ repository: leverege-registry/bitnami-mirror/images/postgresql
6
+ # tag: 11.14.0-debian-10-r28
7
+
8
+ postgresqlExtendedConf:
9
+ maxWorkerProcesses: 4
10
+ maxParallelWorkers: 4
11
+ maxConnections: 500
12
+ shared_buffers: 1GB
13
+ effectiveCacheSize: 4GB
14
+ maintenanceWorkMem: 1GB
15
+ workMem: 10MB
16
+
17
+ persistence:
18
+ storageClass: "ssd"
19
+ # size: 16Gi # default 8Gi
20
+
21
+ resources:
22
+ requests:
23
+ memory: 1Gi
24
+ cpu: 750m
25
+
26
+ postgresqlDatabase: authz
27
+ existingSecret: authz-postgres
28
+
29
+ metrics:
30
+ enabled: true
31
+ image:
32
+ registry: us-docker.pkg.dev
33
+ repository: leverege-registry/bitnami-mirror/images/postgres-exporter
34
+ # tag: 0.10.0-debian-10-r172
35
+
36
+ master:
37
+ tolerations:
38
+ - key: "database"
39
+ operator: "Equal"
40
+ value: "true"
41
+ effect: "NoSchedule"
42
+
43
+ affinity:
44
+ nodeAffinity:
45
+ requiredDuringSchedulingIgnoredDuringExecution:
46
+ nodeSelectorTerms:
47
+ - matchExpressions:
48
+ - key: target-env
49
+ operator: In
50
+ values:
51
+ - database
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+
3
+ # This function came from the helmup.sh script and is used to install the
4
+ # stackdriver exporter in the prometheus or monitoring (legacy) namespace.
5
+ # This function only needs to execute once, at initial setup / configuration.
6
+ function installStackdriverExporterEnvironment() {
7
+ showInstalling "Stackdriver Exporter Service Account Binding"
8
+
9
+ # Add necessary helm repositories - note that stable is deprecated
10
+ addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
11
+
12
+ local SDEXP_NS=${1:-prometheus}
13
+ local SDEXP_SA="stackdriver-exporter"
14
+ local SDEXP_EM="$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
15
+
16
+ createNamespaceIfNeeded $SDEXP_NS
17
+
18
+ # guarantee any previous remnants of the exporter are gone
19
+ printf "\n*** Removing the previous $SDEXP_SA installation...\n"
20
+ helm uninstall -n $SDEXP_NS $SDEXP_SA &> $DEVNULL
21
+ kubectl delete serviceaccounts -n $SDEXP_NS $SDEXP_SA &> $DEVNULL
22
+ printf "!!! Skipping deletion of the gcloud SA $SDEXP_EM\n"
23
+ # gcloud --quiet iam service-accounts delete $SDEXP_EM &> $DEVNULL
24
+
25
+ # NOTE: The k8s SA != GCP SA - the former is created by the helm chart
26
+ # that installs the stackdriver-exporter, the latter is handled here in
27
+ # order to provide the proper IAM permissions to the exporter.
28
+
29
+ # Create GCP SA and bind policies
30
+ printf "\n*** Creating GCP SA with $SDEXP_NS/viewer ***\n"
31
+ gcloud iam service-accounts create $SDEXP_SA \
32
+ --project "$GCP_PROJECT_ID" \
33
+ --display-name "Prometheus Stackdriver Exporter" &> $DEVNULL
34
+ warnOnError $? "the GCP SA $SDEXP_SA may already exist"
35
+
36
+ printf "\n*** Binding IAM role of $SDEXP_NS viewer to $SDEXP_SA in $GCP_PROJECT_ID\n"
37
+ gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
38
+ --role "roles/monitoring.viewer" \
39
+ --member "serviceAccount:$SDEXP_EM" &> $DEVNULL
40
+ sleep 2 # give the IAM binding a chance to complete before moving on
41
+
42
+ bindWorkloadIdentity $SDEXP_SA $SDEXP_NS
43
+
44
+ removeHelmRepo prometheus-community
45
+ }
46
+
47
+ installStackdriverExporterEnvironment
@@ -31,8 +31,8 @@ spec:
31
31
  # VALUE = {{ $value }}
32
32
  # LABELS = {{ $labels }}
33
33
  - alert: TraefikHighHttp5xxErrorRateService
34
- expr: sum(rate(traefik_service_requests_total{code=~"5.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5
35
- for: 1m
34
+ expr: sum(rate(traefik_service_requests_total{code=~"5.*"}[5m])) by (service) / sum(rate(traefik_service_requests_total[5m])) by (service) * 100 > 5
35
+ for: 5m # awesome was => 1m
36
36
  labels:
37
37
  severity: critical
38
38
  annotations:
@@ -34,7 +34,8 @@ stackdriver:
34
34
  serviceMonitor:
35
35
  enabled: true
36
36
  namespace: prometheus
37
- interval: "30s"
37
+ interval: "60s" # Align with Stackdriver's 60s data resolution
38
+ # honorTimestamps: false # Avoid duplicate timestamp conflicts (eliminates dup timestamps?)
38
39
  relabelings:
39
40
  # Legacy labelmap used to preserve compatibility with pre-operator Grafana dashboards
40
41
  # Can be removed once legacy Prometheus stack is deprecated
@@ -2,10 +2,10 @@
2
2
 
3
3
  showInstalling "Redis"
4
4
 
5
- OCI_CHART="oci://registry-1.docker.io/bitnamicharts/redis"
5
+ OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/redis"
6
6
 
7
7
  [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.13.4"
8
8
 
9
- helm upgrade --install redis $OCI_CHART \
9
+ helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/values-local.yaml \
11
11
  --version $REDIS_CHART_VERSION $HELM_WHAT
@@ -1,4 +1,14 @@
1
+ #
2
+ # Moves us away from bitnami hosted charts/images
3
+ #
4
+ image:
5
+ registry: us-docker.pkg.dev
6
+ repository: leverege-registry/bitnami-mirror/images/redis
7
+ # tag: 7.4.3-debian-12-r0
8
+
1
9
  global:
10
+ security: # this allows us to use local images
11
+ allowInsecureImages: true
2
12
  storageClass: ssd
3
13
 
4
14
  auth:
@@ -70,6 +80,10 @@ networkPolicy:
70
80
 
71
81
  metrics:
72
82
  enabled: true
83
+ image:
84
+ registry: us-docker.pkg.dev
85
+ repository: leverege-registry/bitnami-mirror/images/redis-exporter
86
+ # tag: 1.74.0-debian-12-r2
73
87
  serviceMonitor:
74
88
  enabled: true # set to true for prometheus operator
75
89
  namespace: "prometheus"
@@ -17,7 +17,7 @@ TRAEFIK_NAMESPACE="traefik"
17
17
 
18
18
  addHelmRepo traefik https://helm.traefik.io/traefik
19
19
 
20
- [ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="36"
20
+ [ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="37"
21
21
  helm upgrade --install traefik traefik/traefik \
22
22
  --namespace $TRAEFIK_NAMESPACE --create-namespace \
23
23
  --values traefik/values.yaml \
@@ -28,7 +28,7 @@ resources:
28
28
  metrics:
29
29
  prometheus:
30
30
  serviceMonitor:
31
- enabled: true
31
+ enabled: false # initially disabled until prometheus operator is installed
32
32
  interval: 30s
33
33
  namespace: prometheus
34
34
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  showInstalling "Valkey"
4
4
 
5
- OCI_CHART="oci://registry-1.docker.io/bitnamicharts/valkey"
5
+ OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/valkey"
6
6
 
7
- [ -z "$VALKEY_CHART_VERSION" ] && VALKEY_CHART_VERSION="2.2.4"
7
+ [ -z "$VALKEY_CHART_VERSION" ] && VALKEY_CHART_VERSION="3.0.22"
8
8
 
9
- helm upgrade --install valkey $OCI_CHART \
9
+ helm upgrade --install valkey $OCI_CHART \
10
10
  --values valkey/valkey-local.yaml \
11
11
  --version $VALKEY_CHART_VERSION $HELM_WHAT
@@ -1,5 +1,11 @@
1
+ image:
2
+ registry: us-docker.pkg.dev
3
+ repository: leverege-registry/bitnami-mirror/images/valkey
4
+ # tag: 8.1.3-devian-12-r1
1
5
 
2
6
  global:
7
+ security:
8
+ allowInsecureImages: true
3
9
  storageClass: "ssd"
4
10
 
5
11
  architecture: replication
@@ -11,7 +17,7 @@ auth:
11
17
  primary:
12
18
  replicaCount: 1
13
19
 
14
- resourcesPreset: "nano"
20
+ resourcesPreset: "small"
15
21
  resources:
16
22
  requests:
17
23
  cpu: 250m
@@ -77,6 +83,10 @@ sentinel:
77
83
 
78
84
  metrics:
79
85
  enabled: true
86
+ image:
87
+ registry: us-docker.pkg.dev
88
+ repository: leverege-registry/bitnami-mirror/images/redis-exporter
89
+ # tag: 1.74.0-debian-12-r2
80
90
  serviceMonitor:
81
91
  enabled: true
82
92
  namespace: "prometheus"