@leverege/build-tools 2.43.8 → 2.43.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.43.8",
3
+ "version": "2.43.10",
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.0",
67
+ "read-pkg": "^9.0.1",
68
68
  "readline-sync": "^1.4.10",
69
69
  "semver": "^7.5.4",
70
- "simple-git": "^3.20.0",
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.3"
75
+ "npm": "^10.2.5"
76
76
  }
77
77
  }
package/src/bash-funcs CHANGED
@@ -155,3 +155,28 @@ 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="$1/$INVOKED_AS.plugin"
165
+ [ ! -f $PLUGIN ] && return 1
166
+
167
+ if [ ! -x $PLUGIN ];
168
+ then
169
+ cat<<PLUGIN_NOEXEC
170
+ $RED_ERROR The plugin file is present but is not executable.
171
+ Try running => `color y "chmod +x $PLUGIN"`
172
+
173
+ PLUGIN_NOEXEC
174
+ exit 1
175
+ fi
176
+
177
+ printf "\n***Executing local plugin code => `color y $PLUGIN`\n\n" && sleep 2
178
+ export HELM_WHAT
179
+ . $PLUGIN # executing with . allows the plugin to use functions like color
180
+ sendToSlack "$PLUGIN"
181
+ return 0
182
+ }
@@ -10,7 +10,7 @@ fi
10
10
  #
11
11
  # BASE_NODE_IMAGE="gallium-alpine" npm run dockerize <version>
12
12
  #
13
- BASE_NODE_IMAGE="${BASE_NODE_IMAGE:-hydrogen-alpine}" # node 18, hydrogen
13
+ BASE_NODE_IMAGE="${BASE_NODE_IMAGE:-iron-alpine}" # node 20, iron
14
14
 
15
15
  # Load common bash functions
16
16
  . `build-tools --bashfun`
@@ -122,7 +122,7 @@ COPY ./.npmrc /usr/src/app/.npmrc
122
122
  RUN apk --no-cache add openssh-client && \
123
123
  apk --update add --no-cache --virtual build-dep g++ gcc libgcc \\
124
124
  libstdc++ linux-headers make ${apkadds} && \
125
- npm install -g npm@9 && \
125
+ npm install -g npm@10 && \
126
126
  npm ci --only=production --ignore-scripts --no-optional ${npmlogging} && \
127
127
  rm -f /usr/src/app/.npmrc /root/.ssh/*
128
128
 
@@ -135,7 +135,7 @@ FROM node:${BASE_NODE_IMAGE}
135
135
  # Install tini for PID 1 and replace shell with bash so we can source files
136
136
  RUN apk update && \
137
137
  apk add --no-cache bash curl tini vim ${apkadds} && \
138
- npm install -g npm@9 && \
138
+ npm install -g npm@10 && \
139
139
  rm /bin/sh && ln -s /bin/bash /bin/sh && \
140
140
  mkdir -p /usr/src/app /tmp/levlog && \
141
141
  chown node:node /usr/src/app
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v3.5.0
2
+ tag: # v3.6.0
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -1,3 +1,4 @@
1
+ # Needs OVERDOSE_API_KEY and OVERDOSE_API_SECRET api-ui keys
1
2
  image:
2
3
  tag: # 1.2.1
3
4
 
@@ -149,15 +149,15 @@ serverFiles:
149
149
  dashboard: "Check GKE or EKS node status"
150
150
 
151
151
  - alert: KubernetesVolumeOutOfDiskSpace
152
- expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 20
152
+ expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 10
153
153
  for: 5m
154
154
  labels:
155
- severity: page
155
+ severity: error
156
156
  priority: P2
157
157
  annotations:
158
- summary: "Kubernetes Volume out of disk space"
159
- description: "Volume is almost full (< 10% left)"
160
- dashboard: "OVH:<MONITORING>/pvc"
158
+ summary: "Kubernetes PVC Free Space < 10%"
159
+ description: "PVC volume {{ $labels.persistentvolumeclaim }} is almost full - down to {{ $value | humanize }}% available"
160
+ dashboard: "OVH:<MONITORING>/k8s-pvc/pvc-usage?var-volume={{ $labels.persistentvolumeclaim }}"
161
161
 
162
162
  # - alert: KubernetesVolumeFullInFourDays
163
163
  # expr: predict_linear(kubelet_volume_stats_available_bytes[6h], 4 * 24 * 3600) < 0
@@ -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: PostgresqlTableNotVaccumed
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 vaccumed"
388
- description: "Table has not been vaccum for 24 hours: check {{ $labels.release }}"
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: PostgresqlTableNotAnalyzed
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
@@ -0,0 +1,25 @@
1
+ image:
2
+ tag: # v1.1.0
3
+
4
+ config:
5
+ # server configs
6
+ LOG_CONFIG: '{"type":"pino","level":"info"}'
7
+
8
+ # message rates = stopId/(frequency/1000) Hz
9
+ # default-test RX is 1K objects at 33Hz
10
+ INITIAL_RX : |
11
+ {
12
+ "devices" : {
13
+ "default-test" : {
14
+ "projectId" : "set-in-values-local",
15
+ "blueprintId" : "set-in-values-local",
16
+ "systemId" : "set-in-values-local",
17
+ "networkId" : "set-in-values-local",
18
+ "startId" : 0,
19
+ "stopId" : 1000,
20
+ "bucketSize" : 100,
21
+ "frequency" : 30000, # default RX is 1K objects at 33Hz
22
+ "messageSizeLimit" : 100
23
+ }
24
+ }
25
+ }
@@ -4,7 +4,7 @@ showInstalling "Redis"
4
4
 
5
5
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/redis"
6
6
 
7
- [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="18.3.1"
7
+ [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="18.4.0"
8
8
 
9
9
  helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/redis-local.yaml \
@@ -1,5 +1,5 @@
1
1
  image:
2
- tag: # v2.3.0
2
+ tag: # v3.0.1
3
3
 
4
4
  config:
5
5
  LOG_CONFIG: '{"type":"pino","level":"warn"}'
@@ -2,6 +2,8 @@
2
2
  # to force a reinstall of this service simply remove or rename this
3
3
  # stackdriver-exporter subdirectory and rerun helmup stackdriver-exporter
4
4
  #
5
+ fullnameOverride: "prometheus-stackdriver-exporter"
6
+
5
7
  stackdriver:
6
8
  projectId: "OVH:<PROJECT_NAME>"
7
9
  metrics:
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
- npm run ahoy
56
+ overwhelm
57
57
  [ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
58
58
 
59
- # Detect Project ID
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=NPM_DEVELOPER_NPMRC \\
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