@leverege/build-tools 2.81.1 → 2.83.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.
- package/package.json +7 -7
- package/src/bash-funcs +21 -0
- package/src/bitnami-audit.mjs +169 -0
- package/src/bitnami-to-leverege-artifacts.sh +140 -0
- package/src/count-lines-of-code.mjs +6 -4
- package/src/crane-lift.sh +11 -0
- package/src/helm-charts/elasticsearch8/elasticsearch-local-dev.yaml +9 -0
- package/src/helm-charts/elasticsearch8/elasticsearch-local-prd.yaml +9 -0
- package/src/helm-charts/elasticsearch8/helmup.plugin +3 -3
- package/src/helm-charts/postgres/.nohelm +0 -0
- package/src/helm-charts/postgres/.nohelmdn +0 -0
- package/src/helm-charts/postgres/README.md +6 -0
- package/src/helm-charts/postgres/helmdn.plugin +3 -0
- package/src/helm-charts/postgres/helmup.plugin +21 -0
- package/src/helm-charts/postgres/postgres-local.yaml +51 -0
- package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +1 -1
- package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +2 -1
- package/src/helm-charts/redis/helmup.plugin +2 -2
- package/src/helm-charts/redis/values-local.yaml +14 -0
- package/src/helm-charts/traefik/helmup.plugin +1 -1
- package/src/helm-charts/valkey/helmup.plugin +3 -3
- package/src/helm-charts/valkey/valkey-local.yaml +11 -1
- package/src/helm-charts/velero/helmup.plugin +1 -1
- package/src/helmup.sh +22 -69
- package/src/k8x.sh +4 -0
- package/src/overwhelm.mjs +1 -1
- package/src/pg_repack/Dockerfile +37 -0
- package/src/pg_repack/README.md +6 -0
- package/src/pg_repack/build-repack-kubectl.sh +8 -0
- package/src/pg_repack/charts/repack/Chart.yaml +5 -0
- package/src/pg_repack/charts/repack/templates/_helpers.tpl +46 -0
- package/src/pg_repack/charts/repack/templates/configmap.yaml +8 -0
- package/src/pg_repack/charts/repack/templates/cronjob.yaml +33 -0
- package/src/pg_repack/charts/repack/templates/rbac.yaml +25 -0
- package/src/pg_repack/charts/repack/templates/secret.yaml +8 -0
- package/src/pg_repack/charts/repack/templates/serviceaccount.yaml +5 -0
- package/src/pg_repack/charts/repack/values.yaml +23 -0
- package/src/pg_repack/deploy.sh +3 -0
- package/src/pg_repack/quick.yaml +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.83.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@leverege/jsdoc-template": "^1.0.1",
|
|
68
|
-
"chalk": "^5.
|
|
68
|
+
"chalk": "^5.6.0",
|
|
69
69
|
"command-line-args": "^6.0.1",
|
|
70
70
|
"command-line-usage": "^7.0.3",
|
|
71
71
|
"commander": "^14.0.0",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"glob": "^11.0.3",
|
|
76
76
|
"handlebars": "^4.7.8",
|
|
77
77
|
"ignore": "^7.0.5",
|
|
78
|
-
"inquirer": "^12.9.
|
|
78
|
+
"inquirer": "^12.9.3",
|
|
79
79
|
"js-yaml": "^4.1.0",
|
|
80
80
|
"jsdoc": "^4.0.4",
|
|
81
81
|
"ms": "^2.1.3",
|
|
82
|
-
"npm-registry-fetch": "^
|
|
82
|
+
"npm-registry-fetch": "^19.0.0",
|
|
83
83
|
"ora": "^8.2.0",
|
|
84
|
-
"p-limit": "^
|
|
84
|
+
"p-limit": "^7.1.0",
|
|
85
85
|
"package-up": "^5.0.0",
|
|
86
86
|
"readline-sync": "^1.4.10",
|
|
87
87
|
"semver": "^7.7.2",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"simple-git": "^3.28.0",
|
|
90
90
|
"sloc": "^0.3.2",
|
|
91
91
|
"toml": "^3.0.0",
|
|
92
|
-
"zx": "^8.
|
|
92
|
+
"zx": "^8.8.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@leverege/eslint-config-leverege": "^5.0.1",
|
|
96
|
-
"npm": "^11.5.
|
|
96
|
+
"npm": "^11.5.2"
|
|
97
97
|
}
|
|
98
98
|
}
|
package/src/bash-funcs
CHANGED
|
@@ -149,6 +149,27 @@ REPOADD
|
|
|
149
149
|
helm repo update &> $DEVNULL
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
# *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
|
|
153
|
+
# *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
|
|
154
|
+
# *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
|
|
155
|
+
#
|
|
156
|
+
function addBitnamiRepoDEPRECATED() {
|
|
157
|
+
if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
|
|
158
|
+
then
|
|
159
|
+
BITNAMI_URL="https://charts.bitnami.com/bitnami"
|
|
160
|
+
else
|
|
161
|
+
cat<<CATNAMI
|
|
162
|
+
Using the pre 2022 legacy charts from bitnami. To use latest run:
|
|
163
|
+
|
|
164
|
+
`color y "BITNAMI_LATEST=1 $HELMUP_ARGS"`
|
|
165
|
+
|
|
166
|
+
CATNAMI
|
|
167
|
+
BITNAMI_URL="https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
addHelmRepo bitnami $BITNAMI_URL
|
|
171
|
+
}
|
|
172
|
+
|
|
152
173
|
function removeHelmRepo(){
|
|
153
174
|
[ ! -z "$SKIP_RM_HELM_REPO" ] && return
|
|
154
175
|
helm repo remove $1 &> $DEVNULL
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//
|
|
3
|
+
// This script is used to scan all of the projects in the auditProject array
|
|
4
|
+
// to look for any deployments that are still using the bitnami images. The
|
|
5
|
+
// output from this script can then be imported / upload / replace existing in
|
|
6
|
+
// the BitnamiImageRegistry gsheet to show progess on the migration effort.
|
|
7
|
+
//
|
|
8
|
+
import fs from 'node:fs'
|
|
9
|
+
import chalk from 'chalk'
|
|
10
|
+
import semver from 'semver'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
debug,
|
|
14
|
+
log,
|
|
15
|
+
shellCmd,
|
|
16
|
+
} from './Utils.mjs'
|
|
17
|
+
|
|
18
|
+
const auditProjects = [
|
|
19
|
+
'dev-controltek',
|
|
20
|
+
'dev-cox-health',
|
|
21
|
+
'dev-pitcrew',
|
|
22
|
+
'xxx-bogus', // expect warning
|
|
23
|
+
'dev-recovr-auto',
|
|
24
|
+
'dev-schnucks',
|
|
25
|
+
'dev-tpi',
|
|
26
|
+
'discount-tire-prd',
|
|
27
|
+
'discount-tire-stg',
|
|
28
|
+
'leverege-cnpg-20240729',
|
|
29
|
+
'leverege-ops-20250730',
|
|
30
|
+
'leverege-demo', // expect warning
|
|
31
|
+
'leverege-elastic',
|
|
32
|
+
'leverege-onboarding',
|
|
33
|
+
'leverege-sandbox',
|
|
34
|
+
'nimbelink-demo',
|
|
35
|
+
'prd-controltek',
|
|
36
|
+
'prd-cox-health',
|
|
37
|
+
'prd-generic-kudelski',
|
|
38
|
+
'prd-les-schwab',
|
|
39
|
+
'prd-recovr-auto',
|
|
40
|
+
'prd-skymirr',
|
|
41
|
+
'prd-tpi',
|
|
42
|
+
'prd-valvoline',
|
|
43
|
+
'qa-cox-health', // expect warning
|
|
44
|
+
'siren-marine-dev',
|
|
45
|
+
'siren-marine-prd',
|
|
46
|
+
'siren-marine-staging',
|
|
47
|
+
'siren-marine-test',
|
|
48
|
+
'stg-cox-health',
|
|
49
|
+
'stg-generic-kudelski',
|
|
50
|
+
'stg-recovr-auto',
|
|
51
|
+
'stg-recovr-perf',
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
const gitCheckoutCleanBranch = async ( branch = 'bootstrap-k8s' ) => {
|
|
55
|
+
// find and remove cruft, like generated values.yaml files
|
|
56
|
+
await shellCmd( 'find . -not \\( -path \\*junk -prune -o -path \\*helm-elasticsearch -prune \\) -name values.yaml -exec rm {} \\;' )
|
|
57
|
+
|
|
58
|
+
// start with a clean baseline
|
|
59
|
+
await shellCmd( 'git checkout bootstrap-k8s' )
|
|
60
|
+
await shellCmd( 'git clean -d --force' )
|
|
61
|
+
|
|
62
|
+
// checkout the target branch
|
|
63
|
+
await shellCmd( `git checkout ${branch}` )
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const setK8sContext = async ( project ) => {
|
|
67
|
+
await shellCmd( 'overwhelm --fetchctx' )
|
|
68
|
+
await shellCmd( 'overwhelm --matchk8s' )
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const prepareContext = async ( project ) => {
|
|
72
|
+
await gitCheckoutCleanBranch( project )
|
|
73
|
+
await setK8sContext( project )
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const filterBitnamiImages = ( project, imagesJSON ) => {
|
|
77
|
+
const data = JSON.parse( imagesJSON )
|
|
78
|
+
const seen = new Set()
|
|
79
|
+
|
|
80
|
+
for ( const item of data.items ) {
|
|
81
|
+
const ns = item.metadata.namespace
|
|
82
|
+
let service = item.metadata.name
|
|
83
|
+
|
|
84
|
+
// Collapse services
|
|
85
|
+
service = service.replace( /elasticsearch8-(coordinating|data|master|ingest)/, 'elasticsearch' )
|
|
86
|
+
service = service.replace( /redis-(master|replicas)/, 'redis' )
|
|
87
|
+
service = service.replace( /valkey-(primary|replicas)/, 'valkey' )
|
|
88
|
+
|
|
89
|
+
const containers = item.spec?.template?.spec?.containers || []
|
|
90
|
+
for ( const c of containers ) {
|
|
91
|
+
let img = c.image
|
|
92
|
+
|
|
93
|
+
// Only keep bitnami images
|
|
94
|
+
if ( !/bitnami/.test( img ) ) continue
|
|
95
|
+
|
|
96
|
+
// Registry decluttering
|
|
97
|
+
img = img.replace( /^docker\.io\/bitnami/, 'bitnami' )
|
|
98
|
+
img = img.replace( /^us-docker\.pkg\.dev\/leverege-registry\/bitnami-mirror\/images/, 'leverege' )
|
|
99
|
+
img = img.replace( /^us-docker\.pkg\.dev\/leverege-registry\/system\/images/, 'leverege/system' )
|
|
100
|
+
|
|
101
|
+
const [ image, fullVersion = 'latest' ] = img.split( ':' )
|
|
102
|
+
const displayVersion = fullVersion.replace( /-debian-.*$/, '' )
|
|
103
|
+
|
|
104
|
+
const row = [ project, ns, service, image, displayVersion, fullVersion ].join( ',' )
|
|
105
|
+
if ( !seen.has( row ) ) {
|
|
106
|
+
debug( row )
|
|
107
|
+
seen.add( row )
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return seen
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const imageSummary = new Map()
|
|
115
|
+
|
|
116
|
+
const runner = async ( projects ) => {
|
|
117
|
+
const CSV_FILE = '../BitnamiImageRegistry.csv'
|
|
118
|
+
const fd = fs.openSync( CSV_FILE, 'w' )
|
|
119
|
+
fs.writeSync( fd, 'Project,Namespace,Service,Image,Version,Tag\n' )
|
|
120
|
+
|
|
121
|
+
for ( const project of projects ) {
|
|
122
|
+
log( `Project [${project}]` )
|
|
123
|
+
try {
|
|
124
|
+
await prepareContext( project ) // eslint-disable-line no-await-in-loop
|
|
125
|
+
} catch ( error ) {
|
|
126
|
+
log( `Project or context is invalid, skipping [${chalk.redBright( project )}]` )
|
|
127
|
+
continue
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line no-await-in-loop
|
|
131
|
+
const k8sImageDump = await shellCmd( 'kubectl get deploy,statefulset -A -o json' )
|
|
132
|
+
const bitnamiImages = filterBitnamiImages( project, k8sImageDump )
|
|
133
|
+
|
|
134
|
+
for ( const line of bitnamiImages ) {
|
|
135
|
+
fs.writeSync( fd, `${line}\n` )
|
|
136
|
+
|
|
137
|
+
const [ , , , image, version, tag ] = line.split( ',' )
|
|
138
|
+
if ( /^leverege/.test( image ) ) continue // we don't need leverege in the summary
|
|
139
|
+
|
|
140
|
+
if ( !imageSummary.has( image ) ) {
|
|
141
|
+
imageSummary.set( image, { version : new Set(), tag : new Set() } )
|
|
142
|
+
}
|
|
143
|
+
imageSummary.get( image ).version.add( version )
|
|
144
|
+
imageSummary.get( image ).tag.add( tag )
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
fs.closeSync( fd )
|
|
148
|
+
|
|
149
|
+
log( '\n==== Bitnami Image Summary ====\n' )
|
|
150
|
+
|
|
151
|
+
log( 'IMAGES=(' )
|
|
152
|
+
|
|
153
|
+
for ( const [ image, { tag, version } ] of imageSummary.entries() ) {
|
|
154
|
+
const sortedTags = Array.from( tag ).sort( semver.rcompare )
|
|
155
|
+
for ( const t of sortedTags.slice( 0, 15 ) ) {
|
|
156
|
+
log( ` "${image}:${t}"` )
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Optional: also log a human-friendly display version list
|
|
160
|
+
const sortedVersions = Array.from( version ).sort( semver.rcompare )
|
|
161
|
+
log( ` # Display versions: ${sortedVersions.join( ', ' )}` )
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
log( ')' )
|
|
165
|
+
|
|
166
|
+
gitCheckoutCleanBranch() // back to clean bootstrap-k8s
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
await runner( auditProjects )
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# This script was used to bootstrap the leverege-registry bitnmai-mirror
|
|
4
|
+
# folder with initial images and charts needed for the migration away from
|
|
5
|
+
# bitnami. I left it here as an artifact and can be deleted once the entire
|
|
6
|
+
# migration is complete.
|
|
7
|
+
#
|
|
8
|
+
# CONFIGURATION
|
|
9
|
+
PROJECT_ID="leverege-registry"
|
|
10
|
+
REGION="us" # adjust if needed
|
|
11
|
+
MIRROR_ROOT="${REGION}-docker.pkg.dev/${PROJECT_ID}/bitnami-mirror"
|
|
12
|
+
DOCKER_PREFIX="${MIRROR_ROOT}/images"
|
|
13
|
+
CHARTS_PREFIX="oci://${MIRROR_ROOT}/charts"
|
|
14
|
+
|
|
15
|
+
# Images to mirror
|
|
16
|
+
IMAGES=(
|
|
17
|
+
"bitnami/postgresql:11.14.0-debian-10-r28"
|
|
18
|
+
"bitnami/postgresql:11.7.0-debian-10-r99"
|
|
19
|
+
# Display versions: 11.14.0, 11.7.0
|
|
20
|
+
"bitnami/postgres-exporter:0.10.0-debian-10-r172"
|
|
21
|
+
"bitnami/postgres-exporter:0.8.0-debian-10-r106"
|
|
22
|
+
# Display versions: 0.10.0, 0.8.0
|
|
23
|
+
"bitnami/redis:7.4.3-debian-12-r0"
|
|
24
|
+
"bitnami/redis:7.4.2-debian-12-r2"
|
|
25
|
+
"bitnami/redis:7.4.1-debian-12-r0"
|
|
26
|
+
"bitnami/redis:7.2.5-debian-12-r2"
|
|
27
|
+
"bitnami/redis:7.2.5-debian-12-r0"
|
|
28
|
+
"bitnami/redis:7.2.4-debian-12-r12"
|
|
29
|
+
"bitnami/redis:7.2.3-debian-11-r1"
|
|
30
|
+
"bitnami/redis:7.0.12-debian-11-r34"
|
|
31
|
+
"bitnami/redis:7.0.11-debian-11-r12"
|
|
32
|
+
"bitnami/redis:7.0.8-debian-11-r0"
|
|
33
|
+
"bitnami/redis:6.2.1-debian-10-r36"
|
|
34
|
+
"bitnami/redis:6.0.3-debian-10-r2"
|
|
35
|
+
# Display versions: 7.4.3, 7.4.2, 7.4.1, 7.2.5, 7.2.4, 7.2.3, 7.0.12, 7.0.11, 7.0.8, 6.2.1, 6.0.3
|
|
36
|
+
"bitnami/redis-exporter:1.70.0-debian-12-r2"
|
|
37
|
+
"bitnami/redis-exporter:1.67.0-debian-12-r7"
|
|
38
|
+
"bitnami/redis-exporter:1.63.0-debian-12-r1"
|
|
39
|
+
"bitnami/redis-exporter:1.61.0-debian-12-r2"
|
|
40
|
+
"bitnami/redis-exporter:1.61.0-debian-12-r0"
|
|
41
|
+
"bitnami/redis-exporter:1.58.0-debian-12-r7"
|
|
42
|
+
"bitnami/redis-exporter:1.55.0-debian-11-r2"
|
|
43
|
+
"bitnami/redis-exporter:1.52.0-debian-11-r25"
|
|
44
|
+
"bitnami/redis-exporter:1.50.0-debian-11-r13"
|
|
45
|
+
"bitnami/redis-exporter:1.45.0-debian-11-r26"
|
|
46
|
+
"bitnami/redis-exporter:1.20.0-debian-10-r16"
|
|
47
|
+
"bitnami/redis-exporter:1.6.1-debian-10-r7"
|
|
48
|
+
# Display versions: 1.70.0, 1.67.0, 1.63.0, 1.61.0, 1.58.0, 1.55.0, 1.52.0, 1.50.0, 1.45.0, 1.20.0, 1.6.1
|
|
49
|
+
"bitnami/elasticsearch:8.18.0-debian-12-r2"
|
|
50
|
+
"bitnami/elasticsearch:8.17.3-debian-12-r0"
|
|
51
|
+
"bitnami/elasticsearch:8.16.1-debian-12-r0"
|
|
52
|
+
"bitnami/elasticsearch:8.15.2-debian-12-r2"
|
|
53
|
+
"bitnami/elasticsearch:8.12.2-debian-12-r0"
|
|
54
|
+
"bitnami/elasticsearch:8.12.1-debian-11-r2"
|
|
55
|
+
"bitnami/elasticsearch:8.12.1-debian-11-r1"
|
|
56
|
+
"bitnami/elasticsearch:8.12.0-debian-11-r1"
|
|
57
|
+
"bitnami/elasticsearch:8.11.1-debian-11-r0"
|
|
58
|
+
"bitnami/elasticsearch:8.10.3-debian-11-r1"
|
|
59
|
+
"bitnami/elasticsearch:8.9.1-debian-11-r2"
|
|
60
|
+
# Display versions: 8.18.0, 8.17.3, 8.16.1, 8.15.2, 8.12.2, 8.12.1, 8.12.0, 8.11.1, 8.10.3, 8.9.1
|
|
61
|
+
"bitnami/sealed-secrets-controller:0.29.0-debian-12-r1"
|
|
62
|
+
"bitnami/valkey:8.1.3-debian-12-r1"
|
|
63
|
+
# Display versions: 8.1.30
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Charts to mirror (chart:version)
|
|
67
|
+
CHARTS=(
|
|
68
|
+
"bitnamicharts/elasticsearch:22.1.0"
|
|
69
|
+
"bitnamicharts/elasticsearch:21.6.3"
|
|
70
|
+
"bitnamicharts/elasticsearch:21.3.20"
|
|
71
|
+
"bitnamicharts/elasticsearch:19.17.6"
|
|
72
|
+
# "bitnamicharts/postgresql:10.16.2" # pulled manually from ancient bitnami source
|
|
73
|
+
"bitnamicharts/redis:20.13.4"
|
|
74
|
+
"bitnamicharts/valkey:3.0.22"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
echo "🔑 Authenticating to Artifact Registry..."
|
|
78
|
+
gcloud auth configure-docker ${REGION}-docker.pkg.dev -q &> /dev/null
|
|
79
|
+
gcloud auth application-default print-access-token | helm registry login \
|
|
80
|
+
-u oauth2accesstoken --password-stdin ${REGION}-docker.pkg.dev
|
|
81
|
+
|
|
82
|
+
echo "📦 Ensuring Artifact Registry repos exist..."
|
|
83
|
+
gcloud artifacts repositories create bitnami-mirror \
|
|
84
|
+
--repository-format=docker \
|
|
85
|
+
--location=${REGION} \
|
|
86
|
+
--project=${PROJECT_ID} \
|
|
87
|
+
--description="Mirror of Bitnami images/charts" &> /dev/null \
|
|
88
|
+
|| echo "✅ Docker repo already exists."
|
|
89
|
+
|
|
90
|
+
# Check if crane is available (brew install crane)
|
|
91
|
+
if command -v crane &>/dev/null;
|
|
92
|
+
then
|
|
93
|
+
echo "🚀 Using crane for image copies (fast + multi-arch safe)"
|
|
94
|
+
USE_CRANE=true
|
|
95
|
+
else
|
|
96
|
+
echo "🐳 crane not found, falling back to Docker CLI"
|
|
97
|
+
USE_CRANE=false
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
echo "⬇️ Pulling & pushing container images..."
|
|
101
|
+
for IMAGE in "${IMAGES[@]}"; do
|
|
102
|
+
SRC_IMAGE="docker.io/${IMAGE}"
|
|
103
|
+
NAME=$(echo "${IMAGE}" | cut -d: -f1 | awk -F/ '{print $NF}')
|
|
104
|
+
TAG=$(echo "${IMAGE}" | cut -d: -f2)
|
|
105
|
+
DEST_IMAGE="${DOCKER_PREFIX}/${NAME}:${TAG}"
|
|
106
|
+
|
|
107
|
+
echo "Mirroring ${SRC_IMAGE} → ${DEST_IMAGE}"
|
|
108
|
+
|
|
109
|
+
if [ "$USE_CRANE" = true ];
|
|
110
|
+
then
|
|
111
|
+
# crane copies the whole manifest list (multi-arch safe)
|
|
112
|
+
cat<<CRANE_CAT
|
|
113
|
+
crane copy "${SRC_IMAGE}" "${DEST_IMAGE}"
|
|
114
|
+
CRANE_CAT
|
|
115
|
+
crane copy "${SRC_IMAGE}" "${DEST_IMAGE}"
|
|
116
|
+
else
|
|
117
|
+
docker pull --platform linux/amd64 "${SRC_IMAGE}"
|
|
118
|
+
docker tag "${SRC_IMAGE}" "${DEST_IMAGE}"
|
|
119
|
+
docker push "${DEST_IMAGE}"
|
|
120
|
+
|
|
121
|
+
# clean up local docker - the || true ensures the script won’t fail if the
|
|
122
|
+
# image was already removed or the tag isn’t present
|
|
123
|
+
docker rmi -f "${SRC_IMAGE}" "${DEST_IMAGE}" || true
|
|
124
|
+
fi
|
|
125
|
+
done
|
|
126
|
+
|
|
127
|
+
echo "⬇️ Pulling & pushing Helm charts..."
|
|
128
|
+
for ENTRY in "${CHARTS[@]}"; do
|
|
129
|
+
CHART=$(echo $ENTRY | cut -d: -f1)
|
|
130
|
+
VERSION=$(echo $ENTRY | cut -d: -f2)
|
|
131
|
+
echo "Mirroring chart ${CHART}:${VERSION}"
|
|
132
|
+
#cat<<CHART_MOVER
|
|
133
|
+
helm pull oci://registry-1.docker.io/${CHART} --version ${VERSION}
|
|
134
|
+
CHART_TARBALL=$(basename ${CHART})-${VERSION}.tgz
|
|
135
|
+
helm push "${CHART_TARBALL}" ${CHARTS_PREFIX}
|
|
136
|
+
rm -f "${CHART_TARBALL}"
|
|
137
|
+
#CHART_MOVER
|
|
138
|
+
done
|
|
139
|
+
|
|
140
|
+
echo "✅ Mirror complete."
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { $, fs, chalk, argv } from 'zx'
|
|
4
4
|
|
|
5
|
+
import { log } from './Utils.mjs'
|
|
6
|
+
|
|
5
7
|
const srcOnly = argv.srcOnly
|
|
6
8
|
|
|
7
9
|
const $$ = $( {
|
|
@@ -21,10 +23,10 @@ if ( !hasWorkspace ) {
|
|
|
21
23
|
for ( let i = 0; i < dirs.length; i++ ) {
|
|
22
24
|
const dir = dirs[i]
|
|
23
25
|
|
|
24
|
-
await getLinesOfCodeForDirectory( path.join( rootDir, 'packages', dir ) )
|
|
26
|
+
await getLinesOfCodeForDirectory( path.join( rootDir, 'packages', dir ) ) // eslint-disable-line no-await-in-loop
|
|
25
27
|
}
|
|
26
28
|
} else {
|
|
27
|
-
|
|
29
|
+
log( chalk.redBright( 'No workspace directories for which to count code' ) )
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -33,13 +35,13 @@ async function getLinesOfCodeForDirectory( directory ) {
|
|
|
33
35
|
const hasSrc = await fs.exists( srcDir )
|
|
34
36
|
|
|
35
37
|
if ( hasSrc ) {
|
|
36
|
-
|
|
38
|
+
log( `${chalk.greenBright( srcOnly ? srcDir : directory )}:` )
|
|
37
39
|
if ( srcOnly ) {
|
|
38
40
|
await $$`sloc ${srcDir} --format cli-table`
|
|
39
41
|
} else {
|
|
40
42
|
await $$`sloc ${directory} --format cli-table -i '^(src|test)/.*' -e node_modules`
|
|
41
43
|
}
|
|
42
44
|
} else {
|
|
43
|
-
|
|
45
|
+
log( chalk.redBright( `No src directory at ${directory}` ) )
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# just a simple wrapper round crane docker lifter
|
|
4
|
+
#
|
|
5
|
+
IMAGE_WITH_TAG="${1}" # like valkey:8.1.3-debian-12-r1
|
|
6
|
+
|
|
7
|
+
REGISTRY_LEVEREGE="us-docker.pkg.dev/leverege-registry/bitnami-mirror/images"
|
|
8
|
+
REGISTRY_BITNAMI="docker.io/bitnami"
|
|
9
|
+
|
|
10
|
+
crane copy "${REGISTRY_BITNAMI}/${IMAGE_WITH_TAG}" \
|
|
11
|
+
"${REGISTRY_LEVEREGE}"/${IMAGE_WITH_TAG}"
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
# for each of the 4 ES node types in the cluster. See prd-recovr-auto for an
|
|
9
9
|
# example of a big beefy system.
|
|
10
10
|
#
|
|
11
|
+
# Moves us away from bitnami hosted charts/images
|
|
12
|
+
#
|
|
13
|
+
image:
|
|
14
|
+
registry: us-docker.pkg.dev
|
|
15
|
+
repository: leverege-registry/bitnami-mirror/images/elasticsearch
|
|
16
|
+
# tag: 8.18.0
|
|
17
|
+
|
|
11
18
|
global:
|
|
19
|
+
security:
|
|
20
|
+
allowInsecureImages: true
|
|
12
21
|
storageClass: "ssd"
|
|
13
22
|
|
|
14
23
|
fullnameOverride: "elasticsearch8"
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
# for each of the 4 ES node types in the cluster. See prd-recovr-auto for an
|
|
9
9
|
# example of a big beefy system.
|
|
10
10
|
#
|
|
11
|
+
# Moves us away from bitnami hosted charts/images
|
|
12
|
+
#
|
|
13
|
+
image:
|
|
14
|
+
registry: us-docker.pkg.dev
|
|
15
|
+
repository: leverege-registry/bitnami-mirror/images/elasticsearch
|
|
16
|
+
# tag: 8.18.0
|
|
17
|
+
|
|
11
18
|
global:
|
|
19
|
+
security:
|
|
20
|
+
allowInsecureImages: true
|
|
12
21
|
storageClass: "ssd"
|
|
13
22
|
|
|
14
23
|
fullnameOverride: "elasticsearch8"
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
#
|
|
3
3
|
showInstalling "Elastic Search 8"
|
|
4
4
|
|
|
5
|
+
OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/elasticsearch"
|
|
6
|
+
|
|
5
7
|
# *** WARNING TO FUTURE SELF *** v22 of the chart is ES v9!!!
|
|
6
8
|
[ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.6.3"
|
|
7
9
|
|
|
8
|
-
OCI_CHART="oci://registry-1.docker.io/bitnamicharts/elasticsearch"
|
|
9
|
-
|
|
10
10
|
LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-dev.yaml"
|
|
11
11
|
#LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-prd.yaml"
|
|
12
12
|
[ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
|
|
@@ -14,4 +14,4 @@ LOCAL_ES_VALUES="elasticsearch8/elasticsearch-local-dev.yaml"
|
|
|
14
14
|
helm upgrade --install elasticsearch8 $OCI_CHART \
|
|
15
15
|
--namespace elastic --create-namespace \
|
|
16
16
|
--values $LOCAL_ES_VALUES \
|
|
17
|
-
--version $ELASTIC_CHART_VERSION $HELM_WHAT
|
|
17
|
+
--version $ELASTIC_CHART_VERSION $HELM_WHAT
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
## Legacy PostgreSQL 11
|
|
2
|
+
|
|
3
|
+
This configuration was temporarily resurrected for supporting the bitnami
|
|
4
|
+
migrations. There are still quite a few legacy deployments using this
|
|
5
|
+
ancient psql approach. We use this config to point the servers at the Leverege
|
|
6
|
+
artifact registry for the mirrored bitnami images.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
showInstalling "PostgreSQL Database (legacy)"
|
|
4
|
+
|
|
5
|
+
errorIfMissingSecret authz-postgres
|
|
6
|
+
|
|
7
|
+
OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/postgresql"
|
|
8
|
+
|
|
9
|
+
[ -z "$PSQL_CHART_VERSION" ] && PSQL_CHART_VERSION="10.16.2"
|
|
10
|
+
|
|
11
|
+
helm upgrade --install postgres $OCI_CHART \
|
|
12
|
+
--values postgres/postgres-local.yaml \
|
|
13
|
+
--version $PSQL_CHART_VERSION $HELM_WHAT
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# legacy
|
|
17
|
+
#helm upgrade --install postgres bitnami/postgresql \
|
|
18
|
+
# --values postgres/postgres-local.yaml \
|
|
19
|
+
# --version 10 $HELM_WHAT
|
|
20
|
+
#
|
|
21
|
+
#removeHelmRepo bitnami
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Moves us away from bitnami hosted charts/images
|
|
2
|
+
#
|
|
3
|
+
image:
|
|
4
|
+
registry: us-docker.pkg.dev
|
|
5
|
+
repository: leverege-registry/system/images/leverege-pgsql11-repack-kubectl
|
|
6
|
+
tag: 11.14-kctl.3
|
|
7
|
+
|
|
8
|
+
postgresqlExtendedConf:
|
|
9
|
+
maxWorkerProcesses: 4
|
|
10
|
+
maxParallelWorkers: 4
|
|
11
|
+
maxConnections: 500
|
|
12
|
+
shared_buffers: 1GB
|
|
13
|
+
effectiveCacheSize: 4GB
|
|
14
|
+
maintenanceWorkMem: 1GB
|
|
15
|
+
workMem: 10MB
|
|
16
|
+
|
|
17
|
+
persistence:
|
|
18
|
+
storageClass: "ssd"
|
|
19
|
+
# size: 16Gi # default 8Gi
|
|
20
|
+
|
|
21
|
+
resources:
|
|
22
|
+
requests:
|
|
23
|
+
memory: 1Gi
|
|
24
|
+
cpu: 750m
|
|
25
|
+
|
|
26
|
+
postgresqlDatabase: authz
|
|
27
|
+
existingSecret: authz-postgres
|
|
28
|
+
|
|
29
|
+
metrics:
|
|
30
|
+
enabled: true
|
|
31
|
+
image:
|
|
32
|
+
registry: us-docker.pkg.dev
|
|
33
|
+
repository: leverege-registry/bitnami-mirror/images/postgres-exporter
|
|
34
|
+
# tag: 0.10.0-debian-10-r172
|
|
35
|
+
|
|
36
|
+
primary:
|
|
37
|
+
tolerations:
|
|
38
|
+
- key: "database"
|
|
39
|
+
operator: "Equal"
|
|
40
|
+
value: "true"
|
|
41
|
+
effect: "NoSchedule"
|
|
42
|
+
|
|
43
|
+
affinity:
|
|
44
|
+
nodeAffinity:
|
|
45
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
46
|
+
nodeSelectorTerms:
|
|
47
|
+
- matchExpressions:
|
|
48
|
+
- key: target-env
|
|
49
|
+
operator: In
|
|
50
|
+
values:
|
|
51
|
+
- database
|
|
@@ -229,7 +229,7 @@ spec:
|
|
|
229
229
|
LABELS = {{ $labels }}
|
|
230
230
|
- alert: KubernetesReplicasetReplicasMismatch
|
|
231
231
|
expr: kube_replicaset_spec_replicas != kube_replicaset_status_ready_replicas
|
|
232
|
-
for: 10m
|
|
232
|
+
for: 15m # awesome was => 10m
|
|
233
233
|
labels:
|
|
234
234
|
severity: warning
|
|
235
235
|
annotations:
|
|
@@ -34,7 +34,8 @@ stackdriver:
|
|
|
34
34
|
serviceMonitor:
|
|
35
35
|
enabled: true
|
|
36
36
|
namespace: prometheus
|
|
37
|
-
interval: "
|
|
37
|
+
interval: "60s" # Align with Stackdriver's 60s data resolution
|
|
38
|
+
# honorTimestamps: false # Avoid duplicate timestamp conflicts (eliminates dup timestamps?)
|
|
38
39
|
relabelings:
|
|
39
40
|
# Legacy labelmap used to preserve compatibility with pre-operator Grafana dashboards
|
|
40
41
|
# Can be removed once legacy Prometheus stack is deprecated
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
showInstalling "Redis"
|
|
4
4
|
|
|
5
|
-
OCI_CHART="oci://
|
|
5
|
+
OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/redis"
|
|
6
6
|
|
|
7
7
|
[ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.13.4"
|
|
8
8
|
|
|
9
|
-
helm upgrade --install redis $OCI_CHART
|
|
9
|
+
helm upgrade --install redis $OCI_CHART \
|
|
10
10
|
--values redis/values-local.yaml \
|
|
11
11
|
--version $REDIS_CHART_VERSION $HELM_WHAT
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Moves us away from bitnami hosted charts/images
|
|
3
|
+
#
|
|
4
|
+
image:
|
|
5
|
+
registry: us-docker.pkg.dev
|
|
6
|
+
repository: leverege-registry/bitnami-mirror/images/redis
|
|
7
|
+
# tag: 7.4.3-debian-12-r0
|
|
8
|
+
|
|
1
9
|
global:
|
|
10
|
+
security: # this allows us to use local images
|
|
11
|
+
allowInsecureImages: true
|
|
2
12
|
storageClass: ssd
|
|
3
13
|
|
|
4
14
|
auth:
|
|
@@ -70,6 +80,10 @@ networkPolicy:
|
|
|
70
80
|
|
|
71
81
|
metrics:
|
|
72
82
|
enabled: true
|
|
83
|
+
image:
|
|
84
|
+
registry: us-docker.pkg.dev
|
|
85
|
+
repository: leverege-registry/bitnami-mirror/images/redis-exporter
|
|
86
|
+
# tag: 1.74.0-debian-12-r2
|
|
73
87
|
serviceMonitor:
|
|
74
88
|
enabled: true # set to true for prometheus operator
|
|
75
89
|
namespace: "prometheus"
|
|
@@ -17,7 +17,7 @@ TRAEFIK_NAMESPACE="traefik"
|
|
|
17
17
|
|
|
18
18
|
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
19
19
|
|
|
20
|
-
[ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="
|
|
20
|
+
[ -z "$TRAEFIK_CHART_VERSION" ] && TRAEFIK_CHART_VERSION="37"
|
|
21
21
|
helm upgrade --install traefik traefik/traefik \
|
|
22
22
|
--namespace $TRAEFIK_NAMESPACE --create-namespace \
|
|
23
23
|
--values traefik/values.yaml \
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
showInstalling "Valkey"
|
|
4
4
|
|
|
5
|
-
OCI_CHART="oci://
|
|
5
|
+
OCI_CHART="oci://us-docker.pkg.dev/leverege-registry/bitnami-mirror/charts/valkey"
|
|
6
6
|
|
|
7
|
-
[ -z "$VALKEY_CHART_VERSION" ] && VALKEY_CHART_VERSION="
|
|
7
|
+
[ -z "$VALKEY_CHART_VERSION" ] && VALKEY_CHART_VERSION="3.0.22"
|
|
8
8
|
|
|
9
|
-
helm upgrade --install valkey $OCI_CHART
|
|
9
|
+
helm upgrade --install valkey $OCI_CHART \
|
|
10
10
|
--values valkey/valkey-local.yaml \
|
|
11
11
|
--version $VALKEY_CHART_VERSION $HELM_WHAT
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
image:
|
|
2
|
+
registry: us-docker.pkg.dev
|
|
3
|
+
repository: leverege-registry/bitnami-mirror/images/valkey
|
|
4
|
+
# tag: 8.1.3-devian-12-r1
|
|
1
5
|
|
|
2
6
|
global:
|
|
7
|
+
security:
|
|
8
|
+
allowInsecureImages: true
|
|
3
9
|
storageClass: "ssd"
|
|
4
10
|
|
|
5
11
|
architecture: replication
|
|
@@ -11,7 +17,7 @@ auth:
|
|
|
11
17
|
primary:
|
|
12
18
|
replicaCount: 1
|
|
13
19
|
|
|
14
|
-
resourcesPreset: "
|
|
20
|
+
resourcesPreset: "small"
|
|
15
21
|
resources:
|
|
16
22
|
requests:
|
|
17
23
|
cpu: 250m
|
|
@@ -77,6 +83,10 @@ sentinel:
|
|
|
77
83
|
|
|
78
84
|
metrics:
|
|
79
85
|
enabled: true
|
|
86
|
+
image:
|
|
87
|
+
registry: us-docker.pkg.dev
|
|
88
|
+
repository: leverege-registry/bitnami-mirror/images/redis-exporter
|
|
89
|
+
# tag: 1.74.0-debian-12-r2
|
|
80
90
|
serviceMonitor:
|
|
81
91
|
enabled: true
|
|
82
92
|
namespace: "prometheus"
|
|
@@ -7,7 +7,7 @@ addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
|
7
7
|
[ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="10"
|
|
8
8
|
#
|
|
9
9
|
# Build the bucket, region and SA email variables and use --set to mod the
|
|
10
|
-
# chart values as opposed to using an
|
|
10
|
+
# chart values as opposed to using an ${label} approach. This eliminates
|
|
11
11
|
# the need for an overwhelm generated values.yaml file which also contains
|
|
12
12
|
# all of the contamination from the default-values.yaml file.
|
|
13
13
|
#
|
package/src/helmup.sh
CHANGED
|
@@ -83,25 +83,6 @@ function isLeveregeService() {
|
|
|
83
83
|
echo $answer
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
# audit trail via slack
|
|
87
|
-
# support for legacy bitnami charts
|
|
88
|
-
function addBitnamiRepo() {
|
|
89
|
-
if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
|
|
90
|
-
then
|
|
91
|
-
BITNAMI_URL="https://charts.bitnami.com/bitnami"
|
|
92
|
-
else
|
|
93
|
-
cat<<CATNAMI
|
|
94
|
-
Using the pre 2022 legacy charts from bitnami. To use latest run:
|
|
95
|
-
|
|
96
|
-
`color y "BITNAMI_LATEST=1 $HELMUP_ARGS"`
|
|
97
|
-
|
|
98
|
-
CATNAMI
|
|
99
|
-
BITNAMI_URL="https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami"
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
addHelmRepo bitnami $BITNAMI_URL
|
|
103
|
-
}
|
|
104
|
-
|
|
105
86
|
# Accepts 3 paramaters - 1 mandatory.
|
|
106
87
|
# bindWorkloadIdentity <Service Account> <Namespace> <Target Service Account>
|
|
107
88
|
# where:
|
|
@@ -265,6 +246,22 @@ SERVICE_BOOTSTRAP
|
|
|
265
246
|
ifPluggedIn $SERVICE
|
|
266
247
|
}
|
|
267
248
|
|
|
249
|
+
# If the service is already plugged in the go - otherwise if this is a first
|
|
250
|
+
# time install of a known service then bootstrap it and go. Otherwise return
|
|
251
|
+
# a status of 1 to indicate to continue processing.
|
|
252
|
+
function ifPluggedInOrBootstrapped() {
|
|
253
|
+
local svc_name="$1"
|
|
254
|
+
|
|
255
|
+
ifPluggedIn $svc_name && return 0 # if it's already plugged in then go
|
|
256
|
+
|
|
257
|
+
# check to see if build-tools knows about the new service in its configs
|
|
258
|
+
local svc_plugin="$(build-tools --reporoot)/src/helm-charts/${svc_name}/helmup.plugin"
|
|
259
|
+
[[ ! -x "$svc_plugin" ]] && return 1 # indicates unknown
|
|
260
|
+
|
|
261
|
+
bootstrapLocalSetup $svc_name
|
|
262
|
+
return 0
|
|
263
|
+
}
|
|
264
|
+
|
|
268
265
|
function installDefaultConfigs() {
|
|
269
266
|
showInstalling "Default Configs"
|
|
270
267
|
|
|
@@ -387,7 +384,7 @@ spec:
|
|
|
387
384
|
containers:
|
|
388
385
|
- name: cron-zombie-killer
|
|
389
386
|
imagePullPolicy: IfNotPresent
|
|
390
|
-
image:
|
|
387
|
+
image: registry.k8s.io/kubectl:v1.30.3
|
|
391
388
|
command:
|
|
392
389
|
- "/bin/sh"
|
|
393
390
|
args:
|
|
@@ -581,8 +578,9 @@ CATBACKUP
|
|
|
581
578
|
helmdn $SERVICE
|
|
582
579
|
fi
|
|
583
580
|
|
|
584
|
-
# If
|
|
585
|
-
|
|
581
|
+
# If the service is already plugged in or can be bootstrapped
|
|
582
|
+
# during initial install then do so here
|
|
583
|
+
ifPluggedInOrBootstrapped $SERVICE && continue
|
|
586
584
|
|
|
587
585
|
case "$SERVICE" in
|
|
588
586
|
"platform")
|
|
@@ -594,18 +592,6 @@ CATBACKUP
|
|
|
594
592
|
doInstall "${SYSTEM[@]}"
|
|
595
593
|
;;
|
|
596
594
|
|
|
597
|
-
"argocd")
|
|
598
|
-
bootstrapLocalSetup $SERVICE
|
|
599
|
-
;;
|
|
600
|
-
|
|
601
|
-
cnpg-db-*)
|
|
602
|
-
bootstrapLocalSetup $SERVICE
|
|
603
|
-
;;
|
|
604
|
-
|
|
605
|
-
"cnpg-operator")
|
|
606
|
-
bootstrapLocalSetup $SERVICE
|
|
607
|
-
;;
|
|
608
|
-
|
|
609
595
|
"cronZombieKiller"|"zombie-killer")
|
|
610
596
|
installCronZombieKiller # eradicate the gke 1.20+ zombies
|
|
611
597
|
;;
|
|
@@ -614,10 +600,6 @@ CATBACKUP
|
|
|
614
600
|
installDefaultConfigs
|
|
615
601
|
;;
|
|
616
602
|
|
|
617
|
-
"elasticsearch8")
|
|
618
|
-
bootstrapLocalSetup $SERVICE
|
|
619
|
-
;;
|
|
620
|
-
|
|
621
603
|
"estafette"|"preemptible-killer")
|
|
622
604
|
installPreemptibleKiller # the gke preemptible node spreader outer
|
|
623
605
|
;;
|
|
@@ -626,18 +608,6 @@ CATBACKUP
|
|
|
626
608
|
setupStackBuckets && exit 0
|
|
627
609
|
;;
|
|
628
610
|
|
|
629
|
-
"pgbouncer")
|
|
630
|
-
bootstrapLocalSetup $SERVICE
|
|
631
|
-
;;
|
|
632
|
-
|
|
633
|
-
"prom-operator")
|
|
634
|
-
bootstrapLocalSetup $SERVICE
|
|
635
|
-
;;
|
|
636
|
-
|
|
637
|
-
"redis"|"valkey")
|
|
638
|
-
bootstrapLocalSetup $SERVICE
|
|
639
|
-
;;
|
|
640
|
-
|
|
641
611
|
"reflector")
|
|
642
612
|
showInstalling "Secrets/ConfigMap Namespace Reflector"
|
|
643
613
|
addHelmRepo emberstack https://emberstack.github.io/helm-charts
|
|
@@ -658,22 +628,7 @@ CATBACKUP
|
|
|
658
628
|
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $HELM_WHAT"
|
|
659
629
|
doHelmup "$HELMUP"
|
|
660
630
|
;;
|
|
661
|
-
|
|
662
|
-
"traefik")
|
|
663
|
-
# installTraefikEnvironment
|
|
664
|
-
bootstrapLocalSetup $SERVICE
|
|
665
|
-
;;
|
|
666
|
-
|
|
667
|
-
"traefik-canary")
|
|
668
|
-
# only valid if traefik is already installed
|
|
669
|
-
bootstrapLocalSetup $SERVICE
|
|
670
|
-
;;
|
|
671
|
-
|
|
672
|
-
"velero")
|
|
673
|
-
# installVeleroEnvironment
|
|
674
|
-
bootstrapLocalSetup $SERVICE
|
|
675
|
-
;;
|
|
676
|
-
|
|
631
|
+
|
|
677
632
|
*)
|
|
678
633
|
# if the service dir is missing then check to see if it's a platform
|
|
679
634
|
# service and if it is then try to bootstrap from charts in build-tools
|
|
@@ -750,7 +705,7 @@ NOTRUNNING
|
|
|
750
705
|
}
|
|
751
706
|
|
|
752
707
|
# ---------- helmup MAIN ----------
|
|
753
|
-
GITTOP=`git rev-parse --show-toplevel`
|
|
708
|
+
GITTOP=`git rev-parse --show-toplevel`
|
|
754
709
|
K8S_UTILS="${GITTOP}/k8s-utils"
|
|
755
710
|
|
|
756
711
|
overwhelm
|
|
@@ -764,5 +719,3 @@ GCE_REGION=`overwhelm -k GCE_REGION`
|
|
|
764
719
|
doInstall $@
|
|
765
720
|
|
|
766
721
|
displayBanner
|
|
767
|
-
|
|
768
|
-
cd - &> $DEVNULL
|
package/src/k8x.sh
CHANGED
package/src/overwhelm.mjs
CHANGED
|
@@ -79,7 +79,7 @@ if ( !fs.existsSync( 'overwhelm.yaml' ) ) {
|
|
|
79
79
|
process.exit( 1 )
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
if ( !args.key && fs.existsSync( 'values-default.yaml' ) ) {
|
|
82
|
+
if ( !args.key && !args.fetchctx && !args.matchk8s && fs.existsSync( 'values-default.yaml' ) ) {
|
|
83
83
|
log( chalk.red.bold( `
|
|
84
84
|
|
|
85
85
|
***ERROR overwhelm => values-default.yaml is no longer used/supported and will
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
FROM bitnami/postgresql:11.14.0-debian-10-r28
|
|
2
|
+
|
|
3
|
+
USER root
|
|
4
|
+
|
|
5
|
+
# ---- Patch apt to use Debian archive repos since Buster is EOL ----
|
|
6
|
+
RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list \
|
|
7
|
+
&& sed -i 's|http://security.debian.org|http://archive.debian.org/debian-security|g' /etc/apt/sources.list \
|
|
8
|
+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until \
|
|
9
|
+
&& apt-get update
|
|
10
|
+
|
|
11
|
+
# ---- Install pg_repack build dependencies ----
|
|
12
|
+
RUN install_packages \
|
|
13
|
+
git \
|
|
14
|
+
build-essential \
|
|
15
|
+
libpq-dev \
|
|
16
|
+
postgresql-server-dev-11 \
|
|
17
|
+
libssl-dev \
|
|
18
|
+
zlib1g-dev \
|
|
19
|
+
ca-certificates \
|
|
20
|
+
curl
|
|
21
|
+
|
|
22
|
+
# ---- Build and install pg_repack ----
|
|
23
|
+
RUN git clone https://github.com/reorg/pg_repack.git /tmp/pg_repack \
|
|
24
|
+
&& cd /tmp/pg_repack \
|
|
25
|
+
&& make \
|
|
26
|
+
&& make install \
|
|
27
|
+
&& rm -rf /tmp/pg_repack
|
|
28
|
+
|
|
29
|
+
# ---- Install kubectl ----
|
|
30
|
+
ARG KUBECTL_VERSION=1.30.0
|
|
31
|
+
RUN curl -LO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
|
|
32
|
+
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
|
|
33
|
+
&& rm kubectl
|
|
34
|
+
|
|
35
|
+
# Drop back to non-root user (Bitnami default)
|
|
36
|
+
USER 1001
|
|
37
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
## Docker with pg_repack and kubectl
|
|
2
|
+
|
|
3
|
+
This configuration is needed for providing repack capabilities for legacy
|
|
4
|
+
postgresql 11 systems. Specifically, rule-engine / scheduler on prd-recovr-auto
|
|
5
|
+
cause PVC issues with the constant one-shot timer rescheduling, which gets
|
|
6
|
+
auto vacuumed but the PVC will continue to grow.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{{- define "repackMaintScript" -}}
|
|
2
|
+
#!/usr/bin/env bash
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
NAMESPACE="{{ .Values.namespace }}"
|
|
6
|
+
DEPLOY="{{ .Values.deploymentName }}"
|
|
7
|
+
DB_HOST="{{ .Values.db.host }}"
|
|
8
|
+
DB_PORT="{{ .Values.db.port }}"
|
|
9
|
+
DB_USER="{{ .Values.db.user }}"
|
|
10
|
+
DB_NAME="{{ .Values.db.name }}"
|
|
11
|
+
WAIT_TIMEOUT="{{ .Values.repack.waitTimeout }}"
|
|
12
|
+
|
|
13
|
+
CURRENT=$(kubectl -n "$NAMESPACE" get deploy "$DEPLOY" -o jsonpath='{.spec.replicas}' 2>/dev/null || echo "")
|
|
14
|
+
REPLICAS="${CURRENT:-1}"
|
|
15
|
+
echo "[maint] current replicas for $DEPLOY: $REPLICAS"
|
|
16
|
+
|
|
17
|
+
scale_up() {
|
|
18
|
+
echo "[maint] scaling $DEPLOY back to $REPLICAS"
|
|
19
|
+
kubectl -n "$NAMESPACE" scale deploy "$DEPLOY" --replicas="$REPLICAS" || true
|
|
20
|
+
echo "[maint] waiting for rollout..."
|
|
21
|
+
kubectl -n "$NAMESPACE" rollout status deploy/"$DEPLOY" --timeout=5m || true
|
|
22
|
+
}
|
|
23
|
+
trap 'echo "[maint] EXIT trap fired"; scale_up' EXIT
|
|
24
|
+
|
|
25
|
+
echo "[maint] scaling $DEPLOY to 0"
|
|
26
|
+
kubectl -n "$NAMESPACE" scale deploy "$DEPLOY" --replicas=0
|
|
27
|
+
kubectl -n "$NAMESPACE" rollout status deploy/"$DEPLOY" --timeout=5m || true
|
|
28
|
+
|
|
29
|
+
echo "[maint] waiting for DB sessions to drain..."
|
|
30
|
+
for i in {1..10}; do
|
|
31
|
+
ACTIVE=$(psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -Atc \
|
|
32
|
+
"SELECT count(*) FROM pg_stat_activity
|
|
33
|
+
WHERE datname=current_database()
|
|
34
|
+
AND pid <> pg_backend_pid()
|
|
35
|
+
AND state IS DISTINCT FROM 'idle';" || echo "999")
|
|
36
|
+
echo "[maint] active sessions: $ACTIVE"
|
|
37
|
+
[ "$ACTIVE" -eq 0 ] && break
|
|
38
|
+
sleep 6
|
|
39
|
+
done
|
|
40
|
+
|
|
41
|
+
echo "[maint] running pg_repack..."
|
|
42
|
+
pg_repack -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" \
|
|
43
|
+
--wait-timeout="$WAIT_TIMEOUT" -E DEBUG
|
|
44
|
+
|
|
45
|
+
echo "[maint] repack finished successfully"
|
|
46
|
+
{{- end -}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
apiVersion: batch/v1
|
|
2
|
+
kind: CronJob
|
|
3
|
+
metadata:
|
|
4
|
+
name: scheduler-db-repack
|
|
5
|
+
namespace: {{ .Values.namespace }}
|
|
6
|
+
spec:
|
|
7
|
+
schedule: {{ .Values.schedule | quote }}
|
|
8
|
+
concurrencyPolicy: Forbid
|
|
9
|
+
successfulJobsHistoryLimit: 1
|
|
10
|
+
failedJobsHistoryLimit: 2
|
|
11
|
+
jobTemplate:
|
|
12
|
+
spec:
|
|
13
|
+
backoffLimit: 0
|
|
14
|
+
template:
|
|
15
|
+
spec:
|
|
16
|
+
serviceAccountName: {{ .Values.serviceAccountName }}
|
|
17
|
+
restartPolicy: Never
|
|
18
|
+
containers:
|
|
19
|
+
- name: repack
|
|
20
|
+
image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}"
|
|
21
|
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
22
|
+
envFrom:
|
|
23
|
+
- secretRef:
|
|
24
|
+
name: scheduler-pg-creds
|
|
25
|
+
volumeMounts:
|
|
26
|
+
- name: script
|
|
27
|
+
mountPath: /opt/maint
|
|
28
|
+
command: ["/bin/bash","/opt/maint/maint.sh"]
|
|
29
|
+
volumes:
|
|
30
|
+
- name: script
|
|
31
|
+
configMap:
|
|
32
|
+
name: repack-maint-script
|
|
33
|
+
defaultMode: 0755
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
2
|
+
kind: Role
|
|
3
|
+
metadata:
|
|
4
|
+
name: repack-maint-role
|
|
5
|
+
namespace: {{ .Values.namespace }}
|
|
6
|
+
rules:
|
|
7
|
+
- apiGroups: ["apps"]
|
|
8
|
+
resources: ["deployments", "deployments/scale"]
|
|
9
|
+
verbs: ["get","list","watch","patch","update"]
|
|
10
|
+
- apiGroups: [""]
|
|
11
|
+
resources: ["pods"]
|
|
12
|
+
verbs: ["get","list","watch"]
|
|
13
|
+
---
|
|
14
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
15
|
+
kind: RoleBinding
|
|
16
|
+
metadata:
|
|
17
|
+
name: repack-maint-rb
|
|
18
|
+
namespace: {{ .Values.namespace }}
|
|
19
|
+
subjects:
|
|
20
|
+
- kind: ServiceAccount
|
|
21
|
+
name: {{ .Values.serviceAccountName }}
|
|
22
|
+
roleRef:
|
|
23
|
+
apiGroup: rbac.authorization.k8s.io
|
|
24
|
+
kind: Role
|
|
25
|
+
name: repack-maint-role
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
namespace: default
|
|
2
|
+
|
|
3
|
+
image:
|
|
4
|
+
repo: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql11-repack-kubectl
|
|
5
|
+
tag: 11.14-kctl.2
|
|
6
|
+
pullPolicy: IfNotPresent
|
|
7
|
+
|
|
8
|
+
#schedule: "0 3 * * *" # 3 in the morning UTC
|
|
9
|
+
schedule: "*/5 * * * *" # every 5 minutes for testing
|
|
10
|
+
deploymentName: scheduler
|
|
11
|
+
db:
|
|
12
|
+
host: postgres-scheduler
|
|
13
|
+
port: "5432"
|
|
14
|
+
user: postgres
|
|
15
|
+
name: scheduler
|
|
16
|
+
repack:
|
|
17
|
+
waitTimeout: "15"
|
|
18
|
+
|
|
19
|
+
# You can set this via --set-file or external secrets in prod
|
|
20
|
+
pgPassword: "REPLACE_ME"
|
|
21
|
+
|
|
22
|
+
replicasDefault: "" # leave blank to detect automatically
|
|
23
|
+
serviceAccountName: repack-maint-sa
|