@leverege/build-tools 2.113.1 β 2.113.3
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 +4 -4
- package/src/Utils.mjs +4 -1
- package/src/helm-charts/cnpg-operator/helmup.plugin +2 -0
- package/src/helm-charts/prom-operator/README-HPA.md +46 -0
- package/src/helm-charts/prom-operator/{gpu-hpa-metrics.sh β hpa-metrics.sh} +10 -2
- package/src/helm-charts/prom-operator/prometheus-adapter.yaml +12 -0
- package/src/helm-charts/prom-operator/rules/cnpg-rules.yaml +1 -1
- package/src/helm-charts/velero/helmup.plugin +1 -1
- package/src/helmup.sh +3 -0
- package/src/hook-and-release/Config.mjs +3 -1
- package/src/init-my-chart/Chart.yaml.hbs +1 -1
- package/src/init-my-chart/values.yaml.hbs +0 -1
- package/src/push-my-chart.mjs +2 -0
- package/src/refresh-npm-token.mjs +13 -0
- package/src/helm-charts/prom-operator/README-GPU.md +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.113.
|
|
3
|
+
"version": "2.113.3",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -97,18 +97,18 @@
|
|
|
97
97
|
"glob": "^13.0.6",
|
|
98
98
|
"googleapis": "^173.0.0",
|
|
99
99
|
"handlebars": "^4.7.9",
|
|
100
|
-
"ignore": "^7.0.
|
|
100
|
+
"ignore": "^7.0.6",
|
|
101
101
|
"inquirer": "^14.0.2",
|
|
102
102
|
"js-yaml": "^4.2.0",
|
|
103
103
|
"jsdoc": "^4.0.5",
|
|
104
104
|
"ms": "^2.1.3",
|
|
105
105
|
"npm-registry-fetch": "^20.0.1",
|
|
106
106
|
"ora": "^9.4.1",
|
|
107
|
-
"p-limit": "^7.3.
|
|
107
|
+
"p-limit": "^7.3.1",
|
|
108
108
|
"package-up": "^5.0.0",
|
|
109
109
|
"readline-sync": "^1.4.10",
|
|
110
110
|
"semver": "^7.8.5",
|
|
111
|
-
"shell-quote": "^1.
|
|
111
|
+
"shell-quote": "^1.10.0",
|
|
112
112
|
"simple-git": "^3.36.0",
|
|
113
113
|
"sloc": "^0.3.2",
|
|
114
114
|
"superstruct": "^2.0.2",
|
package/src/Utils.mjs
CHANGED
|
@@ -599,9 +599,12 @@ export const parseHelmChart = async ( helmroot = './helm' ) => {
|
|
|
599
599
|
|
|
600
600
|
depsOutOfSync = mismatches.length > 0
|
|
601
601
|
|
|
602
|
-
//
|
|
602
|
+
// Check if the helm/charts dir is missing or tarballs don't match locked versions
|
|
603
603
|
if ( hasDependencies && !chartFiles.includes( 'charts' ) ) {
|
|
604
604
|
depsOutOfSync = true
|
|
605
|
+
} else if ( !depsOutOfSync ) {
|
|
606
|
+
const lockedTarballs = chartLock.dependencies.map( d => `charts/${d.name}-${d.version}.tgz` )
|
|
607
|
+
depsOutOfSync = lockedTarballs.some( t => !chartFiles.includes( t ) )
|
|
605
608
|
}
|
|
606
609
|
}
|
|
607
610
|
/* eslint-enable security/detect-non-literal-fs-filename */
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
OPVER="1.26.1" # 10/08/2025
|
|
6
6
|
BARMAN_VER="0.11.0"
|
|
7
7
|
|
|
8
|
+
createNamespaceIfNeeded cnpg-system
|
|
9
|
+
|
|
8
10
|
# --- CNPG operator ---
|
|
9
11
|
kubectl apply --server-side -f \
|
|
10
12
|
"https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-${OPVER%.*}/releases/cnpg-${OPVER}.yaml" \
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# π Optional HPA 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 PubSub subscription backlog β **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 clusters:**
|
|
16
|
+
When clusters require optional HPA metrics (e.g., GPU nodes, PubSub-based scaling), we deploy those configs with a separate, explicit step:
|
|
17
|
+
- post helmup run _./prom-operator/hpa-metrics.sh_ to apply the prometheus-adapter.yaml and any cluster-specific PrometheusRules
|
|
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 truly provides them.**
|
|
26
|
+
- Keep custom metric configs organized in a clear, dedicated folder alongside `hpa-metrics.sh`.
|
|
27
|
+
- When adding new clusters, verify whether specialized metrics are needed and apply them if so.
|
|
28
|
+
- When a metric type becomes universal, promote it to the baseline and gate it behind a feature flag.
|
|
29
|
+
|
|
30
|
+
## βοΈ Metric types
|
|
31
|
+
|
|
32
|
+
**Custom metrics** (`custom.metrics.k8s.io`) β metrics tied to a Kubernetes object (pod, namespace).
|
|
33
|
+
Used with `type: Pods` or `type: Object` in HPA specs. Example: `gpu_duty_cycle_percent`.
|
|
34
|
+
|
|
35
|
+
**External metrics** (`external.metrics.k8s.io`) β metrics from outside Kubernetes (GCP, cloud services).
|
|
36
|
+
Used with `type: External` in HPA specs. Example: PubSub subscription backlog.
|
|
37
|
+
|
|
38
|
+
## βοΈ Example
|
|
39
|
+
> Optional HPA metrics are installed by running:
|
|
40
|
+
>
|
|
41
|
+
> ```bash
|
|
42
|
+
> ./prom-operator/hpa-metrics.sh
|
|
43
|
+
> ```
|
|
44
|
+
>
|
|
45
|
+
> after the base Prometheus stack is installed. Cluster-specific rules (e.g., PubSub
|
|
46
|
+
> subscription IDs) are added to `prometheus-adapter.yaml` in the clusterβs branch.
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
# When sourced by helmup these are already set; provide standalone defaults.
|
|
6
|
+
NS="${NS:---namespace prometheus}"
|
|
7
|
+
HELM_WHAT="${HELM_WHAT:-}"
|
|
8
|
+
command -v showInstalling >/dev/null 2>&1 || showInstalling() { echo "==> Installing: $*"; }
|
|
9
|
+
|
|
3
10
|
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-adapter
|
|
4
11
|
showInstalling "The Prometheus Adapter (prom-operator custom HPA metrics)"
|
|
5
|
-
[ -z "$PROMETHEUS_ADAPTER_CHART_VERSION" ] && PROMETHEUS_ADAPTER_CHART_VERSION="
|
|
6
|
-
|
|
12
|
+
[ -z "${PROMETHEUS_ADAPTER_CHART_VERSION:-}" ] && PROMETHEUS_ADAPTER_CHART_VERSION="5.3.0"
|
|
13
|
+
OCI_CHART="oci://ghcr.io/prometheus-community/charts/prometheus-adapter"
|
|
14
|
+
helm upgrade $NS --install prometheus-adapter $OCI_CHART \
|
|
7
15
|
--values prom-operator/prometheus-adapter.yaml \
|
|
8
16
|
--version $PROMETHEUS_ADAPTER_CHART_VERSION $HELM_WHAT
|
|
9
17
|
|
|
@@ -4,7 +4,19 @@ prometheus:
|
|
|
4
4
|
url: "http://prometheus-operated.prometheus.svc"
|
|
5
5
|
port: 9090
|
|
6
6
|
|
|
7
|
+
# Stackdriver-exporter samples carry Cloud Monitoring's delayed timestamps
|
|
8
|
+
# (80-200s behind wall clock). With the chart default of 1m the series
|
|
9
|
+
# fall outside the discovery window intermittently, leaving the external
|
|
10
|
+
# metrics registry empty. 10m covers the lag with margin.
|
|
11
|
+
metricsRelistInterval: 10m
|
|
12
|
+
|
|
7
13
|
rules:
|
|
14
|
+
# The chart's upstream default rule set matches ~100k+ series on a
|
|
15
|
+
# Prometheus loaded with stackdriver metrics. The 1m relist crawling
|
|
16
|
+
# that index wedges the adapter registry (empty listings, handler
|
|
17
|
+
# timeouts, high idle CPU). Nothing here consumes those custom metrics β
|
|
18
|
+
# resource HPAs use metrics-server. Only the explicit rules below are served.
|
|
19
|
+
default: false
|
|
8
20
|
custom:
|
|
9
21
|
- seriesQuery: 'gpu_duty_cycle_percent{namespace!="",pod!=""}'
|
|
10
22
|
resources:
|
|
@@ -117,7 +117,7 @@ spec:
|
|
|
117
117
|
# severity: critical
|
|
118
118
|
# annotations:
|
|
119
119
|
# summary: Postgresql commit rate low (instance {{ $labels.instance }})
|
|
120
|
-
# description: "Postgresql seems to be processing very few transactions\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
120
|
+
# description: "Postgresql seems to be processing very few transactions\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
121
121
|
# expr: rate(cnpg_pg_stat_database_xact_commit[1m]) < 10
|
|
122
122
|
# for: 2m
|
|
123
123
|
# labels:
|
|
@@ -6,7 +6,7 @@ showInstalling "Velero Backup System"
|
|
|
6
6
|
# the version of the locally installed velero client application.
|
|
7
7
|
#
|
|
8
8
|
VELERO_CHART_VERSION="12.0.3"
|
|
9
|
-
EXPECTED_CLIENT_VERSION="v1.18.
|
|
9
|
+
EXPECTED_CLIENT_VERSION="v1.18.2"
|
|
10
10
|
|
|
11
11
|
addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
12
12
|
|
package/src/helmup.sh
CHANGED
|
@@ -235,7 +235,9 @@ export default class Config {
|
|
|
235
235
|
fs.writeFileSync( `${harDir}/config.json`, JSON.stringify( CONFIG_CONTENT, null, 2 ), 'utf8' )
|
|
236
236
|
|
|
237
237
|
const makeHarHookScript = async ( harScript ) => {
|
|
238
|
-
const SCRIPT_CONTENT =
|
|
238
|
+
const SCRIPT_CONTENT = `#!/bin/sh
|
|
239
|
+
PATH="$(git rev-parse --show-toplevel)/node_modules/.bin:$PATH"
|
|
240
|
+
hook-and-release`
|
|
239
241
|
|
|
240
242
|
fs.writeFileSync( harScript, SCRIPT_CONTENT, 'utf8' )
|
|
241
243
|
fs.chmodSync( harScript, 0o750 )
|
|
@@ -39,7 +39,6 @@ partOf: {{hbsPartOf}} # leverege-stack or project-x - OPTIONAL
|
|
|
39
39
|
# name, http + metrics) and a companion <fullname>-loadbalancer service is rendered
|
|
40
40
|
# to handle external traffic (http only, no metrics exposure).
|
|
41
41
|
service:
|
|
42
|
-
project_id: set-in-values-yaml
|
|
43
42
|
preemptible: {{hbsServicePreemptible}} # true or false - OPTIONAL
|
|
44
43
|
type: ClusterIP
|
|
45
44
|
|
package/src/push-my-chart.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { Command } from 'commander'
|
|
|
6
6
|
import {
|
|
7
7
|
debug,
|
|
8
8
|
errorExit,
|
|
9
|
+
establishOauthAccess,
|
|
9
10
|
log,
|
|
10
11
|
parseHelmChart,
|
|
11
12
|
proceed,
|
|
@@ -47,6 +48,7 @@ if ( !chartAppVersion.startsWith( 'v' ) ) {
|
|
|
47
48
|
if ( depsOutOfSync || opts.refreshDeps ) {
|
|
48
49
|
try {
|
|
49
50
|
log( chalk.yellow.bold( '\nChart dependedencies are out of sync - updating...\n' ) )
|
|
51
|
+
await establishOauthAccess()
|
|
50
52
|
await shellCmd( 'helm dependency update ./helm', { stdio : 'inherit' } )
|
|
51
53
|
} catch ( error ) {
|
|
52
54
|
errorExit( error )
|
|
@@ -75,6 +75,19 @@ ${chalk.bold( 'Secret Manager Secrets (required)' )}
|
|
|
75
75
|
${chalk.bold( 'Environment Variables (optional)' )}
|
|
76
76
|
|
|
77
77
|
${chalk.bold( 'REFRESH_NPM_PROJECT' )} ${chalk.green( 'may be used in lieu of --project' )}
|
|
78
|
+
|
|
79
|
+
${chalk.bold( 'Manually Bootstraping the Token' )}
|
|
80
|
+
${chalk.green( `
|
|
81
|
+
There may be times when a token is expired, lost or a new developer needs
|
|
82
|
+
to seed their ~/.npmrc file for the first time. Help a brother out and let
|
|
83
|
+
them know to run this command to fetch the current npmrc file:
|
|
84
|
+
|
|
85
|
+
gcloud secrets versions access latest \\
|
|
86
|
+
--secret=REFRESH_NPM_NPMRC \\
|
|
87
|
+
--project=leverege-registry > ~/.npmrc
|
|
88
|
+
|
|
89
|
+
Note, ^^that command will need a different --project name for non-leverege
|
|
90
|
+
developers.` )}
|
|
78
91
|
` )
|
|
79
92
|
.parse()
|
|
80
93
|
|
|
@@ -1,42 +0,0 @@
|
|
|
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.
|