@leverege/build-tools 2.69.0 β 2.69.2
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/.vscode/build-tools.code-workspace +8 -0
- package/package.json +2 -2
- package/src/docker-to-registry.mjs +6 -2
- package/src/helm-audit.mjs +6 -0
- package/src/helm-charts/geotile-server/values-local.yaml +5 -0
- package/src/helm-charts/prom-operator/README-GPU.md +42 -0
- package/src/helm-charts/prom-operator/gpu-hpa-metrics.sh +12 -0
- package/src/helm-charts/prom-operator/helmup.plugin +1 -12
- package/src/helm-charts/prom-operator/rules/cnpg-rules.yaml +2 -2
- package/src/helm-charts/prom-operator/rules/elasticsearch-rules.yaml +8 -1
- package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +4 -4
- package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +2 -2
- package/src/helm-charts/resource-server/values-local.yaml +1 -1
- package/src/helmup.sh +1 -1
- package/.vscode/settings.json +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.69.
|
|
3
|
+
"version": "2.69.2",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"shell-quote": "^1.8.3",
|
|
87
87
|
"simple-git": "^3.28.0",
|
|
88
88
|
"toml": "^3.0.0",
|
|
89
|
-
"zx": "^8.
|
|
89
|
+
"zx": "^8.7.1"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@leverege/eslint-config-leverege": "^5.0.1",
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
getGitBranchAndUpstream,
|
|
15
15
|
gitRepoIsDirty,
|
|
16
16
|
proceed,
|
|
17
|
-
shellCmd
|
|
17
|
+
shellCmd,
|
|
18
|
+
warning,
|
|
19
|
+
} from './Utils.mjs'
|
|
18
20
|
|
|
19
21
|
import docker from './Docker.mjs'
|
|
20
22
|
|
|
@@ -91,7 +93,9 @@ const repoDescr = await analyzeRepository( giveGuidance )
|
|
|
91
93
|
debug( { repoDescr }, '<==The Repo Description' )
|
|
92
94
|
|
|
93
95
|
if ( semver.lt( semver.coerce( repoDescr.buildToolsVersion ), minimumBuildToolsVersion ) ) {
|
|
94
|
-
|
|
96
|
+
const warningPrefix = repoDescr.isNodeJsProject ? 'check the package.json devDependencies - ' : ''
|
|
97
|
+
warning( `${warningPrefix}@leverege/build-tools recommended minimum version is ^${minimumBuildToolsVersion}\n` )
|
|
98
|
+
await proceed()
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
const {
|
package/src/helm-audit.mjs
CHANGED
|
@@ -12,6 +12,12 @@ const spinner = ora( 'Gathering Helm release info...' ).start()
|
|
|
12
12
|
const limit = pLimit( 5 ) // limit concurrent shellCmds to avoid API overload
|
|
13
13
|
const OMIT_NAMESPACES = new Set( [ 'estafette' ] )
|
|
14
14
|
|
|
15
|
+
process.on( 'SIGINT', () => {
|
|
16
|
+
// catch ctrl^C in order to reset terminal back to normal
|
|
17
|
+
spinner.stop()
|
|
18
|
+
process.exit( 1 )
|
|
19
|
+
} )
|
|
20
|
+
|
|
15
21
|
async function getHelmReleases() {
|
|
16
22
|
const json = await shellCmd( 'helm list -A -o json' )
|
|
17
23
|
return JSON.parse( json ).filter( r => !OMIT_NAMESPACES.has( r.namespace ) )
|
|
@@ -6,5 +6,10 @@ config:
|
|
|
6
6
|
UPLOADER_PROJECT_ID: "${PROJECT_ID}"
|
|
7
7
|
UPLOADER_BUCKET: "${PROJECT_ID}-geotile-server"
|
|
8
8
|
|
|
9
|
+
# CNPG override
|
|
10
|
+
SQL_HOST: "cnpg-db-psql-stack-rw.cnpg-operands" # vs postgres-postgresql
|
|
11
|
+
SQL_PASSWORD_SECRET: "cnpg-db-psql-stack-postgres-pw"
|
|
12
|
+
SQL_PASSWORD_KEY: "password"
|
|
13
|
+
|
|
9
14
|
serviceMonitor:
|
|
10
15
|
enabled: true
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# π Optional Prometheus Custom Metrics
|
|
2
|
+
|
|
3
|
+
## π― Why we do this
|
|
4
|
+
We maintain a **single, consistent Prometheus baseline** for all clusters. Certain metrics β like GPU duty cycle percent or other node-type-specific stats β **do not exist in every cluster**. If we deploy scrape configs or custom adapter rules for optional metrics globally, we risk:
|
|
5
|
+
|
|
6
|
+
- Empty series queries β scrape flapping.
|
|
7
|
+
- Duplicate or rejected samples.
|
|
8
|
+
- Confusing "phantom target down" or noisy alerts.
|
|
9
|
+
|
|
10
|
+
## β
How we solve it
|
|
11
|
+
- **Baseline:**
|
|
12
|
+
Our base `prom-operator` Helm chart and Prometheus Adapter configs **do not contain cluster-specific custom metrics** by default.
|
|
13
|
+
- running _helmup prom-operator_ will deploy prometheus with the standard exporters
|
|
14
|
+
|
|
15
|
+
- **Specialized nodes:**
|
|
16
|
+
When clusters require optional metrics (e.g., GPU nodes, special sensors, vendor-specific exporters), we deploy those configs with a separate, explicit step:
|
|
17
|
+
- post helmup run _./prom-operator/gpu-hpa-metrics.sh_ to apply the prometheus-adapter.yaml which contains the GPU scraper
|
|
18
|
+
|
|
19
|
+
## π Benefits
|
|
20
|
+
- Zero config drift: our core charts stay generic and versioned.
|
|
21
|
+
- No surprise scrape issues or prometheus TSDB rejects in clusters that donβt expose those metrics.
|
|
22
|
+
- Clusters only carry the scrape configs they can actually fulfill.
|
|
23
|
+
|
|
24
|
+
## π οΈ Operational tips
|
|
25
|
+
- **Add custom metrics only when a clusterβs node pool truly provides them.**
|
|
26
|
+
- Keep custom metric configs organized in a clear, dedicated folder (`gpu-adapter-values.yaml`, `gpu-metrics.yaml`, etc.)
|
|
27
|
+
- When adding new clusters, verify whether specialized nodes are present and apply the custom metrics if needed.
|
|
28
|
+
- When GPU adoption grows, we can promote the configs to the baseline and gate them behind a `gpuEnabled` flag.
|
|
29
|
+
|
|
30
|
+
## βοΈ Example
|
|
31
|
+
> Our `gpu_duty_cycle_percent` metric is installed *only* on clusters with GPU node pools.
|
|
32
|
+
> This is done by running:
|
|
33
|
+
>
|
|
34
|
+
> ```bash
|
|
35
|
+
> ./prom-operator/gpu-hpa-metrics.sh
|
|
36
|
+
> ```
|
|
37
|
+
> or directly with helm:
|
|
38
|
+
> ```bash
|
|
39
|
+
> helm upgrade prometheus-adapter -f gpu-adapter-values.yaml
|
|
40
|
+
> ```
|
|
41
|
+
>
|
|
42
|
+
> after the base Prometheus stack is installed.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-adapter
|
|
4
|
+
showInstalling "The Prometheus Adapter (prom-operator custom HPA metrics)"
|
|
5
|
+
[ -z "$PROMETHEUS_ADAPTER_CHART_VERSION" ] && PROMETHEUS_ADAPTER_CHART_VERSION="4"
|
|
6
|
+
helm upgrade $NS --install prometheus-adapter prometheus-community/prometheus-adapter \
|
|
7
|
+
--values prom-operator/prometheus-adapter.yaml \
|
|
8
|
+
--version $PROMETHEUS_ADAPTER_CHART_VERSION $HELM_WHAT
|
|
9
|
+
|
|
10
|
+
# finally, apply the PrometheusRule to generate the GPU duty cycle metric
|
|
11
|
+
showInstalling "The Prometheus Rule (custom GPU metrics rule)"
|
|
12
|
+
kubectl apply -n prometheus -f prom-operator/stackdriver-exporter-gpu-rules.yaml
|
|
@@ -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="
|
|
9
|
+
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="75"
|
|
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 \
|
|
@@ -27,15 +27,4 @@ helm upgrade $NS --install stackdriver-exporter prometheus-community/prometheus-
|
|
|
27
27
|
--values prom-operator/stackdriver-exporter.yaml \
|
|
28
28
|
--version $STACKDRIVER_EXPORTER_CHART_VERSION $HELM_WHAT
|
|
29
29
|
|
|
30
|
-
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-adapter
|
|
31
|
-
showInstalling "The Prometheus Adapter (prom-operator custom HPA metrics)"
|
|
32
|
-
[ -z "$PROMETHEUS_ADAPTER_CHART_VERSION" ] && PROMETHEUS_ADAPTER_CHART_VERSION="4"
|
|
33
|
-
helm upgrade $NS --install prometheus-adapter prometheus-community/prometheus-adapter \
|
|
34
|
-
--values prom-operator/prometheus-adapter.yaml \
|
|
35
|
-
--version $PROMETHEUS_ADAPTER_CHART_VERSION $HELM_WHAT
|
|
36
|
-
|
|
37
|
-
# finally, apply the PrometheusRule to generate the GPU duty cycle metric
|
|
38
|
-
showInstalling "The Prometheus Rule (custom GPU metrics rule)"
|
|
39
|
-
kubectl apply -n prometheus -f prom-operator/stackdriver-exporter-gpu-rules.yaml
|
|
40
|
-
|
|
41
30
|
removeHelmRepo prometheus-community
|
|
@@ -101,8 +101,8 @@ spec:
|
|
|
101
101
|
description: "Postgresql restarted\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
102
102
|
|
|
103
103
|
- alert: PostgresqlHighRollbackRate
|
|
104
|
-
expr: sum by (namespace,datname) ((rate(cnpg_pg_stat_database_xact_rollback{datname!~"template.*|postgres",datid!="0"}[
|
|
105
|
-
for:
|
|
104
|
+
expr: sum by (namespace,datname) ((rate(cnpg_pg_stat_database_xact_rollback{datname!~"template.*|postgres",datid!="0"}[5m])) / ((rate(cnpg_pg_stat_database_xact_rollback{datname!~"template.*|postgres",datid!="0"}[5m])) + (rate(cnpg_pg_stat_database_xact_commit{datname!~"template.*|postgres",datid!="0"}[5m])))) > 0.04
|
|
105
|
+
for: 5m
|
|
106
106
|
labels:
|
|
107
107
|
severity: warning
|
|
108
108
|
annotations:
|
|
@@ -174,7 +174,14 @@ spec:
|
|
|
174
174
|
# VALUE = {{ $value }}
|
|
175
175
|
# LABELS = {{ $labels }}
|
|
176
176
|
- alert: ElasticsearchHighIndexingLatency
|
|
177
|
-
expr:
|
|
177
|
+
expr: | # ChatGPT rewrite of awesome rule due to noise
|
|
178
|
+
(
|
|
179
|
+
rate(elasticsearch_indices_indexing_index_time_seconds_total[5m])
|
|
180
|
+
/
|
|
181
|
+
rate(elasticsearch_indices_indexing_index_total[5m])
|
|
182
|
+
) > 0.02
|
|
183
|
+
and
|
|
184
|
+
rate(elasticsearch_indices_indexing_index_total[5m]) > 0.5
|
|
178
185
|
for: 10m
|
|
179
186
|
labels:
|
|
180
187
|
severity: warning
|
|
@@ -165,7 +165,7 @@ spec:
|
|
|
165
165
|
LABELS = {{ $labels }}
|
|
166
166
|
- alert: KubernetesHpaScaleInability
|
|
167
167
|
expr: (kube_horizontalpodautoscaler_spec_max_replicas - kube_horizontalpodautoscaler_status_desired_replicas) * on (horizontalpodautoscaler,namespace) (kube_horizontalpodautoscaler_status_condition{condition="ScalingLimited", status="true"} == 1) == 0
|
|
168
|
-
for: 2m
|
|
168
|
+
for: 5m # awesome was => 2m
|
|
169
169
|
labels:
|
|
170
170
|
severity: warning
|
|
171
171
|
annotations:
|
|
@@ -176,7 +176,7 @@ spec:
|
|
|
176
176
|
# LABELS = {{ $labels }}
|
|
177
177
|
- alert: KubernetesHpaMetricsUnavailability
|
|
178
178
|
expr: kube_horizontalpodautoscaler_status_condition{status="false", condition="ScalingActive"} == 1
|
|
179
|
-
for:
|
|
179
|
+
for: 5m # awesome was => 0m
|
|
180
180
|
labels:
|
|
181
181
|
severity: warning
|
|
182
182
|
annotations:
|
|
@@ -240,7 +240,7 @@ spec:
|
|
|
240
240
|
LABELS = {{ $labels }}
|
|
241
241
|
- alert: KubernetesDeploymentReplicasMismatch
|
|
242
242
|
expr: kube_deployment_spec_replicas != kube_deployment_status_replicas_available
|
|
243
|
-
for: 10m
|
|
243
|
+
for: 20m # awesome was => 10m
|
|
244
244
|
labels:
|
|
245
245
|
severity: warning
|
|
246
246
|
annotations:
|
|
@@ -251,7 +251,7 @@ spec:
|
|
|
251
251
|
LABELS = {{ $labels }}
|
|
252
252
|
- alert: KubernetesStatefulsetReplicasMismatch
|
|
253
253
|
expr: kube_statefulset_status_replicas_ready != kube_statefulset_status_replicas
|
|
254
|
-
for: 10m
|
|
254
|
+
for: 20m # awesome was => 10m
|
|
255
255
|
labels:
|
|
256
256
|
severity: warning
|
|
257
257
|
annotations:
|
|
@@ -218,8 +218,8 @@ spec:
|
|
|
218
218
|
VALUE = {{ $value }}
|
|
219
219
|
LABELS = {{ $labels }}
|
|
220
220
|
- alert: PrometheusTargetScrapeDuplicate
|
|
221
|
-
expr: increase(prometheus_target_scrapes_sample_duplicate_timestamp_total[5m]) >
|
|
222
|
-
for: 0m
|
|
221
|
+
expr: increase(prometheus_target_scrapes_sample_duplicate_timestamp_total[5m]) > 5
|
|
222
|
+
for: 5m # awesome was => 0m
|
|
223
223
|
labels:
|
|
224
224
|
severity: warning
|
|
225
225
|
annotations:
|
package/src/helmup.sh
CHANGED
|
@@ -50,7 +50,6 @@ AUXILIARY=(
|
|
|
50
50
|
|
|
51
51
|
# zombie-killer re-enabled 20240801
|
|
52
52
|
SYSTEM=(
|
|
53
|
-
prom-operator
|
|
54
53
|
elasticsearch8
|
|
55
54
|
redis
|
|
56
55
|
cnpg-operator
|
|
@@ -62,6 +61,7 @@ SYSTEM=(
|
|
|
62
61
|
velero
|
|
63
62
|
cnpg-db-psql-stack
|
|
64
63
|
cnpg-db-tsdb-basic
|
|
64
|
+
prom-operator
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
SYSTEM_LEGACY=(
|
package/.vscode/settings.json
DELETED