@leverege/build-tools 2.23.1 → 2.23.3

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.23.1",
3
+ "version": "2.23.3",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
  "dotenv": "^16.0.3",
58
58
  "enquirer": "^2.3.6",
59
59
  "execa": "^5.1.1",
60
- "glob": "^8.0.3",
60
+ "glob": "^8.1.0",
61
61
  "js-yaml": "^4.1.0",
62
62
  "npm-registry-fetch": "^13.3.1",
63
63
  "parse-gitignore": "^2.0.0",
@@ -71,6 +71,6 @@
71
71
  "@babel/core": "^7.20.12",
72
72
  "@leverege/babel-preset-leverege-node": "^2.0.0",
73
73
  "@leverege/eslint-config-leverege": "^3.0.1",
74
- "npm": "^9.2.0"
74
+ "npm": "^9.3.0"
75
75
  }
76
76
  }
package/src/helmup CHANGED
@@ -7,9 +7,6 @@
7
7
 
8
8
  SHELMUP_ARGS=("$*")
9
9
 
10
- # The project id is used in a lot of places so just set it here
11
- GCP_PROJECT_ID="$(getProjectIdFromK8sContext)"
12
-
13
10
  # removed geotile-server from standard platform 3/20/22 - low usage
14
11
  PLATFORM=(
15
12
  authz-server
@@ -36,7 +33,7 @@ SYSTEM=(
36
33
  preemptible-killer
37
34
  zombie-killer
38
35
  reloader
39
- cert-manager # deprecated
36
+ # cert-manager # deprecated from SYSTEM 01/13/2023
40
37
  traefik
41
38
  velero
42
39
  monitoring # do monitoring last to show password
@@ -140,17 +137,6 @@ function bootstrapLocalSetup() {
140
137
  ifPluggedIn $SERVICE
141
138
  }
142
139
 
143
- function installGrafana() {
144
- ## Install Grafana
145
- addHelmRepo grafana https://grafana.github.io/helm-charts
146
- [ -z "$GRAFANA_HELM_CHART" ] && GRAFANA_HELM_CHART="6"
147
- helm upgrade --install grafana grafana/grafana \
148
- --namespace monitoring \
149
- --values grafana/values-grafana.yaml \
150
- --version $GRAFANA_HELM_CHART
151
- removeHelmRepo grafana
152
- }
153
-
154
140
  function errorIfMissingSecret() {
155
141
  SECRET="$1"
156
142
  kubectl get secret $SECRET &> /dev/null
@@ -481,14 +467,17 @@ NEED_TRAEFIK_SECRET
481
467
  fi
482
468
  }
483
469
 
484
- function installVelero() {
470
+ function installVeleroEnvironment() {
485
471
  # Follows instructions => https://github.com/vmware-tanzu/velero-plugin-for-gcp
486
472
  showInstalling "Velero Backup Management"
487
473
 
488
474
  gcloud config set project $GCP_PROJECT_ID
489
475
 
476
+ ## The major chart version will determine the bucket suffix
477
+ [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
478
+
490
479
  ## Create a bucket
491
- BUCKET="$GCP_PROJECT_ID-velero"
480
+ BUCKET="$GCP_PROJECT_ID-velero-$VELERO_HELM_CHART"
492
481
  GCE_REGION=`overwhelm -k GCE_REGION`
493
482
  printf "\nCreating storage bucket `color g $BUCKET` in `color g $GCE_REGION`\n"
494
483
  gsutil mb -l $GCE_REGION gs://$BUCKET/ &> /dev/null
@@ -576,64 +565,6 @@ function installVelero() {
576
565
 
577
566
  ## Clean up from previous failed install
578
567
  kubectl delete volumesnapshotlocation.velero.io -n velero gcp &>/dev/null
579
-
580
- ## Install velero chart => https://github.com/vmware-tanzu/helm-charts/blob/main/charts/velero/values.yaml
581
- ## The velero plugin for GCP => https://github.com/vmware-tanzu/velero-plugin-for-gcp
582
- ## Helpful debugging link => https://github.com/vmware-tanzu/helm-charts/issues/351
583
- addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
584
- ## Build velero command
585
- [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
586
- helm upgrade --install velero vmware-tanzu/velero \
587
- --version "$VELERO_HELM_CHART" \
588
- --namespace "velero" \
589
- --set credentials.useSecret="false" \
590
- --set configuration.provider="gcp" \
591
- --set configuration.backupStorageLocation.name="default" \
592
- --set configuration.backupStorageLocation.bucket="${BUCKET}" \
593
- --set configuration.backupStorageLocation.config.serviceAccount="$SERVICE_ACCOUNT_EMAIL" \
594
- --set serviceAccount.server.create="false" \
595
- --set serviceAccount.server.name="velero" \
596
- --set snapshotsEnabled="true" \
597
- --set configuration.volumeSnapshotLocation.name="default" \
598
- --set configuration.volumeSnapshotLocation.config.snapshotLocation="$GCE_REGION" \
599
- --set "initContainers[0].name"="velero-plugin-for-gcp" \
600
- --set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.5.0" \
601
- --set "initContainers[0].volumeMounts[0].mountPath"="/target" \
602
- --set "initContainers[0].volumeMounts[0].name"="plugins" \
603
- --set schedules.postgresql.schedule="0 2 * * *" \
604
- --set schedules.postgresql.template.ttl="720h" \
605
- --set schedules.postgresql.template.labelSelector.matchLabels.release="postgres" \
606
- --set schedules.postgresql.template.labelSelector.matchLabels.app="postgresql" \
607
- --set schedules.postgresql.template.snapshotVolumes="true" \
608
- --set schedules.timescale.schedule="0 3 * * *" \
609
- --set schedules.timescale.template.ttl="720h" \
610
- --set schedules.timescale.template.labelSelector.matchLabels.release="timescale-db" \
611
- --set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
612
- --set schedules.timescale.template.snapshotVolumes="true" \
613
- --set schedules.redis.schedule="*/30 * * * *" \
614
- --set schedules.redis.template.ttl="24h" \
615
- --set schedules.redis.template.labelSelector.matchLabels.name="redis" \
616
- --set schedules.redis.template.snapshotVolumes="true"
617
-
618
- velero get backups
619
- cat<<DONE_VELERO
620
-
621
- Velero docs => `color g 'open https://velero.io/docs'`
622
-
623
- Wait at least 1 minute before kicking off the following backups:
624
-
625
- `color g 'velero backup create --from-schedule velero-postgresql'`
626
- `color g 'velero backup create --from-schedule velero-timescale'`
627
-
628
- This will create initial backups from the defined schedules which should
629
- avoid alerts from prometheus about backups failing on new installations.
630
-
631
- The status of the backups may be checked by running:
632
-
633
- `color g 'overwhelm && velero get backups'`
634
-
635
- DONE_VELERO
636
- removeHelmRepo vmware-tanzu
637
568
  }
638
569
 
639
570
  # If a helmup.plugin file exists and is executable helmup assumes it is
@@ -806,7 +737,8 @@ function doInstall() {
806
737
  ;;
807
738
 
808
739
  "velero")
809
- installVelero # because it's a little more involved
740
+ installVeleroEnvironment
741
+ bootstrapLocalSetup velero
810
742
  ;;
811
743
 
812
744
  *)
@@ -879,5 +811,8 @@ K8S_UTILS="${GITTOP}/k8s-utils"
879
811
  overwhelm
880
812
  [ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
881
813
 
814
+ # The project id is used in a lot of places so just set it here
815
+ GCP_PROJECT_ID="$(getProjectIdFromK8sContext)"
816
+
882
817
  doInstall $@
883
818
  cd - &> /dev/null
@@ -0,0 +1,105 @@
1
+ # Backup schedules to create.
2
+ #
3
+ schedules:
4
+ postgresql:
5
+ disabled: false
6
+ schedule: "0 2 * * *"
7
+ template:
8
+ ttl: "720h"
9
+ snapshotVolumes: true
10
+ labelSelector:
11
+ matchLabels:
12
+ release: "postgres"
13
+ app: "postgresql"
14
+
15
+ timescale:
16
+ disabled: false
17
+ schedule: "0 3 * * *"
18
+ template:
19
+ ttl: "720h"
20
+ snapshotVolumes: true
21
+ labelSelector:
22
+ matchLabels:
23
+ release: "timescale-db"
24
+ app: "postgresql"
25
+
26
+ redis:
27
+ disabled: true
28
+ schedule: "*/30 * * * *"
29
+ template:
30
+ ttl: "24h"
31
+ snapshotVolumes: true
32
+ labelSelector:
33
+ matchLabels:
34
+ name: "redis"
35
+ ##
36
+ ## End of Schedules Section
37
+ ##
38
+
39
+ # Resource requests/limits to specify for the Velero deployment.
40
+ # https://velero.io/docs/v1.6/customize-installation/#customize-resource-requests-and-limits
41
+ resources:
42
+ requests:
43
+ cpu: 250m
44
+ memory: 128Mi
45
+ limits:
46
+ cpu: 300m
47
+ memory: 256Mi
48
+
49
+ # Annotations to add to the Velero deployment's. Optional.
50
+ #
51
+ # If you are using reloader use the following annotation with your VELERO_SECRET_NAME
52
+ annotations: {}
53
+ # secret.reloader.stakater.com/reload: "<VELERO_SECRET_NAME>"
54
+
55
+ # Labels to add to the Velero deployment's. Optional.
56
+ labels: {}
57
+
58
+ # Additional pod labels for Velero deployment's template. Optional
59
+ # ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
60
+ podLabels: {}
61
+
62
+ # Tolerations to use for the Velero deployment. Optional.
63
+ tolerations: []
64
+
65
+ # Affinity to use for the Velero deployment. Optional.
66
+ affinity: {}
67
+
68
+ # Node selector to use for the Velero deployment. Optional.
69
+ nodeSelector: {}
70
+
71
+ # Init containers to add to the Velero deployment's pod spec. At least one plugin provider image is required.
72
+ # If the value is a string then it is evaluated as a template.
73
+ initContainers:
74
+ - name: velero-plugin-for-gcp
75
+ image: velero/velero-plugin-for-gcp:v1.5.0
76
+ volumeMounts:
77
+ - mountPath: /target
78
+ name: plugins
79
+
80
+ ##
81
+ ## Parameters for the `default` BackupStorageLocation and VolumeSnapshotLocation,
82
+ ## and additional server settings.
83
+ ##
84
+ configuration:
85
+ # Cloud provider being used (e.g. aws, azure, gcp).
86
+ provider: gcp
87
+
88
+ # Parameters for the `default` VolumeSnapshotLocation. See
89
+ # https://velero.io/docs/v1.6/api-types/volumesnapshotlocation/
90
+ volumeSnapshotLocation:
91
+ name: default
92
+
93
+ # Information about the Kubernetes service account Velero uses. The SA is
94
+ # created and bound the first time helmup deploys the service. No need to
95
+ # recreate with each deployment.
96
+ serviceAccount:
97
+ server:
98
+ create: false
99
+ name: velero
100
+
101
+ # Info about the secret to be used by the Velero deployment, which
102
+ # should contain credentials for the cloud provider IAM account you've
103
+ # set up for Velero.
104
+ credentials:
105
+ useSecret: false
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+
3
+ addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
4
+
5
+ [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
6
+ #
7
+ # Build the bucket, region and SA email variables and use --set to mod the
8
+ # chart values as opposed to using an OVH:<label> approach. This eliminates
9
+ # the need for an overwhelm generated values.yaml file which also contains
10
+ # all of the contamination from the default-values.yaml file.
11
+ #
12
+ # Note: GCP_PROJECT_ID is passed down from helmup's environment.
13
+ #
14
+ GCE_BUCKET="$GCP_PROJECT_ID-velero-$VELERO_HELM_CHART"
15
+ GCE_REGION=`overwhelm -k GCE_REGION`
16
+ GCE_SA_EMAIL="velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com"
17
+
18
+ helm upgrade \
19
+ --install velero vmware-tanzu/velero --namespace velero \
20
+ --values velero/velero-local.yaml \
21
+ --version $VELERO_HELM_CHART $HELM_WHAT \
22
+ --set configuration.backupStorageLocation.bucket="$GCE_BUCKET" \
23
+ --set configuration.backupStorageLocation.config.serviceAccount="$SA_EMAIL" \
24
+ --set configuration.volumeSnapshotLocation.config.snapshotLocation="$GCE_REGION"
25
+
26
+ velero schedule get
27
+ cat<<DONE_VELERO
28
+
29
+ Velero docs => `color g 'open https://velero.io/docs'`
30
+
31
+ Wait at least 1 minute before kicking off the following backups:
32
+
33
+ `color g 'velero backup create --from-schedule velero-postgresql'`
34
+ `color g 'velero backup create --from-schedule velero-timescale'`
35
+
36
+ This will create initial backups from the defined schedules which should
37
+ avoid alerts from prometheus about backups failing on new installations.
38
+
39
+ The status of the backups may be checked by running:
40
+
41
+ `color g 'overwhelm && velero get backups'`
42
+
43
+ DONE_VELERO
44
+
45
+ removeHelmRepo vmware-tanzu