@leverege/build-tools 2.47.3 → 2.47.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.47.3",
3
+ "version": "2.47.4",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -16,6 +16,7 @@
16
16
  "build-tools": "src/build-tools.mjs",
17
17
  "chart-to-registry": "src/chart-to-registry.mjs",
18
18
  "circleate": "src/circleate.sh",
19
+ "cnpg-snapshot": "src/cnpg-snapshot.mjs",
19
20
  "decrypt-secrets": "src/decrypt-secrets.sh",
20
21
  "dirty-git": "src/dirty-git.sh",
21
22
  "dockreate": "src/dockreate.sh",
@@ -71,6 +72,7 @@
71
72
  "readline-sync": "^1.4.10",
72
73
  "semver": "^7.6.0",
73
74
  "simple-git": "^3.22.0",
75
+ "tempy": "^3.1.0",
74
76
  "zx": "^7.2.3"
75
77
  },
76
78
  "devDependencies": {
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'node:fs'
4
+
5
+ import handlebars from 'handlebars'
6
+ import { temporaryFile } from 'tempy'
7
+
8
+ import {
9
+ getDateTimestamp,
10
+ debug,
11
+ shellCmd,
12
+ } from './Utils.mjs'
13
+
14
+ const backup = `
15
+ apiVersion: postgresql.cnpg.io/v1
16
+ kind: Backup
17
+ metadata:
18
+ name: {{clusterName}}-snapshot-{{dateTimestamp}}
19
+ namespace: cnpg-operands
20
+ labels:
21
+ cnpg-backup: manual
22
+ cnpg-operand: {{clusterName}}
23
+ spec:
24
+ method: volumeSnapshot
25
+ cluster:
26
+ name: {{clusterName}}`
27
+
28
+ const dateTimestamp = getDateTimestamp()
29
+ const clusterName = process.argv[2]
30
+ const compiled = handlebars.compile( backup )
31
+ const replaced = compiled( { dateTimestamp, clusterName } )
32
+ const tmpfile = temporaryFile()
33
+
34
+ debug( { replaced, tmpfile }, '<==Apply That' )
35
+
36
+ fs.writeFileSync( tmpfile, replaced )
37
+ await shellCmd( 'overwhelm' )
38
+ await shellCmd( `kubectl apply -f ${tmpfile}` )
@@ -1,3 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
- kubectl delete -f db-timescale-dense/db-timescale-dense.yaml $K8S_WHAT
3
+ printf "\nHibernating the db-timescale-dense cluster...\n"
4
+ kubectl cnpg hibernate on -n cnpg-operands db-timescale-dense
5
+
6
+ # *** DANGER ***
7
+ # kubectl delete will destroy the cluster
8
+ # *** DANGER ***
9
+ # kubectl delete -f db-timescale-dense/db-timescale-dense.yaml $K8S_WHAT