@leverege/build-tools 2.24.0 → 2.25.0

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.
@@ -14,9 +14,17 @@ const getCurrentBranchName = async () => {
14
14
  return Object.entries(branchInfo.branches).find(([name, info]) => info.current)[0];
15
15
  };
16
16
  const isProtected = async () => {
17
- const protectedBranches = ['main', 'master', 'development', ...process.argv.slice(2)];
18
17
  const theBranch = await getCurrentBranchName();
19
- return protectedBranches.includes(theBranch);
18
+ const protectedBranches = ['main', 'master', 'development'];
19
+ const additionalProtectedBranches = [...process.argv.slice(2)];
20
+
21
+ // Check if the current branch starts with any of the additional
22
+ // protected branch name
23
+ let matchesAdditionalBranch = false;
24
+ for (let i = 0; i < additionalProtectedBranches.length; i++) {
25
+ matchesAdditionalBranch = matchesAdditionalBranch || theBranch.startsWith(additionalProtectedBranches[i]);
26
+ }
27
+ return protectedBranches.includes(theBranch) || matchesAdditionalBranch;
20
28
  };
21
29
  const npmRunner = async script => {
22
30
  try {
@@ -14,9 +14,17 @@ const getCurrentBranchName = async () => {
14
14
  return Object.entries(branchInfo.branches).find(([name, info]) => info.current)[0];
15
15
  };
16
16
  const isProtected = async () => {
17
- const protectedBranches = ['main', 'master', 'development', ...process.argv.slice(2)];
18
17
  const theBranch = await getCurrentBranchName();
19
- return protectedBranches.includes(theBranch);
18
+ const protectedBranches = ['main', 'master', 'development'];
19
+ const additionalProtectedBranches = [...process.argv.slice(2)];
20
+
21
+ // Check if the current branch starts with any of the additional
22
+ // protected branch name
23
+ let matchesAdditionalBranch = false;
24
+ for (let i = 0; i < additionalProtectedBranches.length; i++) {
25
+ matchesAdditionalBranch = matchesAdditionalBranch || theBranch.startsWith(additionalProtectedBranches[i]);
26
+ }
27
+ return protectedBranches.includes(theBranch) || matchesAdditionalBranch;
20
28
  };
21
29
  const npmRunner = async script => {
22
30
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "compile": "npm run clean && npm run compile_server && npm run compile_web",
14
14
  "compile_server": "NODE_ENV=server babel -d lib/server src/",
15
15
  "compile_web": "NODE_ENV=web babel -d lib/web src/",
16
- "postinstall": "src/npm-scripts/postinstall.js",
16
+ "xpostinstall": "src/npm-scripts/postinstall.js",
17
17
  "prepublintOnly": "npm run lint && npm run build",
18
18
  "prepublishOnly": "npm run compile",
19
19
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -32,6 +32,8 @@
32
32
  "helmup": "src/helmup",
33
33
  "helmwhat": "src/helmup",
34
34
  "k8scale": "src/k8scale",
35
+ "k8cryo": "src/k8cryo",
36
+ "k8thaw": "src/k8thaw",
35
37
  "k8x": "src/k8x",
36
38
  "klog": "src/klog",
37
39
  "npm-link": "src/npm-link",
@@ -53,7 +55,7 @@
53
55
  "chalk": "^4.1.2",
54
56
  "command-line-args": "^5.2.1",
55
57
  "command-line-usage": "^6.1.3",
56
- "deepmerge": "^4.2.2",
58
+ "deepmerge": "^4.3.0",
57
59
  "dotenv": "^16.0.3",
58
60
  "enquirer": "^2.3.6",
59
61
  "execa": "^5.1.1",
@@ -71,6 +73,6 @@
71
73
  "@babel/core": "^7.20.12",
72
74
  "@leverege/babel-preset-leverege-node": "^2.0.0",
73
75
  "@leverege/eslint-config-leverege": "^3.0.1",
74
- "npm": "^9.4.0"
76
+ "npm": "^9.4.1"
75
77
  }
76
78
  }
package/src/helmdn CHANGED
@@ -54,6 +54,7 @@ PLATFORM=(
54
54
  transponder-postgres
55
55
  transponder-tsdb
56
56
  transponder-rt
57
+ pubsub-pulse
57
58
  )
58
59
 
59
60
  SYSTEM=(
package/src/helmup CHANGED
@@ -470,6 +470,7 @@ NEED_TRAEFIK_SECRET
470
470
  function installVeleroEnvironment() {
471
471
  # Follows instructions => https://github.com/vmware-tanzu/velero-plugin-for-gcp
472
472
  showInstalling "Velero Backup Management"
473
+ createNamespaceIfNeeded velero
473
474
 
474
475
  gcloud config set project $GCP_PROJECT_ID
475
476
 
@@ -548,10 +549,6 @@ function installVeleroEnvironment() {
548
549
  $SERVICE_ACCOUNT_EMAIL
549
550
  warnOnError $? "gcloud workload identity binding may have failed"
550
551
 
551
- ## Create velero namespace
552
- kubectl get namespaces velero &>/dev/null
553
- [ $? -eq 1 ] && kubectl create ns velero
554
-
555
552
  printf "\nCreate and annotate the k8s SA\n"
556
553
  kubectl create serviceaccount velero --namespace velero
557
554
  warnOnError $? "Failed to create k8s SA - perhaps it already exists?"
package/src/k8cryo ADDED
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ if [ "`basename $0`" == "k8thaw" ];
4
+ then
5
+ errorExit "k8thaw - UNDER CONSTRUCTION"
6
+ fi
7
+
8
+ # Gets the UTC time in the same format that velero schedules use for
9
+ # generating the Date Time Stamp for scheduled backups.
10
+ DTS="`date -u +\"%Y%m%d%H%M%S\"`"
11
+
12
+ # The 1440h specifies the number of hours to keep the backup - 60 days
13
+ velero backup create velero-cryo-$DTS --ttl 1440h
@@ -21,7 +21,7 @@ existingSecret: authz-postgres
21
21
  metrics:
22
22
  enabled: true
23
23
 
24
- master:
24
+ primary:
25
25
  tolerations:
26
26
  - key: "database"
27
27
  operator: "Equal"
@@ -737,7 +737,7 @@ serverFiles:
737
737
  - name: Velero Alerts
738
738
  rules:
739
739
  - alert: VeleroBackupFailure
740
- expr: (time() - velero_backup_last_successful_timestamp{schedule!=""} > 108000) and (velero_backup_success_total{schedule!=""} != 0)
740
+ expr: (time() - velero_backup_last_successful_timestamp{schedule_version=~"2.[0]"} > 108000) and (velero_backup_success_total{schedule!=""} != 0)
741
741
  for: 5m
742
742
  labels:
743
743
  severity: warning
@@ -745,15 +745,15 @@ serverFiles:
745
745
  summary: "Velero schedule {{ $labels.schedule }} backup failed to execute properly"
746
746
  description: "It has been over 30 hours since the last successful backup"
747
747
  dashboard: "OVH:<MONITORING>/velero"
748
- - alert: NoVeleroBackups
749
- expr: velero_backup_success_total{schedule!=""} == 0
750
- for: 5m
751
- labels:
752
- severity: warning
753
- annotations:
754
- summary: "Velero has not made any backups yet"
755
- description: "Velero has been broken since cluster initialization because there is no successful backups around"
756
- dashboard: "OVH:<MONITORING>/velero"
748
+ # - alert: NoVeleroBackups
749
+ # expr: velero_backup_success_total{schedule!=""} == 0
750
+ # for: 5m
751
+ # labels:
752
+ # severity: warning
753
+ # annotations:
754
+ # summary: "Velero has not made any backups yet"
755
+ # description: "Velero has been broken since cluster initialization because there is no successful backups around"
756
+ # dashboard: "OVH:<MONITORING>/velero"
757
757
 
758
758
  server:
759
759
  affinity:
@@ -2,9 +2,9 @@
2
2
  # Backup schedules to create.
3
3
  #
4
4
  schedules:
5
- postgresql:
5
+ psql:
6
6
  disabled: false
7
- schedule: "0 2 * * *"
7
+ schedule: "0 7 * * *"
8
8
  template:
9
9
  ttl: "720h"
10
10
  snapshotVolumes: true
@@ -13,9 +13,9 @@ schedules:
13
13
  release: "postgres"
14
14
  app: "postgresql"
15
15
 
16
- timescale:
16
+ tsdb:
17
17
  disabled: false
18
- schedule: "0 3 * * *"
18
+ schedule: "0 8 * * *"
19
19
  template:
20
20
  ttl: "720h"
21
21
  snapshotVolumes: true
@@ -24,6 +24,12 @@ schedules:
24
24
  release: "timescale-db"
25
25
  app: "postgresql"
26
26
 
27
+ full:
28
+ disabled: false
29
+ schedule: "0 11 * * *"
30
+ template:
31
+ ttl: "168h"
32
+
27
33
  mysql:
28
34
  disabled: true
29
35
  schedule: "0 4 * * *"
@@ -69,7 +75,8 @@ labels: {}
69
75
 
70
76
  # Additional pod labels for Velero deployment's template. Optional
71
77
  # ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
72
- podLabels: {}
78
+ podLabels:
79
+ shedule-version: "2.0"
73
80
 
74
81
  # Tolerations to use for the Velero deployment. Optional.
75
82
  tolerations: []
@@ -2,8 +2,6 @@
2
2
 
3
3
  addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
4
4
 
5
- createNamespaceIfNeeded
6
-
7
5
  [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
8
6
  #
9
7
  # Build the bucket, region and SA email variables and use --set to mod the
@@ -17,6 +15,11 @@ GCE_BUCKET="$GCP_PROJECT_ID-velero-$VELERO_HELM_CHART"
17
15
  GCE_REGION=`overwhelm -k GCE_REGION`
18
16
  GCE_SA_EMAIL="velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com"
19
17
 
18
+ # Get rid of the previous schedules since we will be defining new schedules
19
+ # in the chart, otherwise any modified pod labels could end up attached to
20
+ # older metrics.
21
+ velero schedule delete --all --confirm &> /dev/null
22
+
20
23
  helm upgrade \
21
24
  --install velero vmware-tanzu/velero --namespace velero \
22
25
  --values velero/velero-local.yaml \
@@ -32,8 +35,8 @@ cat<<DONE_VELERO
32
35
 
33
36
  Wait at least 1 minute before kicking off the following backups:
34
37
 
35
- `color g 'velero backup create --from-schedule velero-postgresql'`
36
- `color g 'velero backup create --from-schedule velero-timescale'`
38
+ `color g 'velero backup create --from-schedule velero-psql'`
39
+ `color g 'velero backup create --from-schedule velero-tsdb'`
37
40
 
38
41
  This will create initial backups from the defined schedules which should
39
42
  avoid alerts from prometheus about backups failing on new installations.
package/src/unleash.js CHANGED
@@ -17,9 +17,20 @@ const getCurrentBranchName = async () => {
17
17
  }
18
18
 
19
19
  const isProtected = async () => {
20
- const protectedBranches = [ 'main', 'master', 'development', ...process.argv.slice( 2 ) ]
21
20
  const theBranch = await getCurrentBranchName()
22
- return protectedBranches.includes( theBranch )
21
+
22
+ const protectedBranches = [ 'main', 'master', 'development' ]
23
+ const additionalProtectedBranches = [ ...process.argv.slice( 2 ) ]
24
+
25
+ // Check if the current branch starts with any of the additional
26
+ // protected branch name
27
+ let matchesAdditionalBranch = false
28
+ for ( let i = 0; i < additionalProtectedBranches.length; i++ ) {
29
+ matchesAdditionalBranch = matchesAdditionalBranch ||
30
+ theBranch.startsWith( additionalProtectedBranches[i] )
31
+ }
32
+
33
+ return protectedBranches.includes( theBranch ) || matchesAdditionalBranch
23
34
  }
24
35
 
25
36
  const npmRunner = async ( script ) => {