@leverege/build-tools 2.6.2 → 2.6.4
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 +8 -8
- package/src/circleate +2 -64
- package/src/helmdn +28 -7
- package/src/helminit-dp +0 -0
- package/src/helminit-scaler +0 -0
- package/src/helminit-svc +0 -0
- package/src/helmup +48 -23
- 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.4",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"author": "Leverege Devs",
|
|
51
51
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"chalk": "^4.1.
|
|
53
|
+
"chalk": "^4.1.2",
|
|
54
54
|
"clear": "^0.1.0",
|
|
55
55
|
"clipboardy": "^2.3.0",
|
|
56
|
-
"command-line-args": "^5.
|
|
56
|
+
"command-line-args": "^5.2.0",
|
|
57
57
|
"command-line-usage": "^6.1.1",
|
|
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/circleate
CHANGED
|
@@ -43,60 +43,14 @@ create_circle_config(){
|
|
|
43
43
|
create_server_config(){
|
|
44
44
|
cat<<EOCIRCLE > config.yml
|
|
45
45
|
version: 2.1
|
|
46
|
-
orbs:
|
|
47
|
-
gcp-gcr: circleci/gcp-gcr@0.6.1
|
|
46
|
+
#orbs:
|
|
47
|
+
# gcp-gcr: circleci/gcp-gcr@0.6.1
|
|
48
48
|
executors:
|
|
49
49
|
default:
|
|
50
50
|
description: >
|
|
51
51
|
A debian-based machine executor.
|
|
52
52
|
machine: true
|
|
53
53
|
jobs:
|
|
54
|
-
gcr:
|
|
55
|
-
# gcr build docker image and pushes to gcr
|
|
56
|
-
executor: default
|
|
57
|
-
steps:
|
|
58
|
-
- attach_workspace:
|
|
59
|
-
at: ~/project
|
|
60
|
-
- run: |
|
|
61
|
-
echo "export CONTAINER_NAME=\$(cat ~/project/container_name)" >> \$BASH_ENV
|
|
62
|
-
echo "export PACKAGE_VERSION=\$(cat ~/project/package_version)" >> \$BASH_ENV
|
|
63
|
-
echo "export NODE_IMAGE=\$(cat ~/project/node_img)" >> \$BASH_ENV
|
|
64
|
-
- run:
|
|
65
|
-
name: Check for tag version
|
|
66
|
-
command: |
|
|
67
|
-
if ! [[ \$PACKAGE_VERSION =~ ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)\$ ]]; then
|
|
68
|
-
echo "Pre-release tags detected - skipping build"
|
|
69
|
-
circleci-agent step halt
|
|
70
|
-
fi
|
|
71
|
-
- gcp-gcr/gcr-auth
|
|
72
|
-
- run:
|
|
73
|
-
name: Enable Kaniko
|
|
74
|
-
command: gcloud config set builds/use_kaniko True
|
|
75
|
-
- gcp-gcr/build-image:
|
|
76
|
-
image: \$CONTAINER_NAME
|
|
77
|
-
tag: \$PACKAGE_VERSION
|
|
78
|
-
path: docker
|
|
79
|
-
dockerfile: docker/Dockerfile
|
|
80
|
-
- gcp-gcr/push-image:
|
|
81
|
-
image: \$CONTAINER_NAME
|
|
82
|
-
tag: \$PACKAGE_VERSION
|
|
83
|
-
- run:
|
|
84
|
-
name: Check if branch is master
|
|
85
|
-
command: |
|
|
86
|
-
if [ \$CIRCLE_BRANCH == 'master' ]; then
|
|
87
|
-
echo "export GCR_TAG=stable" >> \$BASH_ENV;
|
|
88
|
-
else
|
|
89
|
-
echo "export GCR_TAG=latest" >> \$BASH_ENV;
|
|
90
|
-
fi
|
|
91
|
-
- gcp-gcr/tag-image:
|
|
92
|
-
image: \$CONTAINER_NAME
|
|
93
|
-
source-tag: \$PACKAGE_VERSION
|
|
94
|
-
target-tag: \$GCR_TAG
|
|
95
|
-
- gcp-gcr/tag-image:
|
|
96
|
-
image: \$CONTAINER_NAME
|
|
97
|
-
source-tag: \$PACKAGE_VERSION
|
|
98
|
-
target-tag: circle-\$NODE_IMAGE-\$CIRCLE_USERNAME
|
|
99
|
-
|
|
100
54
|
install:
|
|
101
55
|
docker:
|
|
102
56
|
- image: circleci/node:fermium
|
|
@@ -300,22 +254,6 @@ workflows:
|
|
|
300
254
|
- lint
|
|
301
255
|
- coverage
|
|
302
256
|
- docs
|
|
303
|
-
- gcr:
|
|
304
|
-
context: google
|
|
305
|
-
filters:
|
|
306
|
-
branches:
|
|
307
|
-
only:
|
|
308
|
-
- development
|
|
309
|
-
- /release-.*/
|
|
310
|
-
- master
|
|
311
|
-
requires:
|
|
312
|
-
- install
|
|
313
|
-
- security-check
|
|
314
|
-
- license-check
|
|
315
|
-
- lint
|
|
316
|
-
- coverage
|
|
317
|
-
- docs
|
|
318
|
-
- build
|
|
319
257
|
EOCIRCLE
|
|
320
258
|
}
|
|
321
259
|
|
package/src/helmdn
CHANGED
|
@@ -70,17 +70,17 @@ cd $GITTOP
|
|
|
70
70
|
npm run ahoy
|
|
71
71
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
# Detect Project ID
|
|
74
|
+
currContext=`kubectl config current-context`
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
currContext=`kubectl config current-context`
|
|
76
|
+
IFS='_'
|
|
77
|
+
read -ra ADDR <<< "$currContext"
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
read -ra ADDR <<< "$currContext"
|
|
79
|
+
GCP_PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
helm repo update # old helm2 => helm search chartmuseum
|
|
83
82
|
|
|
83
|
+
function annihilateMonitoring() {
|
|
84
84
|
kubectl delete sa -n monitoring stackdriver-exporter
|
|
85
85
|
gcloud iam service-accounts delete stackdriver-exporter@${GCP_PROJECT_ID}.iam.gserviceaccount.com --quiet
|
|
86
86
|
|
|
@@ -89,6 +89,22 @@ function annihilateMonitoring() {
|
|
|
89
89
|
helm ls -n monitoring
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function annihilateVelero() {
|
|
93
|
+
velero delete backup --all --confirm
|
|
94
|
+
velero delete schedule --all --confirm
|
|
95
|
+
velero delete backup-location --all --confirm
|
|
96
|
+
|
|
97
|
+
## Clean up from previous failed install before uninstalling
|
|
98
|
+
kubectl delete volumesnapshotlocation.velero.io gcp \
|
|
99
|
+
--namespace velero &>/dev/null
|
|
100
|
+
|
|
101
|
+
velero uninstall
|
|
102
|
+
|
|
103
|
+
gcloud iam service-accounts delete \
|
|
104
|
+
--project=${GCP_PROJECT_ID} --quiet \
|
|
105
|
+
velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com &>/dev/null
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
function doNuking() {
|
|
93
109
|
|
|
94
110
|
for PARAM in "$@";
|
|
@@ -100,6 +116,11 @@ function doNuking() {
|
|
|
100
116
|
annihilateMonitoring && continue
|
|
101
117
|
fi
|
|
102
118
|
|
|
119
|
+
if [ "$SERVICE" == "velero" ];
|
|
120
|
+
then
|
|
121
|
+
annihilateVelero && continue
|
|
122
|
+
fi
|
|
123
|
+
|
|
103
124
|
if [ "$SERVICE" == "platform" ];
|
|
104
125
|
then
|
|
105
126
|
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 ----------
|
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
|