@leverege/build-tools 2.21.13 → 2.22.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/lib/server/build-tools.js +9 -0
- package/lib/server/firebaseDeploy.js +1 -1
- package/lib/server/overwhelm.js +10 -0
- package/lib/web/build-tools.js +9 -0
- package/lib/web/firebaseDeploy.js +1 -1
- package/lib/web/overwhelm.js +10 -0
- package/package.json +4 -4
- package/src/build-tools.js +10 -0
- package/src/firebaseDeploy.mjs +1 -1
- package/src/helmup +228 -135
- package/src/overwhelm.js +3 -0
- package/src/system-charts/elasticsearch-local.yaml +14 -0
- package/src/system-charts/elasticsearch.hup +18 -0
- package/src/system-charts/grafana.hup +15 -0
- package/src/system-charts/postgres-local.yaml +39 -0
- package/src/system-charts/postgres.hup +11 -0
- package/src/system-charts/prometheus-local.yaml +786 -0
- package/src/system-charts/prometheus.hup +15 -0
- package/src/system-charts/redis-local.yaml +62 -0
- package/src/system-charts/redis.hup +12 -0
- package/src/system-charts/timescale-db-local.yaml +44 -0
- package/src/system-charts/timescale-db.hup +10 -0
|
@@ -28,6 +28,11 @@ const optionList = [
|
|
|
28
28
|
type: Boolean,
|
|
29
29
|
default: false,
|
|
30
30
|
description: 'source the output to define common bash helper functions'
|
|
31
|
+
}, {
|
|
32
|
+
name: 'reporoot',
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
description: 'the root of the build-tools repo - for finding other config files'
|
|
31
36
|
}, {
|
|
32
37
|
name: 'help',
|
|
33
38
|
type: Boolean,
|
|
@@ -68,6 +73,10 @@ if (args.bashfun) {
|
|
|
68
73
|
console.log(`${repoRoot}/src/bash-funcs`);
|
|
69
74
|
process.exit(0);
|
|
70
75
|
}
|
|
76
|
+
if (args.reporoot) {
|
|
77
|
+
console.log(`${repoRoot}`);
|
|
78
|
+
process.exit(0);
|
|
79
|
+
}
|
|
71
80
|
const checkForLatest = async (pkg = '@leverege/build-tools') => {
|
|
72
81
|
const getToken = () => {
|
|
73
82
|
const tokenFile = `${process.env.HOME}/.npmrc`;
|
package/lib/server/overwhelm.js
CHANGED
|
@@ -54,6 +54,13 @@ const optionsDefinitions = [/* eslint-disable no-multi-spaces */
|
|
|
54
54
|
default: false
|
|
55
55
|
},
|
|
56
56
|
// fetch and set k8s context
|
|
57
|
+
{
|
|
58
|
+
name: 'genvals',
|
|
59
|
+
alias: 'g',
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
// only generates values.yaml
|
|
57
64
|
{
|
|
58
65
|
name: 'matchk8s',
|
|
59
66
|
alias: 'm',
|
|
@@ -347,6 +354,9 @@ glob.sync('**/*.ovh').forEach(cfgmap => {
|
|
|
347
354
|
valuesOut = doReplacements(valuesOut, over);
|
|
348
355
|
fs.writeFileSync(target, valuesOut);
|
|
349
356
|
});
|
|
357
|
+
if (args.genvals) {
|
|
358
|
+
process.exit(0);
|
|
359
|
+
}
|
|
350
360
|
|
|
351
361
|
// Set the GCP context for safety!
|
|
352
362
|
const clusterName = over.CLUSTER_NAME;
|
package/lib/web/build-tools.js
CHANGED
|
@@ -28,6 +28,11 @@ const optionList = [
|
|
|
28
28
|
type: Boolean,
|
|
29
29
|
default: false,
|
|
30
30
|
description: 'source the output to define common bash helper functions'
|
|
31
|
+
}, {
|
|
32
|
+
name: 'reporoot',
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
description: 'the root of the build-tools repo - for finding other config files'
|
|
31
36
|
}, {
|
|
32
37
|
name: 'help',
|
|
33
38
|
type: Boolean,
|
|
@@ -68,6 +73,10 @@ if (args.bashfun) {
|
|
|
68
73
|
console.log(`${repoRoot}/src/bash-funcs`);
|
|
69
74
|
process.exit(0);
|
|
70
75
|
}
|
|
76
|
+
if (args.reporoot) {
|
|
77
|
+
console.log(`${repoRoot}`);
|
|
78
|
+
process.exit(0);
|
|
79
|
+
}
|
|
71
80
|
const checkForLatest = async (pkg = '@leverege/build-tools') => {
|
|
72
81
|
const getToken = () => {
|
|
73
82
|
const tokenFile = `${process.env.HOME}/.npmrc`;
|
package/lib/web/overwhelm.js
CHANGED
|
@@ -54,6 +54,13 @@ const optionsDefinitions = [/* eslint-disable no-multi-spaces */
|
|
|
54
54
|
default: false
|
|
55
55
|
},
|
|
56
56
|
// fetch and set k8s context
|
|
57
|
+
{
|
|
58
|
+
name: 'genvals',
|
|
59
|
+
alias: 'g',
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
// only generates values.yaml
|
|
57
64
|
{
|
|
58
65
|
name: 'matchk8s',
|
|
59
66
|
alias: 'm',
|
|
@@ -347,6 +354,9 @@ glob.sync('**/*.ovh').forEach(cfgmap => {
|
|
|
347
354
|
valuesOut = doReplacements(valuesOut, over);
|
|
348
355
|
fs.writeFileSync(target, valuesOut);
|
|
349
356
|
});
|
|
357
|
+
if (args.genvals) {
|
|
358
|
+
process.exit(0);
|
|
359
|
+
}
|
|
350
360
|
|
|
351
361
|
// Set the GCP context for safety!
|
|
352
362
|
const clusterName = over.CLUSTER_NAME;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"parse-gitignore": "^2.0.0",
|
|
64
64
|
"readline-sync": "^1.4.10",
|
|
65
65
|
"semver": "^7.3.8",
|
|
66
|
-
"simple-git": "^3.
|
|
66
|
+
"simple-git": "^3.15.1",
|
|
67
67
|
"zx": "^7.1.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@babel/cli": "^7.19.3",
|
|
71
|
-
"@babel/core": "^7.20.
|
|
71
|
+
"@babel/core": "^7.20.5",
|
|
72
72
|
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
73
73
|
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
74
|
-
"npm": "^
|
|
74
|
+
"npm": "^9.2.0"
|
|
75
75
|
}
|
|
76
76
|
}
|
package/src/build-tools.js
CHANGED
|
@@ -26,6 +26,11 @@ const optionList = [ // Use optionList to tie into the Usage statements
|
|
|
26
26
|
default : false,
|
|
27
27
|
description : 'source the output to define common bash helper functions',
|
|
28
28
|
},
|
|
29
|
+
{ name : 'reporoot',
|
|
30
|
+
type : Boolean,
|
|
31
|
+
default : false,
|
|
32
|
+
description : 'the root of the build-tools repo - for finding other config files',
|
|
33
|
+
},
|
|
29
34
|
{
|
|
30
35
|
name : 'help',
|
|
31
36
|
type : Boolean,
|
|
@@ -73,6 +78,11 @@ if ( args.bashfun ) {
|
|
|
73
78
|
process.exit( 0 )
|
|
74
79
|
}
|
|
75
80
|
|
|
81
|
+
if ( args.reporoot ) {
|
|
82
|
+
console.log( `${repoRoot}` )
|
|
83
|
+
process.exit( 0 )
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
const checkForLatest = async ( pkg = '@leverege/build-tools' ) => {
|
|
77
87
|
const getToken = () => {
|
|
78
88
|
const tokenFile = `${process.env.HOME}/.npmrc`
|
package/src/firebaseDeploy.mjs
CHANGED
|
@@ -99,7 +99,7 @@ const targets = Object
|
|
|
99
99
|
|
|
100
100
|
if ( INTERACTIVE_MODE ) {
|
|
101
101
|
const { targetEnv } = await prompt( [ {
|
|
102
|
-
type : '
|
|
102
|
+
type : 'autocomplete',
|
|
103
103
|
name : 'targetEnv',
|
|
104
104
|
message : 'To which environment would you like to deploy?',
|
|
105
105
|
choices : Object.values( targets ).map( ( t ) => {
|
package/src/helmup
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
#printf "\n***** RUNNING LOCALLY *****\n" && sleep 2 && alias build-tools="build-tools.js"
|
|
4
4
|
|
|
5
5
|
# Load the standard helper functions
|
|
6
6
|
. `build-tools --bashfun`
|
|
@@ -103,23 +103,6 @@ WORKLOAD_ID
|
|
|
103
103
|
warnOnError $? "Failed to annotate service account $NAMESPACE/$SVC_ACCT - things may fail"
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function checkTimescalePassword(){
|
|
107
|
-
kubectl get secret postgresql-password
|
|
108
|
-
if [[ $? -eq 1 ]]; then
|
|
109
|
-
printf "\n*** Autogenerating Timescale password ***\n\n"
|
|
110
|
-
local psql_pw="$(generatePassword)"
|
|
111
|
-
local psql_rep_pw="$(generatePassword)"
|
|
112
|
-
|
|
113
|
-
kubectl create secret generic postgresql-password \
|
|
114
|
-
--from-literal=postgresql-password=${psql_pw} \
|
|
115
|
-
--from-literal=postgresql-replication-password=${psql_rep_pw}
|
|
116
|
-
|
|
117
|
-
printf "\n\n`color y '*** Save Timescale creds to Keeweb ***'`\n\n"
|
|
118
|
-
printf "`color g "postgresql-password / ${psql_pw}"`\n"
|
|
119
|
-
printf "`color g "postgresql-replication-password / ${psql_rep_pw}"`\n\n"
|
|
120
|
-
fi
|
|
121
|
-
}
|
|
122
|
-
|
|
123
106
|
function generatePassword(){
|
|
124
107
|
RANDOMPW=`openssl rand -base64 12`
|
|
125
108
|
echo $RANDOMPW
|
|
@@ -134,111 +117,61 @@ function createNamespaceIfNeeded(){
|
|
|
134
117
|
fi
|
|
135
118
|
}
|
|
136
119
|
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
120
|
+
function bootstrapLocalSetup() {
|
|
121
|
+
SERVICE="$1"
|
|
122
|
+
[ -z "$1" ] && errorExit "bootstrapLocalSetup function requires a service name"
|
|
123
|
+
TOOLS_SRC="$(build-tools --reporoot)/src"
|
|
124
|
+
SYSTEM_FILES="$(build-tools --reporoot)/src/system-charts"
|
|
125
|
+
|
|
126
|
+
SYSTEM_CHART="$SYSTEM_FILES/$SERVICE-local.yaml"
|
|
127
|
+
[ ! -f "$SYSTEM_CHART" ] && errorExit "Missing $SERVICE chart => $(color y $SYSTEM_CHART)"
|
|
128
|
+
|
|
129
|
+
SYSTEM_HUP="$SYSTEM_FILES/$SERVICE.hup"
|
|
130
|
+
[ ! -f "$SYSTEM_HUP" ] && errorExit "Missing $SERVICE helmup script => $(color y $SYSTEM_HUP)"
|
|
131
|
+
|
|
132
|
+
[ ! -d "$SERVICE" ] && mkdir $SERVICE
|
|
133
|
+
|
|
134
|
+
if [ "$2" == "set-values-local" ];
|
|
135
|
+
then
|
|
136
|
+
TARGET_CHART="values-local.yaml"
|
|
137
|
+
else
|
|
138
|
+
TARGET_CHART="$SERVICE-local.yaml"
|
|
139
|
+
touch $SERVICE/.nohelm
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
cp $SYSTEM_CHART $SERVICE/$TARGET_CHART
|
|
143
|
+
cp $SYSTEM_HUP $SERVICE/helmup.plugin
|
|
144
|
+
git add $SERVICE
|
|
145
|
+
overwhelm.js --genvals
|
|
146
|
+
ifPluggedIn $SERVICE
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
function installGrafana() {
|
|
149
150
|
## Install Grafana
|
|
150
151
|
addHelmRepo grafana https://grafana.github.io/helm-charts
|
|
152
|
+
[ -z "$GRAFANA_HELM_CHART" ] && GRAFANA_HELM_CHART="6"
|
|
151
153
|
helm upgrade --install grafana grafana/grafana \
|
|
152
154
|
--namespace monitoring \
|
|
153
155
|
--values grafana/values-grafana.yaml \
|
|
154
|
-
--version
|
|
156
|
+
--version $GRAFANA_HELM_CHART
|
|
155
157
|
removeHelmRepo grafana
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-f - <<REDIS_CHART_MODS
|
|
165
|
-
global:
|
|
166
|
-
storageClass: ssd
|
|
167
|
-
|
|
168
|
-
auth:
|
|
169
|
-
enabled: false
|
|
170
|
-
sentinel: false
|
|
171
|
-
|
|
172
|
-
master:
|
|
173
|
-
affinity:
|
|
174
|
-
nodeAffinity:
|
|
175
|
-
requiredDuringSchedulingIgnoredDuringExecution:
|
|
176
|
-
nodeSelectorTerms:
|
|
177
|
-
- matchExpressions:
|
|
178
|
-
- key: target-env
|
|
179
|
-
operator: In
|
|
180
|
-
values:
|
|
181
|
-
- database
|
|
182
|
-
|
|
183
|
-
tolerations:
|
|
184
|
-
- key: "database"
|
|
185
|
-
operator: "Equal"
|
|
186
|
-
value: "true"
|
|
187
|
-
effect: "NoSchedule"
|
|
188
|
-
|
|
189
|
-
persistence:
|
|
190
|
-
size: 8Gi # 8Gi is default
|
|
191
|
-
|
|
192
|
-
replica:
|
|
193
|
-
affinity:
|
|
194
|
-
nodeAffinity:
|
|
195
|
-
requiredDuringSchedulingIgnoredDuringExecution:
|
|
196
|
-
nodeSelectorTerms:
|
|
197
|
-
- matchExpressions:
|
|
198
|
-
- key: target-env
|
|
199
|
-
operator: In
|
|
200
|
-
values:
|
|
201
|
-
- database
|
|
202
|
-
|
|
203
|
-
tolerations:
|
|
204
|
-
- key: "database"
|
|
205
|
-
operator: "Equal"
|
|
206
|
-
value: "true"
|
|
207
|
-
effect: "NoSchedule"
|
|
208
|
-
|
|
209
|
-
persistence:
|
|
210
|
-
size: 8Gi # 8Gi is default
|
|
211
|
-
|
|
212
|
-
architecture: replication
|
|
213
|
-
|
|
214
|
-
sentinel:
|
|
215
|
-
enabled: false
|
|
216
|
-
|
|
217
|
-
networkPolicy:
|
|
218
|
-
enabled: true
|
|
219
|
-
allowExternal: false
|
|
220
|
-
ingressNSMatchLabels:
|
|
221
|
-
redis: external
|
|
222
|
-
ingressNSPodMatchLabels:
|
|
223
|
-
redis-client: true
|
|
224
|
-
|
|
225
|
-
metrics:
|
|
226
|
-
enabled: true
|
|
160
|
+
function checkTimescalePassword() {
|
|
161
|
+
kubectl get secret postgresql-password
|
|
162
|
+
if [[ $? -eq 1 ]]; then
|
|
163
|
+
printf "\n*** Autogenerating Timescale password ***\n\n"
|
|
164
|
+
local psql_pw="$(generatePassword)"
|
|
165
|
+
local psql_rep_pw="$(generatePassword)"
|
|
227
166
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
clearlyWarn noclear
|
|
232
|
-
cat<<OLDER_REDIS
|
|
233
|
-
The redis upgrade failed which may mean that the versions are different
|
|
234
|
-
enough that k8s cannot gracefully upgrade from one version to the next.
|
|
235
|
-
Try removing the existing deployment and redeploying redis:
|
|
167
|
+
kubectl create secret generic postgresql-password \
|
|
168
|
+
--from-literal=postgresql-password=${psql_pw} \
|
|
169
|
+
--from-literal=postgresql-replication-password=${psql_rep_pw}
|
|
236
170
|
|
|
237
|
-
|
|
238
|
-
|
|
171
|
+
printf "\n\n`color y '*** Save Timescale creds to Keeper ***'`\n\n"
|
|
172
|
+
printf "`color g "postgresql-password / ${psql_pw}"`\n"
|
|
173
|
+
printf "`color g "postgresql-replication-password / ${psql_rep_pw}"`\n\n"
|
|
239
174
|
fi
|
|
240
|
-
printf "\n\nTo start a specific version => `color g 'REDIS_HELM_CHART="13.0.1" helmup redis'`\n\n"
|
|
241
|
-
removeHelmRepo bitnami
|
|
242
175
|
}
|
|
243
176
|
|
|
244
177
|
function installMonitoringCharts(){
|
|
@@ -554,9 +487,10 @@ NEED_MANAGED_SECRET
|
|
|
554
487
|
fi
|
|
555
488
|
|
|
556
489
|
addHelmRepo jetstack https://charts.jetstack.io
|
|
490
|
+
[ -z "$CERT_MANAGER_HELM_CHART" ] && CERT_MANAGER_HELM_CHART="v1.10"
|
|
557
491
|
helm upgrade --install cert-manager jetstack/cert-manager \
|
|
558
492
|
--namespace cert-manager --set installCRDs=true \
|
|
559
|
-
--version
|
|
493
|
+
--version $CERT_MANAGER_HELM_CHART
|
|
560
494
|
|
|
561
495
|
cat<<DELAY
|
|
562
496
|
|
|
@@ -609,9 +543,12 @@ NEED_TRAEFIK_SECRET
|
|
|
609
543
|
--from-literal=dns-token=$TOKEN
|
|
610
544
|
fi
|
|
611
545
|
|
|
612
|
-
|
|
546
|
+
TRAEFIK_DIR="traefik"
|
|
547
|
+
[ ! -d "$TRAEFIK_DIR" ] && mkdir $TRAEFIK_DIR
|
|
548
|
+
TRAEFIK_HA_YAML="$TRAEFIK_DIR/traefik-ha-values.yaml"
|
|
613
549
|
if [ ! -f "$TRAEFIK_HA_YAML" ];
|
|
614
550
|
then
|
|
551
|
+
touch "$TRAEFIK_DIR/.nohelm"
|
|
615
552
|
cat<<TRAEFIK_CFG>>"$TRAEFIK_HA_YAML"
|
|
616
553
|
additionalArguments:
|
|
617
554
|
- "--accesslog=true"
|
|
@@ -631,7 +568,7 @@ TRAEFIK_CFG
|
|
|
631
568
|
|
|
632
569
|
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
633
570
|
|
|
634
|
-
[ -z "$TRAEFIK_HELM_CHART" ] && TRAEFIK_HELM_CHART="
|
|
571
|
+
[ -z "$TRAEFIK_HELM_CHART" ] && TRAEFIK_HELM_CHART="16"
|
|
635
572
|
helm upgrade --install traefik traefik/traefik \
|
|
636
573
|
--namespace traefik \
|
|
637
574
|
--version $TRAEFIK_HELM_CHART \
|
|
@@ -745,8 +682,9 @@ function installVelero() {
|
|
|
745
682
|
## Install velero chart => https://github.com/vmware-tanzu/helm-charts/blob/main/charts/velero/values.yaml
|
|
746
683
|
## Helpful debugging link => https://github.com/vmware-tanzu/helm-charts/issues/351
|
|
747
684
|
addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
685
|
+
[ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="2"
|
|
748
686
|
helm upgrade --install velero vmware-tanzu/velero \
|
|
749
|
-
--version
|
|
687
|
+
--version $VELERO_HELM_CHART \
|
|
750
688
|
--namespace velero \
|
|
751
689
|
--set credentials.useSecret="false" \
|
|
752
690
|
--set configuration.provider="gcp" \
|
|
@@ -895,16 +833,7 @@ function doInstall() {
|
|
|
895
833
|
;;
|
|
896
834
|
|
|
897
835
|
"elastic"|"elasticsearch")
|
|
898
|
-
|
|
899
|
-
LOCAL_ES_VALUES="elasticsearch/es-values.yaml"
|
|
900
|
-
[ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
|
|
901
|
-
checkSSDStorageClass
|
|
902
|
-
addHelmRepo elastic https://helm.elastic.co
|
|
903
|
-
helm upgrade --install elasticsearch elastic/elasticsearch \
|
|
904
|
-
--version 7.16 \
|
|
905
|
-
--values $LOCAL_ES_VALUES \
|
|
906
|
-
--set volumeClaimTemplate.storageClassName="ssd"
|
|
907
|
-
removeHelmRepo elastic
|
|
836
|
+
bootstrapLocalSetup elasticsearch
|
|
908
837
|
;;
|
|
909
838
|
|
|
910
839
|
"estafette"|"preemptible-killer")
|
|
@@ -925,18 +854,15 @@ function doInstall() {
|
|
|
925
854
|
;;
|
|
926
855
|
|
|
927
856
|
"postgres"|"postgresql")
|
|
928
|
-
|
|
929
|
-
addBitnamiRepo
|
|
930
|
-
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|
|
931
|
-
removeHelmRepo bitnami
|
|
857
|
+
bootstrapLocalSetup postgres
|
|
932
858
|
;;
|
|
933
859
|
|
|
934
860
|
"prometheus")
|
|
935
|
-
|
|
861
|
+
bootstrapLocalSetup prometheus set-values-local
|
|
936
862
|
;;
|
|
937
863
|
|
|
938
864
|
"redis")
|
|
939
|
-
|
|
865
|
+
bootstrapLocalSetup redis
|
|
940
866
|
;;
|
|
941
867
|
|
|
942
868
|
"reloader")
|
|
@@ -946,10 +872,8 @@ function doInstall() {
|
|
|
946
872
|
removeHelmRepo stakater
|
|
947
873
|
;;
|
|
948
874
|
|
|
949
|
-
"timescale-db")
|
|
950
|
-
|
|
951
|
-
checkTimescalePassword
|
|
952
|
-
helm upgrade --install timescale-db leverege/timescale-db
|
|
875
|
+
"timescale"|"timescale-db")
|
|
876
|
+
bootstrapLocalSetup timescale-db
|
|
953
877
|
;;
|
|
954
878
|
|
|
955
879
|
transponder-*)
|
|
@@ -1030,11 +954,180 @@ NOTRUNNING
|
|
|
1030
954
|
}
|
|
1031
955
|
|
|
1032
956
|
# ---------- helmup MAIN ----------
|
|
1033
|
-
GITTOP=`git rev-parse --show-toplevel`
|
|
957
|
+
GITTOP=`git rev-parse --show-toplevel` # `&& cd $GITTOP
|
|
1034
958
|
K8S_UTILS="${GITTOP}/k8s-utils"
|
|
1035
959
|
|
|
1036
|
-
overwhelm
|
|
960
|
+
overwhelm.js #XXX
|
|
1037
961
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
1038
962
|
|
|
1039
963
|
doInstall $@
|
|
1040
964
|
cd - &> /dev/null
|
|
965
|
+
|
|
966
|
+
# *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED ***
|
|
967
|
+
function installPrometheusXXX() {
|
|
968
|
+
# Add the community helm repositories
|
|
969
|
+
addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
|
|
970
|
+
[ -z "$PROMETHEUS_HELM_CHART" ] && PROMETHEUS_HELM_CHART="15"
|
|
971
|
+
helm upgrade --install prometheus prometheus-community/prometheus \
|
|
972
|
+
--namespace monitoring \
|
|
973
|
+
--values prometheus/values.yaml \
|
|
974
|
+
--version $PROMETHEUS_HELM_CHART
|
|
975
|
+
removeHelmRepo prometheus-community
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
function installRedisXXX() {
|
|
979
|
+
showInstalling "Redis Network Cache"
|
|
980
|
+
addBitnamiRepo latest
|
|
981
|
+
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="17" # latest chart 17 is redis v7
|
|
982
|
+
helm upgrade --install redis bitnami/redis \
|
|
983
|
+
--version $REDIS_HELM_CHART \
|
|
984
|
+
-f - <<REDIS_CHART_MODS
|
|
985
|
+
global:
|
|
986
|
+
storageClass: ssd
|
|
987
|
+
|
|
988
|
+
auth:
|
|
989
|
+
enabled: false
|
|
990
|
+
sentinel: false
|
|
991
|
+
|
|
992
|
+
master:
|
|
993
|
+
affinity:
|
|
994
|
+
nodeAffinity:
|
|
995
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
996
|
+
nodeSelectorTerms:
|
|
997
|
+
- matchExpressions:
|
|
998
|
+
- key: target-env
|
|
999
|
+
operator: In
|
|
1000
|
+
values:
|
|
1001
|
+
- database
|
|
1002
|
+
|
|
1003
|
+
tolerations:
|
|
1004
|
+
- key: "database"
|
|
1005
|
+
operator: "Equal"
|
|
1006
|
+
value: "true"
|
|
1007
|
+
effect: "NoSchedule"
|
|
1008
|
+
|
|
1009
|
+
persistence:
|
|
1010
|
+
size: 1Gi # 8Gi is default
|
|
1011
|
+
|
|
1012
|
+
replica:
|
|
1013
|
+
affinity:
|
|
1014
|
+
nodeAffinity:
|
|
1015
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
1016
|
+
nodeSelectorTerms:
|
|
1017
|
+
- matchExpressions:
|
|
1018
|
+
- key: target-env
|
|
1019
|
+
operator: In
|
|
1020
|
+
values:
|
|
1021
|
+
- database
|
|
1022
|
+
|
|
1023
|
+
tolerations:
|
|
1024
|
+
- key: "database"
|
|
1025
|
+
operator: "Equal"
|
|
1026
|
+
value: "true"
|
|
1027
|
+
effect: "NoSchedule"
|
|
1028
|
+
|
|
1029
|
+
persistence:
|
|
1030
|
+
size: 8Gi # 8Gi is default
|
|
1031
|
+
|
|
1032
|
+
architecture: replication
|
|
1033
|
+
|
|
1034
|
+
sentinel:
|
|
1035
|
+
enabled: false
|
|
1036
|
+
|
|
1037
|
+
networkPolicy:
|
|
1038
|
+
enabled: true
|
|
1039
|
+
allowExternal: false
|
|
1040
|
+
ingressNSMatchLabels:
|
|
1041
|
+
redis: external
|
|
1042
|
+
ingressNSPodMatchLabels:
|
|
1043
|
+
redis-client: true
|
|
1044
|
+
|
|
1045
|
+
metrics:
|
|
1046
|
+
enabled: true
|
|
1047
|
+
|
|
1048
|
+
REDIS_CHART_MODS
|
|
1049
|
+
if [[ $? -ne 0 ]];
|
|
1050
|
+
then
|
|
1051
|
+
clearlyWarn noclear
|
|
1052
|
+
cat<<OLDER_REDIS
|
|
1053
|
+
The redis upgrade failed which may mean that the versions are different
|
|
1054
|
+
enough that k8s cannot gracefully upgrade from one version to the next.
|
|
1055
|
+
Try removing the existing deployment and redeploying redis:
|
|
1056
|
+
|
|
1057
|
+
$ `color r "helmdn redis && sleep 5 && helmup redis"`
|
|
1058
|
+
OLDER_REDIS
|
|
1059
|
+
fi
|
|
1060
|
+
printf "\n\nTo start a specific version => `color g 'REDIS_HELM_CHART="13.0.1" helmup redis'`\n\n"
|
|
1061
|
+
removeHelmRepo bitnami
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
function installPostgreSQLXXX() {
|
|
1065
|
+
showInstalling "PostgreSQL Database"
|
|
1066
|
+
addBitnamiRepo
|
|
1067
|
+
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 10.16.2
|
|
1068
|
+
removeHelmRepo bitnami
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function checkTimescaleLocalValuesXXX() {
|
|
1072
|
+
local TSDIR="$GITTOP/timescale-db"
|
|
1073
|
+
local TSLCL="$TSDIR/tsdb-values.yaml"
|
|
1074
|
+
[ ! -d "$TSDIR" ] && mkdir "$TSDIR" && touch "$TSDIR/.nohelm"
|
|
1075
|
+
[ ! -f "$TSLCL" ] && cat > $TSLCL <<TIMESCALE_LOCAL_CHART
|
|
1076
|
+
postgresql:
|
|
1077
|
+
postgresqlExtendedConf:
|
|
1078
|
+
maxWorkerProcesses: 8
|
|
1079
|
+
maxParallelWorkers: 8
|
|
1080
|
+
maxConnections: 500
|
|
1081
|
+
sharedBuffers: 2GB
|
|
1082
|
+
effectiveCacheSize: 6GB
|
|
1083
|
+
maintenanceWorkMem: 1GB
|
|
1084
|
+
workMem: 20MB
|
|
1085
|
+
idle_in_transaction_session_timeout: 30000 # 30ms timeout
|
|
1086
|
+
maxWalSize: 2GB
|
|
1087
|
+
walKeepSegments: 64
|
|
1088
|
+
|
|
1089
|
+
resources:
|
|
1090
|
+
requests:
|
|
1091
|
+
memory: 4Gi
|
|
1092
|
+
cpu: 1000m
|
|
1093
|
+
|
|
1094
|
+
persistence:
|
|
1095
|
+
size: 200Gi
|
|
1096
|
+
|
|
1097
|
+
livenessProbe:
|
|
1098
|
+
enabled: true # false for repairs
|
|
1099
|
+
initialDelaySeconds: 30
|
|
1100
|
+
periodSeconds: 10
|
|
1101
|
+
timeoutSeconds: 5
|
|
1102
|
+
failureThreshold: 6
|
|
1103
|
+
successThreshold: 1
|
|
1104
|
+
|
|
1105
|
+
readinessProbe:
|
|
1106
|
+
enabled: true
|
|
1107
|
+
successThreshold: 1
|
|
1108
|
+
initialDelaySeconds: 5
|
|
1109
|
+
timeoutSeconds: 5
|
|
1110
|
+
periodSeconds: 10
|
|
1111
|
+
failureThreshold: 6
|
|
1112
|
+
# These values should be used when attempting to rebuild the slave VPCs
|
|
1113
|
+
# following a failure, typically caused by WAL problems. The failure
|
|
1114
|
+
# threshold of 240 with a period of 30 seconds should allow the recovery
|
|
1115
|
+
# process 2 hours of time for each slave VPC - lengthen as necessary.
|
|
1116
|
+
# initialDelaySeconds: 60
|
|
1117
|
+
# timeoutSeconds: 15
|
|
1118
|
+
# periodSeconds: 30
|
|
1119
|
+
# failureThreshold: 240
|
|
1120
|
+
TIMESCALE_LOCAL_CHART
|
|
1121
|
+
echo "$TSLCL"
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function installTimescaleDbXXX() {
|
|
1125
|
+
showInstalling "Timescale Database (Leverege chart)"
|
|
1126
|
+
checkTimescalePassword
|
|
1127
|
+
TSDB_VAL="$(checkTimescaleLocalValues)"
|
|
1128
|
+
[ -z "$TIMESCALE_HELM_CHART" ] && TIMESCALE_HELM_CHART="2"
|
|
1129
|
+
helm upgrade --install timescale-db leverege/timescale-db \
|
|
1130
|
+
--version $TIMESCALE_HELM_CHART \
|
|
1131
|
+
-f $GITTOP/timescale-db/tsdb-values.yaml
|
|
1132
|
+
}
|
|
1133
|
+
|
package/src/overwhelm.js
CHANGED
|
@@ -24,6 +24,7 @@ const optionsDefinitions = [
|
|
|
24
24
|
{ name : 'continue', alias : 'c', type : Boolean, default : false },
|
|
25
25
|
{ name : 'checkctx', alias : 't', type : Boolean, default : false }, // checks overwhelm context
|
|
26
26
|
{ name : 'fetchctx', alias : 'f', type : Boolean, default : false }, // fetch and set k8s context
|
|
27
|
+
{ name : 'genvals', alias : 'g', type : Boolean, default : false }, // only generates values.yaml
|
|
27
28
|
{ name : 'matchk8s', alias : 'm', type : Boolean, default : false }, // checks k8s context
|
|
28
29
|
{ name : 'verbose', alias : 'v', type : Boolean, default : false },
|
|
29
30
|
/* eslint-enable no-multi-spaces */
|
|
@@ -301,6 +302,8 @@ glob.sync( '**/*.ovh' ).forEach( ( cfgmap ) => {
|
|
|
301
302
|
fs.writeFileSync( target, valuesOut )
|
|
302
303
|
} )
|
|
303
304
|
|
|
305
|
+
if( args.genvals ) { process.exit( 0 ) }
|
|
306
|
+
|
|
304
307
|
// Set the GCP context for safety!
|
|
305
308
|
const clusterName = over.CLUSTER_NAME
|
|
306
309
|
if ( over.PROJECT_NAME === 'minikube' ) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
tolerations:
|
|
2
|
+
- key: "database"
|
|
3
|
+
operator: "Equal"
|
|
4
|
+
value: "true"
|
|
5
|
+
effect: "NoSchedule"
|
|
6
|
+
|
|
7
|
+
nodeAffinity:
|
|
8
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
9
|
+
nodeSelectorTerms:
|
|
10
|
+
- matchExpressions:
|
|
11
|
+
- key: target-env
|
|
12
|
+
operator: In
|
|
13
|
+
values:
|
|
14
|
+
- database
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Do not move to 7.17+ until the memory explosion problem is resolved
|
|
4
|
+
#
|
|
5
|
+
showInstalling "Elastic Search"
|
|
6
|
+
|
|
7
|
+
checkSSDStorageClass
|
|
8
|
+
|
|
9
|
+
LOCAL_ES_VALUES="elasticsearch/elasticsearch-local.yaml"
|
|
10
|
+
[ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
|
|
11
|
+
|
|
12
|
+
addHelmRepo elastic https://helm.elastic.co
|
|
13
|
+
helm upgrade --install elasticsearch elastic/elasticsearch \
|
|
14
|
+
--version 7.16 \
|
|
15
|
+
--values $LOCAL_ES_VALUES \
|
|
16
|
+
--set volumeClaimTemplate.storageClassName="ssd"
|
|
17
|
+
|
|
18
|
+
removeHelmRepo elastic
|