@leverege/build-tools 2.6.3 → 2.6.5
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/lib/server/helmify/index.js +0 -0
- package/lib/server/repo-init/config.tgz +0 -0
- package/lib/server/repo-init/index.js +0 -0
- package/package.json +6 -6
- package/src/helmdn +32 -10
- package/src/helminit-dp +0 -0
- package/src/helminit-scaler +0 -0
- package/src/helminit-svc +0 -0
- package/src/helmup +57 -43
- package/src/k8x +2 -0
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"deepmerge": "^4.2.2",
|
|
59
59
|
"dotenv": "^10.0.0",
|
|
60
60
|
"execa": "^5.1.1",
|
|
61
|
-
"figlet": "^1.5.
|
|
61
|
+
"figlet": "^1.5.2",
|
|
62
62
|
"git-branch": "^2.0.1",
|
|
63
63
|
"glob": "^7.1.7",
|
|
64
64
|
"inquirer": "^8.1.2",
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
"parse-gitignore": "^1.0.1",
|
|
72
72
|
"readline-sync": "^1.4.10",
|
|
73
73
|
"semver": "^7.3.5",
|
|
74
|
-
"simple-git": "^2.
|
|
74
|
+
"simple-git": "^2.44.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@babel/cli": "^7.14.8",
|
|
78
|
-
"@babel/core": "^7.
|
|
79
|
-
"@babel/node": "^7.14.
|
|
78
|
+
"@babel/core": "^7.15.0",
|
|
79
|
+
"@babel/node": "^7.14.9",
|
|
80
80
|
"@leverege/babel-preset-leverege-node": "^1.2.0",
|
|
81
81
|
"@leverege/eslint-config-leverege": "^3.0.0",
|
|
82
|
-
"npm": "^7.20.
|
|
82
|
+
"npm": "^7.20.6"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/helmdn
CHANGED
|
@@ -50,16 +50,17 @@ PLATFORM=(
|
|
|
50
50
|
resource-server
|
|
51
51
|
scheduler
|
|
52
52
|
transponder-bq
|
|
53
|
-
transponder-fb
|
|
54
53
|
transponder-postgres
|
|
55
54
|
transponder-rt
|
|
56
55
|
)
|
|
57
56
|
|
|
58
57
|
SYSTEM=(
|
|
59
58
|
elastic
|
|
60
|
-
monitoring
|
|
61
|
-
polaris
|
|
62
59
|
redis
|
|
60
|
+
postgres
|
|
61
|
+
timescale-db
|
|
62
|
+
monitoring
|
|
63
|
+
reloader
|
|
63
64
|
traefik
|
|
64
65
|
velero
|
|
65
66
|
)
|
|
@@ -70,17 +71,17 @@ cd $GITTOP
|
|
|
70
71
|
npm run ahoy
|
|
71
72
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
# Detect Project ID
|
|
75
|
+
currContext=`kubectl config current-context`
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
currContext=`kubectl config current-context`
|
|
77
|
+
IFS='_'
|
|
78
|
+
read -ra ADDR <<< "$currContext"
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
read -ra ADDR <<< "$currContext"
|
|
80
|
+
GCP_PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
helm repo update # old helm2 => helm search chartmuseum
|
|
83
83
|
|
|
84
|
+
function annihilateMonitoring() {
|
|
84
85
|
kubectl delete sa -n monitoring stackdriver-exporter
|
|
85
86
|
gcloud iam service-accounts delete stackdriver-exporter@${GCP_PROJECT_ID}.iam.gserviceaccount.com --quiet
|
|
86
87
|
|
|
@@ -89,6 +90,22 @@ function annihilateMonitoring() {
|
|
|
89
90
|
helm ls -n monitoring
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
function annihilateVelero() {
|
|
94
|
+
velero delete backup --all --confirm
|
|
95
|
+
velero delete schedule --all --confirm
|
|
96
|
+
velero delete backup-location --all --confirm
|
|
97
|
+
|
|
98
|
+
## Clean up from previous failed install before uninstalling
|
|
99
|
+
kubectl delete volumesnapshotlocation.velero.io gcp \
|
|
100
|
+
--namespace velero &>/dev/null
|
|
101
|
+
|
|
102
|
+
velero uninstall
|
|
103
|
+
|
|
104
|
+
gcloud iam service-accounts delete \
|
|
105
|
+
--project=${GCP_PROJECT_ID} --quiet \
|
|
106
|
+
velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com &>/dev/null
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
function doNuking() {
|
|
93
110
|
|
|
94
111
|
for PARAM in "$@";
|
|
@@ -100,6 +117,11 @@ function doNuking() {
|
|
|
100
117
|
annihilateMonitoring && continue
|
|
101
118
|
fi
|
|
102
119
|
|
|
120
|
+
if [ "$SERVICE" == "velero-nuke" ];
|
|
121
|
+
then
|
|
122
|
+
annihilateVelero && continue
|
|
123
|
+
fi
|
|
124
|
+
|
|
103
125
|
if [ "$SERVICE" == "platform" ];
|
|
104
126
|
then
|
|
105
127
|
doNuking "${PLATFORM[@]}" && exit $?
|
package/src/helminit-dp
CHANGED
|
File without changes
|
package/src/helminit-scaler
CHANGED
|
File without changes
|
package/src/helminit-svc
CHANGED
|
File without changes
|
package/src/helmup
CHANGED
|
@@ -265,6 +265,9 @@ NEED_TRAEFIK_SECRET
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
function installVelero() {
|
|
268
|
+
open https://velero.io/docs
|
|
269
|
+
yesToContinue "when you are done checking the docs"
|
|
270
|
+
|
|
268
271
|
## Set the project id by parsing current context
|
|
269
272
|
currContext=`kubectl config current-context`
|
|
270
273
|
|
|
@@ -277,16 +280,23 @@ function installVelero() {
|
|
|
277
280
|
|
|
278
281
|
## Create a bucket
|
|
279
282
|
BUCKET="$PROJECT_ID-velero"
|
|
280
|
-
|
|
281
|
-
gsutil mb gs://$BUCKET/
|
|
283
|
+
printf "\nCreating storage bucket...\n"
|
|
284
|
+
gsutil mb gs://$BUCKET/ &> /dev/null
|
|
285
|
+
warnOnError $? "Bucket failed to create or already exists - go check it\n"
|
|
282
286
|
|
|
283
287
|
## Create a service account
|
|
288
|
+
printf "\nCreating the service account\n"
|
|
284
289
|
gcloud iam service-accounts create velero \
|
|
285
|
-
--display-name "Velero service account"
|
|
290
|
+
--display-name "Velero service account" &>/dev/null
|
|
291
|
+
if [ $? -eq 0 ];
|
|
292
|
+
then
|
|
293
|
+
# no error means a new SA was created - slight delay to let it update
|
|
294
|
+
sleep 2
|
|
295
|
+
else
|
|
296
|
+
printf "$YELO_WARN Failed to create the service account - does it already exist?"
|
|
297
|
+
fi
|
|
286
298
|
|
|
287
|
-
SERVICE_ACCOUNT_EMAIL
|
|
288
|
-
--filter="displayName:Velero service account" \
|
|
289
|
-
--format 'value(email)')
|
|
299
|
+
SERVICE_ACCOUNT_EMAIL="velero@${PROJECT_ID}.iam.gserviceaccount.com"
|
|
290
300
|
|
|
291
301
|
## Attach roles
|
|
292
302
|
ROLE_PERMISSIONS=(
|
|
@@ -300,52 +310,67 @@ function installVelero() {
|
|
|
300
310
|
compute.zones.get
|
|
301
311
|
)
|
|
302
312
|
|
|
313
|
+
printf "\nAssigning roles to the SA\n"
|
|
303
314
|
gcloud iam roles create velero.server \
|
|
304
315
|
--project $PROJECT_ID \
|
|
305
316
|
--title "Velero Server" \
|
|
306
|
-
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")"
|
|
317
|
+
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &>/dev/null
|
|
318
|
+
warnOnError $? "Failed to add roles to velero.server - perhaps they already exist?"
|
|
307
319
|
|
|
320
|
+
printf "\nBinding IAM policy to the SA\n"
|
|
308
321
|
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
309
322
|
--member serviceAccount:$SERVICE_ACCOUNT_EMAIL \
|
|
310
|
-
--role projects/$PROJECT_ID/roles/velero.server
|
|
323
|
+
--role projects/$PROJECT_ID/roles/velero.server &>/dev/null
|
|
324
|
+
warnOnError $? "gcloud problem binding IAM policy"
|
|
311
325
|
|
|
312
|
-
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://$
|
|
326
|
+
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://$BUCKET
|
|
313
327
|
|
|
314
328
|
## Create keys
|
|
315
|
-
|
|
329
|
+
VELERO_CREDS="velero-credentials"
|
|
330
|
+
gcloud iam service-accounts keys create $VELERO_CREDS \
|
|
316
331
|
--iam-account $SERVICE_ACCOUNT_EMAIL
|
|
317
332
|
|
|
318
333
|
## Create velero namespace
|
|
319
|
-
kubectl
|
|
334
|
+
kubectl get namespaces velero &>/dev/null
|
|
335
|
+
[ $? -eq 1 ] && kubectl create ns velero
|
|
320
336
|
|
|
321
337
|
## Create kubernetes secret
|
|
322
|
-
|
|
338
|
+
printf "\nStoring the credentials in $VELERO_CREDS k8s secret\n"
|
|
339
|
+
kubectl delete secret $VELERO_CREDS --namespace velero &>/dev/null # toss old key if exists
|
|
340
|
+
kubectl create secret generic $VELERO_CREDS --namespace velero --from-file cloud=${VELERO_CREDS}
|
|
341
|
+
|
|
342
|
+
## Clean up from previous failed install
|
|
343
|
+
kubectl delete volumesnapshotlocation.velero.io -n velero gcp &>/dev/null
|
|
323
344
|
|
|
324
345
|
## Install velero
|
|
325
346
|
helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
326
347
|
helm upgrade --install velero vmware-tanzu/velero \
|
|
327
348
|
--namespace velero \
|
|
328
349
|
--set configuration.provider="gcp" \
|
|
329
|
-
--set configuration.backupStorageLocation.name=
|
|
330
|
-
--set configuration.volumeSnapshotLocation.name="gcp" \
|
|
350
|
+
--set configuration.backupStorageLocation.name=default \
|
|
331
351
|
--set configuration.backupStorageLocation.bucket="${BUCKET}" \
|
|
332
|
-
--set
|
|
352
|
+
--set snapshotsEnabled="true" \
|
|
353
|
+
--set configuration.volumeSnapshotLocation.name=default \
|
|
354
|
+
--set credentials.existingSecret="${VELERO_CREDS}" \
|
|
333
355
|
--set "initContainers[0].name"="velero-plugin-for-gcp" \
|
|
334
356
|
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.0.0" \
|
|
335
357
|
--set "initContainers[0].volumeMounts[0].mountPath"="/target" \
|
|
336
358
|
--set "initContainers[0].volumeMounts[0].name"="plugins" \
|
|
359
|
+
--set schedules.postgresql.schedule="0 2 * * *" \
|
|
360
|
+
--set schedules.postgresql.template.ttl="720h" \
|
|
361
|
+
--set schedules.postgresql.template.labelSelector.matchLabels.release="postgres" \
|
|
362
|
+
--set schedules.postgresql.template.labelSelector.matchLabels.app="postgresql" \
|
|
363
|
+
--set schedules.postgresql.template.snapshotVolumes="true" \
|
|
337
364
|
--set schedules.timescale.schedule="0 3 * * *" \
|
|
338
365
|
--set schedules.timescale.template.ttl="720h" \
|
|
339
366
|
--set schedules.timescale.template.labelSelector.matchLabels.release="timescale-db" \
|
|
340
367
|
--set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
|
|
341
|
-
--set schedules.timescale.template.snapshotVolumes="true"
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
## Instruct users to move velero keys
|
|
348
|
-
printf "\n$YELO_WARN Use the velero-credentials secret for accessing velero\n"
|
|
368
|
+
--set schedules.timescale.template.snapshotVolumes="true"
|
|
369
|
+
|
|
370
|
+
velero get backups
|
|
371
|
+
printf "\n\nVelero keys => kubectl get secret $VELERO_CREDS --namespace velero\n\n"
|
|
372
|
+
/bin/rm -f $VELERO_CREDS
|
|
373
|
+
echo -n "npm run ahoy && velero get backups" | pbcopy
|
|
349
374
|
}
|
|
350
375
|
|
|
351
376
|
# ---------- helmup MAIN ----------
|
|
@@ -417,22 +442,22 @@ function doInstall() {
|
|
|
417
442
|
# Allows chart version from command line via <deployment>/<x.y.z>
|
|
418
443
|
IFS="/" read SERVICE CHARTVER <<< "$PARAM"
|
|
419
444
|
|
|
420
|
-
# Allows chart version as <deployment
|
|
445
|
+
# Allows chart version as <deployment>/Chart-x.y.z*>
|
|
421
446
|
if [ -z "$CHARTVER" ];
|
|
422
447
|
then
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
done
|
|
448
|
+
LCL_CHART=`compgen -G $SERVICE/Chart-?.?.?*` &>/dev/null
|
|
449
|
+
if [ ! -z "$LCL_CHART" ];
|
|
450
|
+
then
|
|
451
|
+
CHARTVER=${LCL_CHART#*/Chart-}
|
|
452
|
+
printf "\n$YELO_WARN Chart version controlled by => `color y $LCL_CHART`\n"
|
|
453
|
+
fi
|
|
430
454
|
fi
|
|
455
|
+
#printf "SVC=[$SERVICE] CHT=[$CHARTVER]\n"
|
|
431
456
|
|
|
432
457
|
# slap additional helm syntax in there if the version is set
|
|
433
458
|
[ ! -z "$CHARTVER" ] && CHARTVER="--version $CHARTVER"
|
|
434
459
|
|
|
435
|
-
# If we're referencing a plugin
|
|
460
|
+
# If we're referencing a plugin then execute it and continue
|
|
436
461
|
ifPluggedIn $SERVICE && continue
|
|
437
462
|
|
|
438
463
|
case "$SERVICE" in
|
|
@@ -444,11 +469,6 @@ function doInstall() {
|
|
|
444
469
|
doInstall "${SYSTEM[@]}"
|
|
445
470
|
;;
|
|
446
471
|
|
|
447
|
-
"coredns")
|
|
448
|
-
helm install --name coredns --namespace=kube-system stable/coredns
|
|
449
|
-
printf "\nGithub repo is here => https://github.com/helm/charts/tree/master/stable/coredns\n\n"
|
|
450
|
-
;;
|
|
451
|
-
|
|
452
472
|
"custom-metrics")
|
|
453
473
|
kubectl create -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/deploy/production/adapter.yaml
|
|
454
474
|
;;
|
|
@@ -472,12 +492,6 @@ function doInstall() {
|
|
|
472
492
|
monitoringHelp && exit 0
|
|
473
493
|
;;
|
|
474
494
|
|
|
475
|
-
"polaris")
|
|
476
|
-
helm repo add reactiveops-stable https://charts.reactiveops.com/stable
|
|
477
|
-
helm upgrade --install polaris reactiveops-stable/polaris --namespace polaris
|
|
478
|
-
printf "\n***Proxy 8081 with this=> kubectl port-forward --namespace polaris svc/polaris-dashboard 8081:80\n\n"
|
|
479
|
-
;;
|
|
480
|
-
|
|
481
495
|
"postgres"|"postgresql")
|
|
482
496
|
helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
483
497
|
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|
package/src/k8x
CHANGED
|
@@ -4,6 +4,8 @@ cmd=${@:-"bash"}
|
|
|
4
4
|
|
|
5
5
|
[ "$cmd" = "redis" ] || [ "$cmd" = "redis-cli" ] && FZFQ="--query=redis" && cmd='redis-cli'
|
|
6
6
|
|
|
7
|
+
[ "$cmd" = "pgsql" ] && FZFQ="--query=postgresql" && cmd='psql -U postgres'
|
|
8
|
+
|
|
7
9
|
[ -f overwhelm.yaml ] && [ -f package.json ] && npm run ahoy
|
|
8
10
|
|
|
9
11
|
[ ! -x "$(command -v fzf)" ] && printf "\n***ERROR: Missing fzf fuzzy matcher => brew install fzf\n\n" && exit 1
|