@leverege/build-tools 2.43.9 → 2.43.11
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/bash-funcs +38 -0
- package/src/helm-charts/prometheus/values-local.yaml +7 -7
- package/src/helmdn.sh +6 -8
- package/src/helmup.sh +9 -29
- package/src/refresh-npm-token.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.43.
|
|
3
|
+
"version": "2.43.11",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"ms": "^2.1.3",
|
|
65
65
|
"npm-registry-fetch": "^16.1.0",
|
|
66
66
|
"parse-gitignore": "^2.0.0",
|
|
67
|
-
"read-pkg": "^9.0.
|
|
67
|
+
"read-pkg": "^9.0.1",
|
|
68
68
|
"readline-sync": "^1.4.10",
|
|
69
69
|
"semver": "^7.5.4",
|
|
70
|
-
"simple-git": "^3.
|
|
70
|
+
"simple-git": "^3.21.0",
|
|
71
71
|
"zx": "^7.2.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@leverege/eslint-config-leverege": "^4.2.0",
|
|
75
|
-
"npm": "^10.2.
|
|
75
|
+
"npm": "^10.2.5"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/src/bash-funcs
CHANGED
|
@@ -155,3 +155,41 @@ EOSLACK
|
|
|
155
155
|
--message "\"$slackmsg\""
|
|
156
156
|
# the "\"$var\"" escaped " is necessary for proper message encapsulation
|
|
157
157
|
}
|
|
158
|
+
|
|
159
|
+
# If a helmup.plugin file exists and is executable helmup assumes it is
|
|
160
|
+
# an installation specific script that should be executed instead of one
|
|
161
|
+
# of the standard setup scripts.
|
|
162
|
+
function ifPluggedIn() {
|
|
163
|
+
local INVOKED_AS=`basename $0`
|
|
164
|
+
local PLUGIN=
|
|
165
|
+
case "$INVOKED_AS" in
|
|
166
|
+
"helmup"|"helmwhat" )
|
|
167
|
+
PLUGIN="$1/helmup.plugin"
|
|
168
|
+
;;
|
|
169
|
+
"helmdn" )
|
|
170
|
+
PLUGIN="$1/helmdn.plugin"
|
|
171
|
+
;;
|
|
172
|
+
*)
|
|
173
|
+
;;
|
|
174
|
+
esac
|
|
175
|
+
|
|
176
|
+
[ ! -f $PLUGIN ] && return 1
|
|
177
|
+
|
|
178
|
+
if [ ! -x $PLUGIN ];
|
|
179
|
+
then
|
|
180
|
+
cat<<PLUGIN_NOEXEC
|
|
181
|
+
$RED_ERROR The plugin file is present but is not executable.
|
|
182
|
+
Try running => `color y "chmod +x $PLUGIN"`
|
|
183
|
+
|
|
184
|
+
PLUGIN_NOEXEC
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
local OPERATION="Executing local plugin code"
|
|
189
|
+
[ ! -z "$HELM_WHAT" ] && OPERATION="Performing a DRY RUN"
|
|
190
|
+
printf "\n***$OPERATION => `color y $PLUGIN`\n\n" && sleep 2
|
|
191
|
+
export HELM_WHAT
|
|
192
|
+
. $PLUGIN # executing with . allows the plugin to use functions like color
|
|
193
|
+
sendToSlack "$PLUGIN"
|
|
194
|
+
return 0
|
|
195
|
+
}
|
|
@@ -378,24 +378,24 @@ serverFiles:
|
|
|
378
378
|
description: "PostgreSQL replication lag is going up (> 10s): check {{ $labels.release }}"
|
|
379
379
|
dashboard: "OVH:<MONITORING>/postgres"
|
|
380
380
|
|
|
381
|
-
- alert:
|
|
382
|
-
expr: time() - pg_stat_user_tables_last_autovacuum > 60 * 60 * 24
|
|
381
|
+
- alert: PostgresqlTableNotVacuumed
|
|
382
|
+
expr: (pg_stat_user_tables_last_autovacuum > 0) and (time() - pg_stat_user_tables_last_autovacuum > 60 * 60 * 24)
|
|
383
383
|
for: 5m
|
|
384
384
|
labels:
|
|
385
385
|
severity: warning
|
|
386
386
|
annotations:
|
|
387
|
-
summary: "Postgresql table not
|
|
388
|
-
description: "Table has not been
|
|
387
|
+
summary: "Postgresql table not vacuumed"
|
|
388
|
+
description: "Table has not been vacuum for 24 hours: check {{ $labels.instance }}"
|
|
389
389
|
dashboard: "OVH:<MONITORING>/postgres"
|
|
390
390
|
|
|
391
|
-
- alert:
|
|
392
|
-
expr: time() - pg_stat_user_tables_last_autoanalyze > 60 * 60 * 24
|
|
391
|
+
- alert: PostgresqlTableNotAutoAnalyzed
|
|
392
|
+
expr: (pg_stat_user_tables_last_autoanalyze > 0) and (time() - pg_stat_user_tables_last_autoanalyze > 60 * 60 * 24)
|
|
393
393
|
for: 5m
|
|
394
394
|
labels:
|
|
395
395
|
severity: warning
|
|
396
396
|
annotations:
|
|
397
397
|
summary: "Postgresql table not analyzed (instance {{ $labels.instance }})"
|
|
398
|
-
description: "Table has not been analyzed for 24 hours: check {{ $labels.release }} - {{ $labels.datname }}"
|
|
398
|
+
description: "Table {{ $labels.relname }} has not been analyzed for 24 hours: check {{ $labels.release }} - {{ $labels.datname }}"
|
|
399
399
|
dashboard: "OVH:<MONITORING>/postgres"
|
|
400
400
|
|
|
401
401
|
- alert: PostgresqlDeadLocks
|
package/src/helmdn.sh
CHANGED
|
@@ -53,16 +53,10 @@ SYSTEM=(
|
|
|
53
53
|
GITTOP=`git rev-parse --show-toplevel`
|
|
54
54
|
cd $GITTOP
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
overwhelm
|
|
57
57
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
currContext=`kubectl config current-context`
|
|
61
|
-
|
|
62
|
-
IFS='_'
|
|
63
|
-
read -ra ADDR <<< "$currContext"
|
|
64
|
-
|
|
65
|
-
GCP_PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
59
|
+
GCP_PROJECT_ID="$(getProjectIdFromK8sContext)"
|
|
66
60
|
|
|
67
61
|
helm repo update &> /dev/null
|
|
68
62
|
|
|
@@ -104,6 +98,10 @@ NOHELMDN
|
|
|
104
98
|
fi
|
|
105
99
|
|
|
106
100
|
local namespace=${2:-default}
|
|
101
|
+
|
|
102
|
+
# if there is a helmdn.plugin then do that instead
|
|
103
|
+
ifPluggedIn $SERVICE $namespace && continue
|
|
104
|
+
|
|
107
105
|
local helmdn="helm uninstall $1 -n $namespace"
|
|
108
106
|
eval $helmdn
|
|
109
107
|
sendToSlack $helmdn
|
package/src/helmup.sh
CHANGED
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
SHELMUP_ARGS=("$*")
|
|
9
9
|
|
|
10
|
+
# artifact-registry => https://console.cloud.google.com/artifacts?project=leverege-registry
|
|
11
|
+
REGISTRY_DOMAIN="us-docker.pkg.dev"
|
|
12
|
+
# open container initiative (oci) => https://opencontainers.org/
|
|
13
|
+
ARTIFACT_REGISTRY="oci://$REGISTRY_DOMAIN/leverege-registry"
|
|
14
|
+
# login to the registry in the background
|
|
15
|
+
gcloud auth print-access-token | helm registry login -u oauth2accesstoken \
|
|
16
|
+
--password-stdin https://$REGISTRY_DOMAIN &> $DEVNULL &
|
|
17
|
+
|
|
10
18
|
# make sure we have a current npmrc file
|
|
11
19
|
refresh-npm-token
|
|
12
20
|
|
|
@@ -453,6 +461,7 @@ function installVeleroEnvironment() {
|
|
|
453
461
|
showInstalling "Velero Backup Management"
|
|
454
462
|
createNamespaceIfNeeded velero
|
|
455
463
|
|
|
464
|
+
# Do we need to => gcloud auth application-default
|
|
456
465
|
gcloud config set project $GCP_PROJECT_ID
|
|
457
466
|
|
|
458
467
|
## The major chart version will determine the bucket suffix
|
|
@@ -545,30 +554,6 @@ function installVeleroEnvironment() {
|
|
|
545
554
|
kubectl delete volumesnapshotlocation.velero.io -n velero gcp &> $DEVNULL
|
|
546
555
|
}
|
|
547
556
|
|
|
548
|
-
# If a helmup.plugin file exists and is executable helmup assumes it is
|
|
549
|
-
# an installation specific script that should be executed instead of one
|
|
550
|
-
# of the standard setup scripts.
|
|
551
|
-
function ifPluggedIn() {
|
|
552
|
-
PLUGIN="$1/helmup.plugin"
|
|
553
|
-
[ ! -f $PLUGIN ] && return 1
|
|
554
|
-
|
|
555
|
-
if [ ! -x $PLUGIN ];
|
|
556
|
-
then
|
|
557
|
-
cat<<PLUGIN_NOEXEC
|
|
558
|
-
$RED_ERROR The plugin file is present but is not executable.
|
|
559
|
-
Try running => `color y "chmod +x $PLUGIN"`
|
|
560
|
-
|
|
561
|
-
PLUGIN_NOEXEC
|
|
562
|
-
exit 1
|
|
563
|
-
fi
|
|
564
|
-
|
|
565
|
-
printf "\n***Executing local plugin code => `color y $PLUGIN`\n\n" && sleep 2
|
|
566
|
-
export HELM_WHAT
|
|
567
|
-
. $PLUGIN # executing with . allows the plugin to use functions like color
|
|
568
|
-
sendToSlack "$PLUGIN"
|
|
569
|
-
return 0
|
|
570
|
-
}
|
|
571
|
-
|
|
572
557
|
function getServiceAndChartVersion() {
|
|
573
558
|
SERVICE=
|
|
574
559
|
CHARTVER=
|
|
@@ -588,11 +573,6 @@ function getServiceAndChartVersion() {
|
|
|
588
573
|
$YELO_WARN The use of $SERVICE/$LCL_CHART to lock the chart version has
|
|
589
574
|
been deprecated. Create a top level `color g "Versions.json"` file instead:
|
|
590
575
|
|
|
591
|
-
{
|
|
592
|
-
"scheduler" : "3.6.1",
|
|
593
|
-
"$SERVICE" : "$CHARTVER"
|
|
594
|
-
}
|
|
595
|
-
|
|
596
576
|
DEPRECATED_CHART
|
|
597
577
|
exit 1
|
|
598
578
|
fi
|
|
@@ -101,7 +101,7 @@ are made.}`
|
|
|
101
101
|
them know to run this command to fetch the current npmrc file:
|
|
102
102
|
|
|
103
103
|
gcloud secrets versions access latest \\
|
|
104
|
-
--secret=
|
|
104
|
+
--secret=REFRESH_NPM_NPMRC \\
|
|
105
105
|
--project=leverege-registry > ~/.npmrc
|
|
106
106
|
|
|
107
107
|
Note, ^^that command will need a different --project name for non-leverege
|