@leverege/build-tools 2.22.0 → 2.23.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 +3 -3
- package/src/bash-funcs +20 -1
- package/src/helmup +135 -385
- package/src/system-charts/cert-manager-local.yaml +43 -0
- package/src/system-charts/cert-manager.hup +5 -0
- package/src/system-charts/elasticsearch.hup +1 -3
- package/src/system-charts/grafana-local.yaml +29 -0
- package/src/system-charts/grafana.hup +2 -2
- package/src/system-charts/postgres.hup +3 -1
- package/src/system-charts/prometheus-local.yaml +6 -0
- package/src/system-charts/prometheus.hup +1 -1
- package/src/system-charts/redis-local.yaml +1 -1
- package/src/system-charts/redis.hup +1 -1
- package/src/system-charts/timescale-db.hup +2 -2
- package/src/system-charts/traefik-local.yaml +13 -0
- package/src/system-charts/traefik.hup +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"zx": "^7.1.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@babel/cli": "^7.
|
|
71
|
-
"@babel/core": "^7.20.
|
|
70
|
+
"@babel/cli": "^7.20.7",
|
|
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
74
|
"npm": "^9.2.0"
|
package/src/bash-funcs
CHANGED
|
@@ -84,6 +84,15 @@ function getManagedSecret() {
|
|
|
84
84
|
echo $SECRET
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
function getProjectIdFromK8sContext() {
|
|
88
|
+
local currContext=`kubectl config current-context`
|
|
89
|
+
|
|
90
|
+
IFS='_'
|
|
91
|
+
read -ra ADDR <<< "$currContext"
|
|
92
|
+
|
|
93
|
+
echo ${ADDR[1]} # project id is the second string split by _
|
|
94
|
+
}
|
|
95
|
+
|
|
87
96
|
function showInstalling() {
|
|
88
97
|
cat<<INSTALLING
|
|
89
98
|
|
|
@@ -94,6 +103,16 @@ $(color y '=====================================================================
|
|
|
94
103
|
INSTALLING
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
function skipInstalling() {
|
|
107
|
+
cat<<SKIPPING
|
|
108
|
+
|
|
109
|
+
$(color r '======================================================================')
|
|
110
|
+
|
|
111
|
+
Skipping => $(color y "$1")
|
|
112
|
+
|
|
113
|
+
SKIPPING
|
|
114
|
+
}
|
|
115
|
+
|
|
97
116
|
function addHelmRepo() {
|
|
98
117
|
local chart=$1
|
|
99
118
|
local url=$2
|
|
@@ -102,7 +121,7 @@ function addHelmRepo() {
|
|
|
102
121
|
Adding helm repo => $(color g "$chart") from $(color g "$url")
|
|
103
122
|
|
|
104
123
|
REPOADD
|
|
105
|
-
helm repo add $chart $url &> /dev/null
|
|
124
|
+
helm repo add --force-update $chart $url &> /dev/null
|
|
106
125
|
helm repo update &> /dev/null
|
|
107
126
|
}
|
|
108
127
|
|
package/src/helmup
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
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
|
+
|
|
10
13
|
# removed geotile-server from standard platform 3/20/22 - low usage
|
|
11
14
|
PLATFORM=(
|
|
12
15
|
authz-server
|
|
@@ -21,7 +24,7 @@ PLATFORM=(
|
|
|
21
24
|
scheduler
|
|
22
25
|
transponder-bq
|
|
23
26
|
transponder-rt
|
|
24
|
-
transponder-postgres
|
|
27
|
+
transponder-postgres # deprecated
|
|
25
28
|
transponder-tsdb
|
|
26
29
|
)
|
|
27
30
|
|
|
@@ -33,7 +36,7 @@ SYSTEM=(
|
|
|
33
36
|
preemptible-killer
|
|
34
37
|
zombie-killer
|
|
35
38
|
reloader
|
|
36
|
-
cert-manager
|
|
39
|
+
cert-manager # deprecated
|
|
37
40
|
traefik
|
|
38
41
|
velero
|
|
39
42
|
monitoring # do monitoring last to show password
|
|
@@ -57,33 +60,23 @@ CATNAMI
|
|
|
57
60
|
addHelmRepo bitnami $BITNAMI_URL
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
function getProjectIdFromK8sContext() {
|
|
61
|
-
local currContext=`kubectl config current-context`
|
|
62
|
-
|
|
63
|
-
IFS='_'
|
|
64
|
-
read -ra ADDR <<< "$currContext"
|
|
65
|
-
|
|
66
|
-
echo ${ADDR[1]} # project id is the second string split by _
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
function bindWorkloadIdentity(){
|
|
70
|
-
PROJECT_ID=$(getProjectIdFromK8sContext)
|
|
71
64
|
SVC_ACCT=$1
|
|
72
65
|
NAMESPACE=$2
|
|
73
|
-
SVC_ACCT_EMAIL="${SVC_ACCT}@${
|
|
66
|
+
SVC_ACCT_EMAIL="${SVC_ACCT}@${GCP_PROJECT_ID}.iam.gserviceaccount.com"
|
|
74
67
|
|
|
75
68
|
cat<<WORKLOAD_ID
|
|
76
69
|
Binding workload identity IAM policy
|
|
77
70
|
Service Account : `color g $SVC_ACCT`
|
|
78
|
-
Project : `color g $
|
|
71
|
+
Project : `color g $GCP_PROJECT_ID`
|
|
79
72
|
Namespace : `color g $NAMESPACE`
|
|
80
73
|
Service Email : `color g $SVC_ACCT_EMAIL`
|
|
81
74
|
|
|
82
75
|
WORKLOAD_ID
|
|
83
76
|
|
|
84
77
|
gcloud iam service-accounts add-iam-policy-binding \
|
|
85
|
-
--project $
|
|
86
|
-
--member "serviceAccount:$
|
|
78
|
+
--project $GCP_PROJECT_ID \
|
|
79
|
+
--member "serviceAccount:$GCP_PROJECT_ID.svc.id.goog[${NAMESPACE}/${SVC_ACCT}]" \
|
|
87
80
|
--role roles/iam.workloadIdentityUser $SVC_ACCT_EMAIL
|
|
88
81
|
warnOnError $? "gcloud workload identity binding may have failed"
|
|
89
82
|
|
|
@@ -111,7 +104,8 @@ function generatePassword(){
|
|
|
111
104
|
function createNamespaceIfNeeded(){
|
|
112
105
|
# Check the namespace exists in kubernetes
|
|
113
106
|
kubectl get namespace $1 &> /dev/null
|
|
114
|
-
if [[ $? -eq 1 ]];
|
|
107
|
+
if [[ $? -eq 1 ]];
|
|
108
|
+
then
|
|
115
109
|
printf "\n*** Creating $1 namespace ***\n\n"
|
|
116
110
|
kubectl create namespace $1
|
|
117
111
|
fi
|
|
@@ -157,20 +151,12 @@ function installGrafana() {
|
|
|
157
151
|
removeHelmRepo grafana
|
|
158
152
|
}
|
|
159
153
|
|
|
160
|
-
function
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
kubectl create secret generic postgresql-password \
|
|
168
|
-
--from-literal=postgresql-password=${psql_pw} \
|
|
169
|
-
--from-literal=postgresql-replication-password=${psql_rep_pw}
|
|
170
|
-
|
|
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"
|
|
154
|
+
function errorIfMissingSecret() {
|
|
155
|
+
SECRET="$1"
|
|
156
|
+
kubectl get secret $SECRET &> /dev/null
|
|
157
|
+
if [[ $? = 1 || SECRET = "" ]];
|
|
158
|
+
then
|
|
159
|
+
errorExit "missing secret `color y $SECRET` - did you `color g 'service-man --new-k8s'` ?"
|
|
174
160
|
fi
|
|
175
161
|
}
|
|
176
162
|
|
|
@@ -181,82 +167,57 @@ function installMonitoringCharts(){
|
|
|
181
167
|
# Add necessary helm repositories - note that stable is deprecated
|
|
182
168
|
addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
|
|
183
169
|
|
|
184
|
-
|
|
185
|
-
currContext=`kubectl config current-context`
|
|
186
|
-
|
|
187
|
-
IFS='_'
|
|
188
|
-
read -ra ADDR <<< "$currContext"
|
|
189
|
-
KUBERNETES_ENV=${ADDR[0]} # should be either gke or eks
|
|
190
|
-
GCP_PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
170
|
+
local SDEXP_SA='stackdriver-exporter'
|
|
191
171
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
then
|
|
195
|
-
kubectl get sa -n monitoring stackdriver-exporter &> /dev/null
|
|
196
|
-
if [[ $? -eq 0 ]];
|
|
197
|
-
then
|
|
198
|
-
cat<<SA_EXISTS
|
|
199
|
-
|
|
200
|
-
The stackdriver-exporter SA already exists which means installing the
|
|
201
|
-
helm chart is going to fail because it wants to manage that aspect of the
|
|
202
|
-
system. This most likely because the stackdriver exporter is already
|
|
203
|
-
installed and running. Run the following helm command to uninstall first:
|
|
172
|
+
# Uninstall the exporter if it is already on the cluster
|
|
173
|
+
helm uninstall -n monitoring $SDEXP_SA &>/dev/null
|
|
204
174
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
exitOnError 1 "uninstall the existing deployment in order to proceed"
|
|
209
|
-
fi
|
|
175
|
+
# NOTE: The k8s SA != GCP SA - the former is created by the helm chart
|
|
176
|
+
# that installs the stackdriver-exporter, the latter is handled here in
|
|
177
|
+
# order to provide the proper IAM permissions to the exporter.
|
|
210
178
|
|
|
211
|
-
|
|
179
|
+
# Create GCP SA and bind policies
|
|
180
|
+
printf "\n*** Creating GCP SA with monitoring/viewer ***\n"
|
|
181
|
+
gcloud iam service-accounts create $SDEXP_SA \
|
|
182
|
+
--project "$GCP_PROJECT_ID" \
|
|
183
|
+
--display-name "Prometheus Stackdriver Exporter" &>/dev/null
|
|
184
|
+
warnOnError $? "the GCP SA $SDEXP_SA may already exist"
|
|
212
185
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
186
|
+
printf "\n*** Binding IAM role of monitoring viewer to stackdriver-exporter in $GCP_PROJECT_ID\n"
|
|
187
|
+
gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
|
|
188
|
+
--role "roles/monitoring.viewer" \
|
|
189
|
+
--member "serviceAccount:$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" &>/dev/null
|
|
216
190
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
--project "$GCP_PROJECT_ID" \
|
|
232
|
-
--role "roles/iam.workloadIdentityUser" \
|
|
233
|
-
--member "serviceAccount:$GCP_PROJECT_ID.svc.id.goog[monitoring/$SDEXP_SA]" \
|
|
234
|
-
"$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
|
|
191
|
+
printf "\n*** Binding IAM role of workloadIdentityUser to stackdriver-exporter\n"
|
|
192
|
+
gcloud iam service-accounts add-iam-policy-binding \
|
|
193
|
+
--project "$GCP_PROJECT_ID" \
|
|
194
|
+
--role "roles/iam.workloadIdentityUser" \
|
|
195
|
+
--member "serviceAccount:$GCP_PROJECT_ID.svc.id.goog[monitoring/$SDEXP_SA]" \
|
|
196
|
+
"$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
|
|
197
|
+
|
|
198
|
+
# The GCP SA is now up but slight delay before launch helm to let the IAM update occur
|
|
199
|
+
sleep 2
|
|
200
|
+
helm upgrade --install stackdriver-exporter \
|
|
201
|
+
prometheus-community/prometheus-stackdriver-exporter \
|
|
202
|
+
--namespace monitoring \
|
|
203
|
+
--values stackdriver-exporter/values.yaml \
|
|
204
|
+
--version 3
|
|
235
205
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
then
|
|
248
|
-
printf "The $SDEXP_SA SA seems to be missing - did startup fail?\n"
|
|
249
|
-
else
|
|
250
|
-
# Annotate Kubernetes SA
|
|
251
|
-
printf "\n*** Annotating the stackdriver-exporter SA\n"
|
|
252
|
-
kubectl annotate serviceaccount $SDEXP_SA \
|
|
253
|
-
"iam.gke.io/gcp-service-account=$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
|
|
254
|
-
--namespace monitoring
|
|
255
|
-
fi
|
|
206
|
+
# Verify the Kubernetes SA
|
|
207
|
+
kubectl get sa -n monitoring $SDEXP_SA
|
|
208
|
+
if [[ $? -eq 1 ]];
|
|
209
|
+
then
|
|
210
|
+
printf "The $SDEXP_SA SA seems to be missing - did startup fail?\n"
|
|
211
|
+
else
|
|
212
|
+
# Annotate Kubernetes SA
|
|
213
|
+
printf "\n*** Annotating the stackdriver-exporter SA\n"
|
|
214
|
+
kubectl annotate serviceaccount $SDEXP_SA \
|
|
215
|
+
"iam.gke.io/gcp-service-account=$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
|
|
216
|
+
--namespace monitoring
|
|
256
217
|
fi
|
|
257
218
|
|
|
258
219
|
## Install Prometheus
|
|
259
|
-
|
|
220
|
+
bootstrapLocalSetup prometheus set-values-local
|
|
260
221
|
|
|
261
222
|
## Installing ES exporter
|
|
262
223
|
helm upgrade --install elasticsearch-exporter prometheus-community/prometheus-elasticsearch-exporter \
|
|
@@ -272,7 +233,7 @@ es:
|
|
|
272
233
|
ELASTIC_EXPORTER_CHART_MOD
|
|
273
234
|
|
|
274
235
|
## Install Grafana
|
|
275
|
-
|
|
236
|
+
bootstrapLocalSetup grafana
|
|
276
237
|
|
|
277
238
|
## Clean up
|
|
278
239
|
removeHelmRepo prometheus-community
|
|
@@ -295,38 +256,13 @@ function monitoringHelp(){
|
|
|
295
256
|
kubectl --namespace monitoring port-forward \$GRAFANA_POD 3000 &
|
|
296
257
|
sleep 2; open http://localhost:3000
|
|
297
258
|
|
|
298
|
-
`color toast "Save monitoring login to
|
|
259
|
+
`color toast "Save monitoring login to Keeper"` => `color r "admin / $MONPASS"`
|
|
299
260
|
|
|
300
261
|
`color g "Show this helpful message again with"` => `color r "helmup monitoring-wtf"`
|
|
301
262
|
|
|
302
263
|
ACCESS
|
|
303
264
|
}
|
|
304
265
|
|
|
305
|
-
function createSSDYAML(){
|
|
306
|
-
cat<<EOSSD > ${K8S_UTILS}/ssd-storageclass.yaml
|
|
307
|
-
apiVersion: storage.k8s.io/v1
|
|
308
|
-
kind: StorageClass
|
|
309
|
-
metadata:
|
|
310
|
-
name: ssd
|
|
311
|
-
provisioner: kubernetes.io/gce-pd
|
|
312
|
-
parameters:
|
|
313
|
-
type: pd-ssd
|
|
314
|
-
EOSSD
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function checkSSDStorageClass(){
|
|
318
|
-
kubectl get storageclass ssd
|
|
319
|
-
if [[ $? -eq 1 ]]; then
|
|
320
|
-
printf "\n*** SSD Storage Class not defined ***\n\n"
|
|
321
|
-
if [ ! -f ${K8S_UTILS}/ssd-storageclass.yaml ]; then
|
|
322
|
-
createSSDYAML
|
|
323
|
-
fi
|
|
324
|
-
kubectl apply -f ${K8S_UTILS}/ssd-storageclass.yaml
|
|
325
|
-
fi
|
|
326
|
-
|
|
327
|
-
printf "\n*** Attaching PVC to SSD Class ***\n\n"
|
|
328
|
-
}
|
|
329
|
-
|
|
330
266
|
function getManagedSecret() {
|
|
331
267
|
local SECNAME=$1
|
|
332
268
|
local PROJECT="${2:-leverege-docker-images}"
|
|
@@ -344,7 +280,6 @@ function getManagedSecret() {
|
|
|
344
280
|
function installPreemptibleKiller() {
|
|
345
281
|
showInstalling "Preemptible Node Killing Coordinator"
|
|
346
282
|
NAMESPACE="estafette"
|
|
347
|
-
PROJECT_ID="$(getProjectIdFromK8sContext)"
|
|
348
283
|
SVC_ACCT="preemptible-killer"
|
|
349
284
|
|
|
350
285
|
createNamespaceIfNeeded $NAMESPACE
|
|
@@ -352,24 +287,24 @@ function installPreemptibleKiller() {
|
|
|
352
287
|
|
|
353
288
|
printf "\nCreating the gcloud $SVC_ACCT service account (SA)\n"
|
|
354
289
|
gcloud iam service-accounts create $SVC_ACCT \
|
|
355
|
-
--project $
|
|
290
|
+
--project $GCP_PROJECT_ID \
|
|
356
291
|
--description "Estafette Node Killer SA" \
|
|
357
292
|
--display-name "Estafette Node Killer SA"
|
|
358
293
|
warnOnError $? "SA creation may have failed or it already exists"
|
|
359
294
|
|
|
360
295
|
printf "\nCreate the $SVC_ACCT IAM role\n"
|
|
361
296
|
gcloud iam roles create preemptibleKiller \
|
|
362
|
-
--project $
|
|
297
|
+
--project $GCP_PROJECT_ID \
|
|
363
298
|
--title "Estafette Node Killer" \
|
|
364
299
|
--description "Delete compute instances" \
|
|
365
300
|
--permissions compute.instances.delete
|
|
366
301
|
warnOnError $? "Role creation may have failed or it already exists"
|
|
367
302
|
|
|
368
|
-
local service_account_email=$(gcloud iam --project=$
|
|
303
|
+
local service_account_email=$(gcloud iam --project=$GCP_PROJECT_ID service-accounts list --filter $SVC_ACCT --format 'value([email])')
|
|
369
304
|
printf "\nBinding the IAM role to the $SVC_ACCT SA\n"
|
|
370
|
-
gcloud projects add-iam-policy-binding $
|
|
305
|
+
gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
|
|
371
306
|
--member=serviceAccount:${service_account_email} \
|
|
372
|
-
--role=projects/${
|
|
307
|
+
--role=projects/${GCP_PROJECT_ID}/roles/preemptibleKiller &> /dev/null
|
|
373
308
|
warnOnError $? "Binding may have failed or it already exists"
|
|
374
309
|
|
|
375
310
|
bindWorkloadIdentity $SVC_ACCT $NAMESPACE
|
|
@@ -377,7 +312,7 @@ function installPreemptibleKiller() {
|
|
|
377
312
|
helm upgrade --install estafette-gke-preemptible-killer \
|
|
378
313
|
estafette/estafette-gke-preemptible-killer \
|
|
379
314
|
--namespace ${NAMESPACE} \
|
|
380
|
-
--set secret.workloadIdentityServiceAccount="$SVC_ACCT@$
|
|
315
|
+
--set secret.workloadIdentityServiceAccount="$SVC_ACCT@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
|
|
381
316
|
--set extraEnv.BLACKLIST_HOURS="10:00-02:00" # No killing from 5AM-9PM EST
|
|
382
317
|
# --set extraEnv.WHITELIST_HOURS="12:30-13:30"
|
|
383
318
|
[ -f "google_service_account.json" ] && rm google_service_account.json
|
|
@@ -466,14 +401,15 @@ function installCertManager() {
|
|
|
466
401
|
createNamespaceIfNeeded cert-manager
|
|
467
402
|
|
|
468
403
|
kubectl get secret cloudflare --namespace cert-manager &>/dev/null
|
|
469
|
-
if [[ $? -eq 1 ]];
|
|
404
|
+
if [[ $? -eq 1 ]];
|
|
405
|
+
then
|
|
470
406
|
cat<<NEED_MANAGED_SECRET
|
|
471
407
|
$RED_ERROR missing secret: `color y cloudflare` namespace: `color y cert-manager`
|
|
472
408
|
|
|
473
|
-
This secret
|
|
474
|
-
|
|
409
|
+
This secret will be fetched from the leverege-docker-images cluster and
|
|
410
|
+
injected into this cluster.
|
|
475
411
|
NEED_MANAGED_SECRET
|
|
476
|
-
yesToContinue "to copy and inject the cloudflare secret"
|
|
412
|
+
#yesToContinue "to copy and inject the cloudflare secret"
|
|
477
413
|
TOKEN=$(getManagedSecret "CLOUDFLARE_API_TOKEN")
|
|
478
414
|
if [ $? -ne 0 ];
|
|
479
415
|
then
|
|
@@ -501,7 +437,8 @@ DELAY
|
|
|
501
437
|
sleep 20
|
|
502
438
|
kubectl -n cert-manager apply -f cert-manager
|
|
503
439
|
|
|
504
|
-
if [[ $? -eq 1 ]];
|
|
440
|
+
if [[ $? -eq 1 ]];
|
|
441
|
+
then
|
|
505
442
|
|
|
506
443
|
`color y "***WARNING: cert-manager components still coming up"`
|
|
507
444
|
|
|
@@ -518,19 +455,19 @@ HINTS
|
|
|
518
455
|
removeHelmRepo jetstack
|
|
519
456
|
}
|
|
520
457
|
|
|
521
|
-
function
|
|
522
|
-
showInstalling "Traefik
|
|
458
|
+
function installTraefikEnvironment() {
|
|
459
|
+
showInstalling "Traefik Namespace and Cloudflare Secret"
|
|
523
460
|
createNamespaceIfNeeded traefik
|
|
524
461
|
|
|
525
462
|
kubectl get secret cloudflare --namespace traefik &>/dev/null
|
|
526
|
-
if [[ $? -eq 1 ]];
|
|
463
|
+
if [[ $? -eq 1 ]];
|
|
464
|
+
then
|
|
527
465
|
cat<<NEED_TRAEFIK_SECRET
|
|
528
466
|
$RED_ERROR missing secret: `color y cloudflare` namespace: `color y traefik`
|
|
529
467
|
|
|
530
|
-
|
|
531
|
-
|
|
468
|
+
Injecting the `color y cloudflare` secret from the `color g leverege-docker-images` cluster.
|
|
469
|
+
|
|
532
470
|
NEED_TRAEFIK_SECRET
|
|
533
|
-
yesToContinue "to copy and inject the cloudflare secret"
|
|
534
471
|
TOKEN=$(getManagedSecret "CLOUDFLARE_API_TOKEN")
|
|
535
472
|
if [ $? -ne 0 ];
|
|
536
473
|
then
|
|
@@ -542,65 +479,25 @@ NEED_TRAEFIK_SECRET
|
|
|
542
479
|
--namespace traefik \
|
|
543
480
|
--from-literal=dns-token=$TOKEN
|
|
544
481
|
fi
|
|
545
|
-
|
|
546
|
-
TRAEFIK_DIR="traefik"
|
|
547
|
-
[ ! -d "$TRAEFIK_DIR" ] && mkdir $TRAEFIK_DIR
|
|
548
|
-
TRAEFIK_HA_YAML="$TRAEFIK_DIR/traefik-ha-values.yaml"
|
|
549
|
-
if [ ! -f "$TRAEFIK_HA_YAML" ];
|
|
550
|
-
then
|
|
551
|
-
touch "$TRAEFIK_DIR/.nohelm"
|
|
552
|
-
cat<<TRAEFIK_CFG>>"$TRAEFIK_HA_YAML"
|
|
553
|
-
additionalArguments:
|
|
554
|
-
- "--accesslog=true"
|
|
555
|
-
- "--accesslog.format=json"
|
|
556
|
-
- "--log.level=WARN"
|
|
557
|
-
- "--metrics.prometheus=true"
|
|
558
|
-
- "--api.dashboard=true"
|
|
559
|
-
|
|
560
|
-
deployment:
|
|
561
|
-
replicas: 3
|
|
562
|
-
|
|
563
|
-
#service:
|
|
564
|
-
# spec:
|
|
565
|
-
# loadBalancerIP: xx.xx.xx.xx
|
|
566
|
-
TRAEFIK_CFG
|
|
567
|
-
fi
|
|
568
|
-
|
|
569
|
-
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
570
|
-
|
|
571
|
-
[ -z "$TRAEFIK_HELM_CHART" ] && TRAEFIK_HELM_CHART="16"
|
|
572
|
-
helm upgrade --install traefik traefik/traefik \
|
|
573
|
-
--namespace traefik \
|
|
574
|
-
--version $TRAEFIK_HELM_CHART \
|
|
575
|
-
--values $TRAEFIK_HA_YAML
|
|
576
|
-
|
|
577
|
-
removeHelmRepo traefik
|
|
578
482
|
}
|
|
579
483
|
|
|
580
484
|
function installVelero() {
|
|
581
485
|
# Follows instructions => https://github.com/vmware-tanzu/velero-plugin-for-gcp
|
|
582
486
|
showInstalling "Velero Backup Management"
|
|
583
487
|
|
|
584
|
-
|
|
585
|
-
currContext=`kubectl config current-context`
|
|
586
|
-
|
|
587
|
-
IFS='_'
|
|
588
|
-
read -ra ADDR <<< "$currContext"
|
|
589
|
-
|
|
590
|
-
PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
591
|
-
|
|
592
|
-
gcloud config set project $PROJECT_ID
|
|
488
|
+
gcloud config set project $GCP_PROJECT_ID
|
|
593
489
|
|
|
594
490
|
## Create a bucket
|
|
595
|
-
BUCKET="$
|
|
596
|
-
|
|
597
|
-
|
|
491
|
+
BUCKET="$GCP_PROJECT_ID-velero"
|
|
492
|
+
GCE_REGION=`overwhelm -k GCE_REGION`
|
|
493
|
+
printf "\nCreating storage bucket `color g $BUCKET` in `color g $GCE_REGION`\n"
|
|
494
|
+
gsutil mb -l $GCE_REGION gs://$BUCKET/ &> /dev/null
|
|
598
495
|
warnOnError $? "Bucket failed to create or already exists - go check it\n"
|
|
599
496
|
|
|
600
497
|
## Create a service account
|
|
601
498
|
printf "\nCreating the service account\n"
|
|
602
499
|
gcloud iam service-accounts create velero \
|
|
603
|
-
--project $
|
|
500
|
+
--project $GCP_PROJECT_ID \
|
|
604
501
|
--display-name "Velero service account" \
|
|
605
502
|
--description "Velero service account" &>/dev/null
|
|
606
503
|
if [ $? -eq 0 ];
|
|
@@ -611,7 +508,7 @@ function installVelero() {
|
|
|
611
508
|
printf "$YELO_WARN Failed to create the service account - does it already exist?"
|
|
612
509
|
fi
|
|
613
510
|
|
|
614
|
-
SERVICE_ACCOUNT_EMAIL="velero@${
|
|
511
|
+
SERVICE_ACCOUNT_EMAIL="velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com"
|
|
615
512
|
|
|
616
513
|
## Attach roles
|
|
617
514
|
ROLE_PERMISSIONS=(
|
|
@@ -624,6 +521,7 @@ function installVelero() {
|
|
|
624
521
|
compute.snapshots.delete
|
|
625
522
|
compute.zones.get
|
|
626
523
|
iam.serviceAccounts.actAs
|
|
524
|
+
iam.serviceAccounts.signBlob
|
|
627
525
|
storage.objects.create
|
|
628
526
|
storage.objects.delete
|
|
629
527
|
storage.objects.get
|
|
@@ -632,7 +530,7 @@ function installVelero() {
|
|
|
632
530
|
|
|
633
531
|
printf "\nAssigning roles to the SA\n"
|
|
634
532
|
gcloud iam roles create velero.server \
|
|
635
|
-
--project $
|
|
533
|
+
--project $GCP_PROJECT_ID \
|
|
636
534
|
--title "Velero Server" \
|
|
637
535
|
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &>/dev/null
|
|
638
536
|
if [ $? -ne 0 ];
|
|
@@ -640,23 +538,23 @@ function installVelero() {
|
|
|
640
538
|
# assume error is that role exists so try updating instead
|
|
641
539
|
printf "\nUpdating roles on the SA\n"
|
|
642
540
|
gcloud iam roles update velero.server \
|
|
643
|
-
--project $
|
|
541
|
+
--project $GCP_PROJECT_ID \
|
|
644
542
|
--title "Velero Server" \
|
|
645
543
|
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")" &>/dev/null
|
|
646
544
|
fi
|
|
647
545
|
warnOnError $? "Failed to add roles to velero.server - perhaps they already exist?"
|
|
648
546
|
|
|
649
547
|
printf "\nBinding IAM policy to the SA\n"
|
|
650
|
-
gcloud projects add-iam-policy-binding $
|
|
651
|
-
--project $
|
|
548
|
+
gcloud projects add-iam-policy-binding $GCP_PROJECT_ID \
|
|
549
|
+
--project $GCP_PROJECT_ID \
|
|
652
550
|
--member serviceAccount:$SERVICE_ACCOUNT_EMAIL \
|
|
653
551
|
--condition 'None' \
|
|
654
|
-
--role projects/$
|
|
552
|
+
--role projects/$GCP_PROJECT_ID/roles/velero.server &>/dev/null
|
|
655
553
|
warnOnError $? "gcloud problem binding IAM policy"
|
|
656
554
|
|
|
657
555
|
printf "\nBinding workload identity IAM policy to the SA\n"
|
|
658
556
|
gcloud iam service-accounts add-iam-policy-binding \
|
|
659
|
-
--member "serviceAccount:$
|
|
557
|
+
--member "serviceAccount:$GCP_PROJECT_ID.svc.id.goog[velero/velero]" \
|
|
660
558
|
--role roles/iam.workloadIdentityUser \
|
|
661
559
|
$SERVICE_ACCOUNT_EMAIL
|
|
662
560
|
warnOnError $? "gcloud workload identity binding may have failed"
|
|
@@ -677,26 +575,29 @@ function installVelero() {
|
|
|
677
575
|
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://$BUCKET
|
|
678
576
|
|
|
679
577
|
## Clean up from previous failed install
|
|
680
|
-
kubectl delete volumesnapshotlocation.velero.io -n velero
|
|
578
|
+
kubectl delete volumesnapshotlocation.velero.io -n velero gcp &>/dev/null
|
|
681
579
|
|
|
682
|
-
## Install velero chart
|
|
683
|
-
##
|
|
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
|
|
684
583
|
addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
685
|
-
|
|
584
|
+
## Build velero command
|
|
585
|
+
[ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
|
|
686
586
|
helm upgrade --install velero vmware-tanzu/velero \
|
|
687
|
-
--version $VELERO_HELM_CHART \
|
|
688
|
-
--namespace velero \
|
|
587
|
+
--version "$VELERO_HELM_CHART" \
|
|
588
|
+
--namespace "velero" \
|
|
689
589
|
--set credentials.useSecret="false" \
|
|
690
590
|
--set configuration.provider="gcp" \
|
|
691
|
-
--set configuration.backupStorageLocation.name=default \
|
|
591
|
+
--set configuration.backupStorageLocation.name="default" \
|
|
692
592
|
--set configuration.backupStorageLocation.bucket="${BUCKET}" \
|
|
693
|
-
--set configuration.backupStorageLocation.config.serviceAccount
|
|
593
|
+
--set configuration.backupStorageLocation.config.serviceAccount="$SERVICE_ACCOUNT_EMAIL" \
|
|
694
594
|
--set serviceAccount.server.create="false" \
|
|
695
595
|
--set serviceAccount.server.name="velero" \
|
|
696
596
|
--set snapshotsEnabled="true" \
|
|
697
|
-
--set configuration.volumeSnapshotLocation.name=default \
|
|
597
|
+
--set configuration.volumeSnapshotLocation.name="default" \
|
|
598
|
+
--set configuration.volumeSnapshotLocation.config.snapshotLocation="$GCE_REGION" \
|
|
698
599
|
--set "initContainers[0].name"="velero-plugin-for-gcp" \
|
|
699
|
-
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.
|
|
600
|
+
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.5.0" \
|
|
700
601
|
--set "initContainers[0].volumeMounts[0].mountPath"="/target" \
|
|
701
602
|
--set "initContainers[0].volumeMounts[0].name"="plugins" \
|
|
702
603
|
--set schedules.postgresql.schedule="0 2 * * *" \
|
|
@@ -708,15 +609,31 @@ function installVelero() {
|
|
|
708
609
|
--set schedules.timescale.template.ttl="720h" \
|
|
709
610
|
--set schedules.timescale.template.labelSelector.matchLabels.release="timescale-db" \
|
|
710
611
|
--set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
|
|
711
|
-
--set schedules.timescale.template.snapshotVolumes="true"
|
|
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"
|
|
712
617
|
|
|
713
618
|
velero get backups
|
|
714
619
|
cat<<DONE_VELERO
|
|
715
620
|
|
|
716
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
|
+
|
|
717
635
|
DONE_VELERO
|
|
718
636
|
removeHelmRepo vmware-tanzu
|
|
719
|
-
echo -n "npm run ahoy && velero get backups" | pbcopy
|
|
720
637
|
}
|
|
721
638
|
|
|
722
639
|
# If a helmup.plugin file exists and is executable helmup assumes it is
|
|
@@ -737,12 +654,12 @@ PLUGIN_NOEXEC
|
|
|
737
654
|
fi
|
|
738
655
|
|
|
739
656
|
printf "\n***Executing local plugin code => `color y $PLUGIN`\n\n" && sleep 2
|
|
657
|
+
export HELM_WHAT
|
|
740
658
|
. $PLUGIN # executing with . allows the plugin to use functions like color
|
|
741
659
|
return 0
|
|
742
660
|
}
|
|
743
661
|
|
|
744
662
|
function getServiceAndChartVersion() {
|
|
745
|
-
|
|
746
663
|
SERVICE=
|
|
747
664
|
CHARTVER=
|
|
748
665
|
FROM_VERSIONS=
|
|
@@ -806,7 +723,7 @@ function doInstall() {
|
|
|
806
723
|
[ ! -z "$CHARTVER" ] && CHARTVER="--version $CHARTVER"
|
|
807
724
|
|
|
808
725
|
# set the dry-run flag on what
|
|
809
|
-
[ "`basename $0`" == "helmwhat" ] &&
|
|
726
|
+
[ "`basename $0`" == "helmwhat" ] && HELM_WHAT="--dry-run --debug"
|
|
810
727
|
|
|
811
728
|
# If we're referencing a plugin then execute it and continue
|
|
812
729
|
ifPluggedIn $SERVICE && continue
|
|
@@ -821,7 +738,8 @@ function doInstall() {
|
|
|
821
738
|
;;
|
|
822
739
|
|
|
823
740
|
"cert-manager")
|
|
824
|
-
installCertManager
|
|
741
|
+
#installCertManager
|
|
742
|
+
bootstrapLocalSetup cert-manager
|
|
825
743
|
;;
|
|
826
744
|
|
|
827
745
|
"cronZombieKiller"|"zombie-killer")
|
|
@@ -841,7 +759,7 @@ function doInstall() {
|
|
|
841
759
|
;;
|
|
842
760
|
|
|
843
761
|
"grafana")
|
|
844
|
-
|
|
762
|
+
bootstrapLocalSetup grafana
|
|
845
763
|
;;
|
|
846
764
|
|
|
847
765
|
"monitoring")
|
|
@@ -878,12 +796,13 @@ function doInstall() {
|
|
|
878
796
|
|
|
879
797
|
transponder-*)
|
|
880
798
|
# transponders use the same chart but different deployment name
|
|
881
|
-
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $
|
|
799
|
+
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $HELM_WHAT"
|
|
882
800
|
doHelmup "$HELMUP"
|
|
883
801
|
;;
|
|
884
802
|
|
|
885
803
|
"traefik")
|
|
886
|
-
|
|
804
|
+
installTraefikEnvironment
|
|
805
|
+
bootstrapLocalSetup traefik
|
|
887
806
|
;;
|
|
888
807
|
|
|
889
808
|
"velero")
|
|
@@ -929,7 +848,7 @@ NO_SERVICE_MAN
|
|
|
929
848
|
MUSEUM=$(<${OVERRIDE})
|
|
930
849
|
printf "\n$YELO_WARN Local chartmuseum name override from ${SERVICE} to ${MUSEUM}\n"
|
|
931
850
|
fi
|
|
932
|
-
HELMUP="helm upgrade --install $SERVICE leverege/$MUSEUM -f $SERVICE/values.yaml $CHARTVER $
|
|
851
|
+
HELMUP="helm upgrade --install $SERVICE leverege/$MUSEUM -f $SERVICE/values.yaml $CHARTVER $HELM_WHAT"
|
|
933
852
|
doHelmup $HELMUP
|
|
934
853
|
SAVERR=$?
|
|
935
854
|
if [ $SAVERR -ne 0 ];
|
|
@@ -957,177 +876,8 @@ NOTRUNNING
|
|
|
957
876
|
GITTOP=`git rev-parse --show-toplevel` # `&& cd $GITTOP
|
|
958
877
|
K8S_UTILS="${GITTOP}/k8s-utils"
|
|
959
878
|
|
|
960
|
-
overwhelm
|
|
879
|
+
overwhelm
|
|
961
880
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
962
881
|
|
|
963
882
|
doInstall $@
|
|
964
883
|
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
|
-
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# cert-manager is disabled
|
|
2
|
+
#
|
|
3
|
+
# cluster-issuer.yaml.ovh
|
|
4
|
+
#
|
|
5
|
+
apiVersion: cert-manager.io/v1
|
|
6
|
+
kind: ClusterIssuer
|
|
7
|
+
metadata:
|
|
8
|
+
name: letsencrypt-prd
|
|
9
|
+
spec:
|
|
10
|
+
acme:
|
|
11
|
+
# You must replace this email address with your own.
|
|
12
|
+
# Let's Encrypt will use this to contact you about expiring
|
|
13
|
+
# certificates, and issues related to your account.
|
|
14
|
+
email: devops@leverege.com
|
|
15
|
+
server: https://acme-v02.api.letsencrypt.org/directory
|
|
16
|
+
privateKeySecretRef:
|
|
17
|
+
# Secret resource used to store the account's private key.
|
|
18
|
+
name: issuer-account-key
|
|
19
|
+
# Add a single challenge solver, HTTP01 using nginx
|
|
20
|
+
solvers:
|
|
21
|
+
- dns01:
|
|
22
|
+
cloudflare:
|
|
23
|
+
email: devops@leverege.com
|
|
24
|
+
apiTokenSecretRef:
|
|
25
|
+
name: cloudflare
|
|
26
|
+
key: dns-token
|
|
27
|
+
selector:
|
|
28
|
+
dnsZones:
|
|
29
|
+
- 'OVH:<HOST>.com'
|
|
30
|
+
---
|
|
31
|
+
#
|
|
32
|
+
# this-service.yaml.ovh
|
|
33
|
+
#
|
|
34
|
+
kind: Certificate
|
|
35
|
+
metadata:
|
|
36
|
+
name: OVH:<PROJECT_ID>
|
|
37
|
+
spec:
|
|
38
|
+
secretName: OVH:<PROJECT_ID>-cert
|
|
39
|
+
dnsNames:
|
|
40
|
+
- '*.OVH:<HOST>.com'
|
|
41
|
+
issuerRef:
|
|
42
|
+
name: letsencrypt-prd
|
|
43
|
+
kind: ClusterIssuer
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
#
|
|
5
5
|
showInstalling "Elastic Search"
|
|
6
6
|
|
|
7
|
-
checkSSDStorageClass
|
|
8
|
-
|
|
9
7
|
LOCAL_ES_VALUES="elasticsearch/elasticsearch-local.yaml"
|
|
10
8
|
[ ! -f "$LOCAL_ES_VALUES" ] && exitOnError 1 "Missing the local ES config file => `color y $LOCAL_ES_VALUES`"
|
|
11
9
|
|
|
@@ -13,6 +11,6 @@ addHelmRepo elastic https://helm.elastic.co
|
|
|
13
11
|
helm upgrade --install elasticsearch elastic/elasticsearch \
|
|
14
12
|
--version 7.16 \
|
|
15
13
|
--values $LOCAL_ES_VALUES \
|
|
16
|
-
--set volumeClaimTemplate.storageClassName="ssd"
|
|
14
|
+
--set volumeClaimTemplate.storageClassName="ssd" $HELM_WHAT
|
|
17
15
|
|
|
18
16
|
removeHelmRepo elastic
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
service:
|
|
2
|
+
type: "NodePort"
|
|
3
|
+
port: "9000"
|
|
4
|
+
|
|
5
|
+
persistence:
|
|
6
|
+
enabled: true
|
|
7
|
+
storageClassName: ssd
|
|
8
|
+
|
|
9
|
+
plugins:
|
|
10
|
+
- grafana-piechart-panel
|
|
11
|
+
- agenty-flowcharting-panel
|
|
12
|
+
|
|
13
|
+
deploymentStrategy:
|
|
14
|
+
type: Recreate
|
|
15
|
+
|
|
16
|
+
affinity:
|
|
17
|
+
nodeAffinity:
|
|
18
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
19
|
+
nodeSelectorTerms:
|
|
20
|
+
- matchExpressions:
|
|
21
|
+
- key: target-env
|
|
22
|
+
operator: In
|
|
23
|
+
values:
|
|
24
|
+
- database
|
|
25
|
+
tolerations:
|
|
26
|
+
- key: "database"
|
|
27
|
+
operator: "Equal"
|
|
28
|
+
value: "true"
|
|
29
|
+
effect: "NoSchedule"
|
|
@@ -9,7 +9,7 @@ addHelmRepo grafana https://grafana.github.io/helm-charts
|
|
|
9
9
|
[ -z "$GRAFANA_HELM_CHART" ] && GRAFANA_HELM_CHART="6"
|
|
10
10
|
helm upgrade --install grafana grafana/grafana \
|
|
11
11
|
--namespace monitoring \
|
|
12
|
-
--values grafana/
|
|
13
|
-
--version $GRAFANA_HELM_CHART
|
|
12
|
+
--values grafana/grafana-local.yaml \
|
|
13
|
+
--version $GRAFANA_HELM_CHART $HELM_WHAT
|
|
14
14
|
|
|
15
15
|
removeHelmRepo grafana
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
#
|
|
3
3
|
showInstalling "PostgreSQL Database"
|
|
4
4
|
|
|
5
|
+
errorIfMissingSecret authz-postgres
|
|
6
|
+
|
|
5
7
|
addBitnamiRepo
|
|
6
8
|
|
|
7
9
|
helm upgrade --install postgres bitnami/postgresql \
|
|
8
10
|
--values postgres/postgres-local.yaml \
|
|
9
|
-
--version 10
|
|
11
|
+
--version 10 $HELM_WHAT
|
|
10
12
|
|
|
11
13
|
removeHelmRepo bitnami
|
|
@@ -784,3 +784,9 @@ server:
|
|
|
784
784
|
|
|
785
785
|
pushgateway:
|
|
786
786
|
enabled: false
|
|
787
|
+
|
|
788
|
+
# temp set to false if upgrade errors with something like:
|
|
789
|
+
# Error: UPGRADE FAILED: cannot patch "prometheus-kube-state-metrics" ... field is immutable
|
|
790
|
+
#
|
|
791
|
+
kubeStateMetrics:
|
|
792
|
+
enabled: true
|
|
@@ -10,6 +10,6 @@ addHelmRepo prometheus-community https://prometheus-community.github.io/helm-cha
|
|
|
10
10
|
helm upgrade --install prometheus prometheus-community/prometheus \
|
|
11
11
|
--namespace monitoring \
|
|
12
12
|
--values prometheus/values.yaml \
|
|
13
|
-
--version $PROMETHEUS_HELM_CHART
|
|
13
|
+
--version $PROMETHEUS_HELM_CHART $HELM_WHAT
|
|
14
14
|
|
|
15
15
|
removeHelmRepo prometheus-community
|
|
@@ -7,6 +7,6 @@ addBitnamiRepo latest
|
|
|
7
7
|
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="17" # latest chart 17 is redis v7
|
|
8
8
|
helm upgrade --install redis bitnami/redis \
|
|
9
9
|
--values redis/redis-local.yaml \
|
|
10
|
-
--version $REDIS_HELM_CHART
|
|
10
|
+
--version $REDIS_HELM_CHART $HELM_WHAT
|
|
11
11
|
|
|
12
12
|
removeHelmRepo bitnami
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
showInstalling "Timescale Database (Leverege chart)"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
errorIfMissingSecret postgresql-password
|
|
6
6
|
|
|
7
7
|
[ -z "$TIMESCALE_HELM_CHART" ] && TIMESCALE_HELM_CHART="2"
|
|
8
8
|
helm upgrade --install timescale-db leverege/timescale-db \
|
|
9
9
|
--values timescale-db/timescale-db-local.yaml \
|
|
10
|
-
--version $TIMESCALE_HELM_CHART
|
|
10
|
+
--version $TIMESCALE_HELM_CHART $HELM_WHAT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
showInstalling "Traefik Load Balancer / Router"
|
|
4
|
+
|
|
5
|
+
#TRAEFIK_NAMESPACE="traefik-canary"
|
|
6
|
+
TRAEFIK_NAMESPACE="traefik"
|
|
7
|
+
createNamespaceIfNeeded $TRAEFIK_NAMESPACE
|
|
8
|
+
|
|
9
|
+
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
10
|
+
|
|
11
|
+
[ -z "$TRAEFIK_HELM_CHART" ] && TRAEFIK_HELM_CHART="16"
|
|
12
|
+
helm upgrade --install traefik traefik/traefik \
|
|
13
|
+
--namespace traefik \
|
|
14
|
+
--values traefik/traefik-local.yaml \
|
|
15
|
+
--version $TRAEFIK_HELM_CHART $HELM_WHAT
|
|
16
|
+
|
|
17
|
+
removeHelmRepo traefik
|