@leverege/build-tools 2.13.4 → 2.14.1
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/repo-init/config.tgz +0 -0
- package/lib/server/unleash.js +1 -11
- package/lib/web/unleash.js +1 -11
- package/package.json +3 -3
- package/src/bash-funcs +4 -0
- package/src/helmup +81 -22
- package/src/unleash.js +1 -9
|
Binary file
|
package/lib/server/unleash.js
CHANGED
|
@@ -44,16 +44,6 @@ const npmRunner = async script => {
|
|
|
44
44
|
await npmRunner(script[i]);
|
|
45
45
|
}
|
|
46
46
|
} else {
|
|
47
|
-
|
|
48
|
-
await execa('npm-check-updates', ['--color', '--packageFile', './package.json'], {
|
|
49
|
-
stdio: 'inherit'
|
|
50
|
-
});
|
|
51
|
-
process.exit(0);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.log({
|
|
54
|
-
err
|
|
55
|
-
}, 'npm-check-update failed');
|
|
56
|
-
process.exit(err.exitCode);
|
|
57
|
-
}
|
|
47
|
+
process.exit(0);
|
|
58
48
|
}
|
|
59
49
|
})();
|
package/lib/web/unleash.js
CHANGED
|
@@ -44,16 +44,6 @@ const npmRunner = async script => {
|
|
|
44
44
|
await npmRunner(script[i]);
|
|
45
45
|
}
|
|
46
46
|
} else {
|
|
47
|
-
|
|
48
|
-
await execa('npm-check-updates', ['--color', '--packageFile', './package.json'], {
|
|
49
|
-
stdio: 'inherit'
|
|
50
|
-
});
|
|
51
|
-
process.exit(0);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.log({
|
|
54
|
-
err
|
|
55
|
-
}, 'npm-check-update failed');
|
|
56
|
-
process.exit(err.exitCode);
|
|
57
|
-
}
|
|
47
|
+
process.exit(0);
|
|
58
48
|
}
|
|
59
49
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"inquirer": "^8.2.4",
|
|
62
62
|
"js-yaml": "^4.1.0",
|
|
63
63
|
"ncp": "^2.0.0",
|
|
64
|
-
"npm-check-updates": "^13.
|
|
64
|
+
"npm-check-updates": "^13.1.1",
|
|
65
65
|
"npm-registry-fetch": "^11.0.0",
|
|
66
66
|
"open": "^8.4.0",
|
|
67
67
|
"ora": "^5.4.1",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"@babel/node": "^7.17.10",
|
|
77
77
|
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
78
78
|
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
79
|
-
"npm": "^8.
|
|
79
|
+
"npm": "^8.12.1"
|
|
80
80
|
}
|
|
81
81
|
}
|
package/src/bash-funcs
CHANGED
package/src/helmup
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
# Load the standard helper functions
|
|
9
9
|
. `build-tools --bashfun`
|
|
10
10
|
|
|
11
|
+
HELMUP_ARGS=("$*")
|
|
12
|
+
|
|
11
13
|
# removed geotile-server from standard platform 3/20/22 - low usage
|
|
12
14
|
PLATFORM=(
|
|
13
15
|
authz-server
|
|
@@ -39,6 +41,24 @@ SYSTEM=(
|
|
|
39
41
|
monitoring # do monitoring last to show password
|
|
40
42
|
)
|
|
41
43
|
|
|
44
|
+
# support for legacy bitnami charts
|
|
45
|
+
function addBitnamiRepo() {
|
|
46
|
+
if [ ! -z "$BITNAMI_LATEST" ];
|
|
47
|
+
then
|
|
48
|
+
BITNAMI_URL="https://charts.bitnami.com/bitnami"
|
|
49
|
+
else
|
|
50
|
+
cat<<CATNAMI
|
|
51
|
+
Using the pre 2022 legacy charts from bitnami. To use latest run:
|
|
52
|
+
|
|
53
|
+
`color y "BITNAMI_LATEST=1 $HELMUP_ARGS"`
|
|
54
|
+
|
|
55
|
+
CATNAMI
|
|
56
|
+
BITNAMI_URL="https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
addHelmRepo bitnami $BITNAMI_URL
|
|
60
|
+
}
|
|
61
|
+
|
|
42
62
|
function checkTimescalePassword(){
|
|
43
63
|
kubectl get secret postgresql-password
|
|
44
64
|
if [[ $? -eq 1 ]]; then
|
|
@@ -165,6 +185,10 @@ SA_EXISTS
|
|
|
165
185
|
--namespace monitoring \
|
|
166
186
|
--values grafana/values-grafana.yaml \
|
|
167
187
|
--version 6.26.5 # latest v8 grafana
|
|
188
|
+
|
|
189
|
+
## Clean up
|
|
190
|
+
removeHelmRepo prometheus-community
|
|
191
|
+
removeHelmRepo grafana
|
|
168
192
|
}
|
|
169
193
|
|
|
170
194
|
function monitoringHelp(){
|
|
@@ -271,6 +295,7 @@ function installPreemptibleKiller() {
|
|
|
271
295
|
--set extraEnv.BLACKLIST_HOURS="10:00-02:00" # No killing from 5AM-9PM EST
|
|
272
296
|
# --set extraEnv.WHITELIST_HOURS="12:30-13:30"
|
|
273
297
|
[ -f "google_service_account.json" ] && rm google_service_account.json
|
|
298
|
+
removeHelmRepo estafette
|
|
274
299
|
}
|
|
275
300
|
|
|
276
301
|
function installCronZombieKiller() {
|
|
@@ -403,6 +428,7 @@ DELAY
|
|
|
403
428
|
check certs: `color g "kubectl -n cert-manager describe certificate"`
|
|
404
429
|
|
|
405
430
|
HINTS
|
|
431
|
+
removeHelmRepo jetstack
|
|
406
432
|
}
|
|
407
433
|
|
|
408
434
|
function installTraefik() {
|
|
@@ -450,19 +476,18 @@ deployment:
|
|
|
450
476
|
TRAEFIK_CFG
|
|
451
477
|
fi
|
|
452
478
|
|
|
453
|
-
# old chart => traefik https://containous.github.io/traefik-helm-chart
|
|
454
|
-
helm repo remove traefik &> /dev/null
|
|
455
479
|
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
456
480
|
|
|
457
481
|
helm upgrade --install traefik traefik/traefik \
|
|
458
482
|
--namespace traefik \
|
|
459
483
|
--values $TRAEFIK_HA_YAML
|
|
484
|
+
|
|
485
|
+
removeHelmRepo traefik
|
|
460
486
|
}
|
|
461
487
|
|
|
462
488
|
function installVelero() {
|
|
489
|
+
# Follows instructions => https://github.com/vmware-tanzu/velero-plugin-for-gcp
|
|
463
490
|
showInstalling "Velero Backup Management"
|
|
464
|
-
open https://velero.io/docs
|
|
465
|
-
yesToContinue "when you are done checking the docs"
|
|
466
491
|
|
|
467
492
|
## Set the project id by parsing current context
|
|
468
493
|
currContext=`kubectl config current-context`
|
|
@@ -483,7 +508,9 @@ function installVelero() {
|
|
|
483
508
|
## Create a service account
|
|
484
509
|
printf "\nCreating the service account\n"
|
|
485
510
|
gcloud iam service-accounts create velero \
|
|
486
|
-
--
|
|
511
|
+
--project $PROJECT_ID \
|
|
512
|
+
--display-name "Velero service account" \
|
|
513
|
+
--description "Velero service account" &>/dev/null
|
|
487
514
|
if [ $? -eq 0 ];
|
|
488
515
|
then
|
|
489
516
|
# no error means a new SA was created - slight delay to let it update
|
|
@@ -504,6 +531,11 @@ function installVelero() {
|
|
|
504
531
|
compute.snapshots.useReadOnly
|
|
505
532
|
compute.snapshots.delete
|
|
506
533
|
compute.zones.get
|
|
534
|
+
iam.serviceAccounts.actAs
|
|
535
|
+
storage.objects.create
|
|
536
|
+
storage.objects.delete
|
|
537
|
+
storage.objects.get
|
|
538
|
+
storage.objects.list
|
|
507
539
|
)
|
|
508
540
|
|
|
509
541
|
printf "\nAssigning roles to the SA\n"
|
|
@@ -511,43 +543,64 @@ function installVelero() {
|
|
|
511
543
|
--project $PROJECT_ID \
|
|
512
544
|
--title "Velero Server" \
|
|
513
545
|
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &>/dev/null
|
|
546
|
+
if [ $? -ne 0 ];
|
|
547
|
+
then
|
|
548
|
+
# assume error is that role exists so try updating instead
|
|
549
|
+
printf "\nUpdating roles on the SA\n"
|
|
550
|
+
gcloud iam roles update velero.server \
|
|
551
|
+
--project $PROJECT_ID \
|
|
552
|
+
--title "Velero Server" \
|
|
553
|
+
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &>/dev/null
|
|
554
|
+
fi
|
|
514
555
|
warnOnError $? "Failed to add roles to velero.server - perhaps they already exist?"
|
|
515
556
|
|
|
516
557
|
printf "\nBinding IAM policy to the SA\n"
|
|
517
558
|
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
559
|
+
--project $PROJECT_ID \
|
|
518
560
|
--member serviceAccount:$SERVICE_ACCOUNT_EMAIL \
|
|
561
|
+
--condition 'None' \
|
|
519
562
|
--role projects/$PROJECT_ID/roles/velero.server &>/dev/null
|
|
520
563
|
warnOnError $? "gcloud problem binding IAM policy"
|
|
521
564
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
565
|
+
printf "\nBinding workload identity IAM policy to the SA\n"
|
|
566
|
+
gcloud iam service-accounts add-iam-policy-binding \
|
|
567
|
+
--member "serviceAccount:$PROJECT_ID.svc.id.goog[velero/velero]" \
|
|
568
|
+
--role roles/iam.workloadIdentityUser \
|
|
569
|
+
$SERVICE_ACCOUNT_EMAIL
|
|
570
|
+
warnOnError $? "gcloud workload identity binding may have failed"
|
|
528
571
|
|
|
529
572
|
## Create velero namespace
|
|
530
573
|
kubectl get namespaces velero &>/dev/null
|
|
531
574
|
[ $? -eq 1 ] && kubectl create ns velero
|
|
532
575
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
576
|
+
printf "\nCreate and annotate the k8s SA\n"
|
|
577
|
+
kubectl create serviceaccount velero --namespace velero
|
|
578
|
+
warnOnError $? "Failed to create k8s SA - perhaps it already exists?"
|
|
579
|
+
|
|
580
|
+
kubectl annotate serviceaccount velero \
|
|
581
|
+
--namespace velero \
|
|
582
|
+
iam.gke.io/gcp-service-account=$SERVICE_ACCOUNT_EMAIL
|
|
583
|
+
warnOnError $? "Failed to annotate k8s SA - things may fail"
|
|
584
|
+
|
|
585
|
+
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://$BUCKET
|
|
537
586
|
|
|
538
587
|
## Clean up from previous failed install
|
|
539
588
|
kubectl delete volumesnapshotlocation.velero.io -n velero gcp &>/dev/null
|
|
540
589
|
|
|
541
|
-
## Install velero
|
|
590
|
+
## Install velero chart => https://github.com/vmware-tanzu/helm-charts/blob/main/charts/velero/values.yaml
|
|
591
|
+
## Helpful debugging link => https://github.com/vmware-tanzu/helm-charts/issues/351
|
|
542
592
|
addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
543
593
|
helm upgrade --install velero vmware-tanzu/velero \
|
|
544
594
|
--namespace velero \
|
|
595
|
+
--set credentials.useSecret="false" \
|
|
545
596
|
--set configuration.provider="gcp" \
|
|
546
597
|
--set configuration.backupStorageLocation.name=default \
|
|
547
598
|
--set configuration.backupStorageLocation.bucket="${BUCKET}" \
|
|
599
|
+
--set configuration.backupStorageLocation.config.serviceAccount=$SERVICE_ACCOUNT_EMAIL \
|
|
600
|
+
--set serviceAccount.server.create="false" \
|
|
601
|
+
--set serviceAccount.server.name="velero" \
|
|
548
602
|
--set snapshotsEnabled="true" \
|
|
549
603
|
--set configuration.volumeSnapshotLocation.name=default \
|
|
550
|
-
--set credentials.existingSecret="${VELERO_CREDS}" \
|
|
551
604
|
--set "initContainers[0].name"="velero-plugin-for-gcp" \
|
|
552
605
|
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.0.0" \
|
|
553
606
|
--set "initContainers[0].volumeMounts[0].mountPath"="/target" \
|
|
@@ -564,8 +617,11 @@ function installVelero() {
|
|
|
564
617
|
--set schedules.timescale.template.snapshotVolumes="true"
|
|
565
618
|
|
|
566
619
|
velero get backups
|
|
567
|
-
|
|
568
|
-
|
|
620
|
+
cat<<DONE_VELERO
|
|
621
|
+
|
|
622
|
+
Velero docs => `color g 'open https://velero.io/docs'`
|
|
623
|
+
DONE_VELERO
|
|
624
|
+
removeHelmRepo vmware-tanzu
|
|
569
625
|
echo -n "npm run ahoy && velero get backups" | pbcopy
|
|
570
626
|
}
|
|
571
627
|
|
|
@@ -644,7 +700,6 @@ CHARTVER=
|
|
|
644
700
|
FROM_VERSIONS=
|
|
645
701
|
function doInstall() {
|
|
646
702
|
|
|
647
|
-
# helm repo remove stable &> /dev/null # stable was deprecated
|
|
648
703
|
helm repo update &> /dev/null
|
|
649
704
|
|
|
650
705
|
for PARAM in "$@";
|
|
@@ -692,6 +747,7 @@ function doInstall() {
|
|
|
692
747
|
helm upgrade --install elasticsearch elastic/elasticsearch \
|
|
693
748
|
--values $LOCAL_ES_VALUES \
|
|
694
749
|
--set volumeClaimTemplate.storageClassName="ssd"
|
|
750
|
+
removeHelmRepo elastic
|
|
695
751
|
;;
|
|
696
752
|
|
|
697
753
|
"estafette"|"preemptible-killer")
|
|
@@ -709,24 +765,27 @@ function doInstall() {
|
|
|
709
765
|
|
|
710
766
|
"postgres"|"postgresql")
|
|
711
767
|
showInstalling "PostgreSQL Database"
|
|
712
|
-
|
|
768
|
+
addBitnamiRepo
|
|
713
769
|
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|
|
770
|
+
removeHelmRepo bitnami
|
|
714
771
|
;;
|
|
715
772
|
|
|
716
773
|
"redis")
|
|
717
774
|
showInstalling "Redis Network Cache"
|
|
718
|
-
|
|
775
|
+
addBitnamiRepo
|
|
719
776
|
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="13.0.1" # latest breaks us => "v14+"
|
|
720
777
|
helm upgrade --install redis bitnami/redis \
|
|
721
778
|
-f redis/redis-values.yaml \
|
|
722
779
|
--version $REDIS_HELM_CHART
|
|
723
780
|
printf "\n\nTo start a specific version => `color g 'REDIS_HELM_CHART="13.0.1" helmup redis'`\n\n"
|
|
781
|
+
removeHelmRepo bitnami
|
|
724
782
|
;;
|
|
725
783
|
|
|
726
784
|
"reloader")
|
|
727
785
|
showInstalling "Stakater ConfigMap Reloader"
|
|
728
786
|
addHelmRepo stakater https://stakater.github.io/stakater-charts
|
|
729
787
|
helm upgrade --install reloader stakater/reloader
|
|
788
|
+
removeHelmRepo stakater
|
|
730
789
|
;;
|
|
731
790
|
|
|
732
791
|
"timescale-db")
|
package/src/unleash.js
CHANGED
|
@@ -39,14 +39,6 @@ const npmRunner = async ( script ) => {
|
|
|
39
39
|
await npmRunner( script[i] )
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
|
|
43
|
-
await execa( 'npm-check-updates', [
|
|
44
|
-
'--color', '--packageFile', './package.json',
|
|
45
|
-
], { stdio : 'inherit' } )
|
|
46
|
-
process.exit( 0 )
|
|
47
|
-
} catch ( err ) {
|
|
48
|
-
console.log( { err }, 'npm-check-update failed' )
|
|
49
|
-
process.exit( err.exitCode )
|
|
50
|
-
}
|
|
42
|
+
process.exit( 0 )
|
|
51
43
|
}
|
|
52
44
|
} )()
|