@leverege/build-tools 2.21.14 → 2.22.1
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/overwhelm.js +10 -0
- package/lib/web/build-tools.js +9 -0
- package/lib/web/overwhelm.js +10 -0
- package/package.json +5 -5
- package/src/bash-funcs +1 -1
- package/src/build-tools.js +10 -0
- package/src/helmup +246 -174
- 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-local.yaml +29 -0
- package/src/system-charts/grafana.hup +17 -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 +792 -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
- package/src/system-charts/traefik-local.yaml +13 -0
- package/src/system-charts/traefik.hup +13 -0
- package/leverege-build-tools-2.21.13.tgz +0 -0
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
|
|
|
@@ -584,8 +518,8 @@ HINTS
|
|
|
584
518
|
removeHelmRepo jetstack
|
|
585
519
|
}
|
|
586
520
|
|
|
587
|
-
function
|
|
588
|
-
showInstalling "Traefik
|
|
521
|
+
function installTraefikEnvironment() {
|
|
522
|
+
showInstalling "Traefik Namespace and Cloudflare Secret"
|
|
589
523
|
createNamespaceIfNeeded traefik
|
|
590
524
|
|
|
591
525
|
kubectl get secret cloudflare --namespace traefik &>/dev/null
|
|
@@ -608,36 +542,6 @@ NEED_TRAEFIK_SECRET
|
|
|
608
542
|
--namespace traefik \
|
|
609
543
|
--from-literal=dns-token=$TOKEN
|
|
610
544
|
fi
|
|
611
|
-
|
|
612
|
-
TRAEFIK_HA_YAML="traefik/traefik-ha-values.yaml"
|
|
613
|
-
if [ ! -f "$TRAEFIK_HA_YAML" ];
|
|
614
|
-
then
|
|
615
|
-
cat<<TRAEFIK_CFG>>"$TRAEFIK_HA_YAML"
|
|
616
|
-
additionalArguments:
|
|
617
|
-
- "--accesslog=true"
|
|
618
|
-
- "--accesslog.format=json"
|
|
619
|
-
- "--log.level=WARN"
|
|
620
|
-
- "--metrics.prometheus=true"
|
|
621
|
-
- "--api.dashboard=true"
|
|
622
|
-
|
|
623
|
-
deployment:
|
|
624
|
-
replicas: 3
|
|
625
|
-
|
|
626
|
-
#service:
|
|
627
|
-
# spec:
|
|
628
|
-
# loadBalancerIP: xx.xx.xx.xx
|
|
629
|
-
TRAEFIK_CFG
|
|
630
|
-
fi
|
|
631
|
-
|
|
632
|
-
addHelmRepo traefik https://helm.traefik.io/traefik
|
|
633
|
-
|
|
634
|
-
[ -z "$TRAEFIK_HELM_CHART" ] && TRAEFIK_HELM_CHART="12"
|
|
635
|
-
helm upgrade --install traefik traefik/traefik \
|
|
636
|
-
--namespace traefik \
|
|
637
|
-
--version $TRAEFIK_HELM_CHART \
|
|
638
|
-
--values $TRAEFIK_HA_YAML
|
|
639
|
-
|
|
640
|
-
removeHelmRepo traefik
|
|
641
545
|
}
|
|
642
546
|
|
|
643
547
|
function installVelero() {
|
|
@@ -656,8 +560,9 @@ function installVelero() {
|
|
|
656
560
|
|
|
657
561
|
## Create a bucket
|
|
658
562
|
BUCKET="$PROJECT_ID-velero"
|
|
659
|
-
|
|
660
|
-
|
|
563
|
+
GCE_REGION=`overwhelm -k GCE_REGION`
|
|
564
|
+
printf "\nCreating storage bucket in $GCE_REGION...\n"
|
|
565
|
+
gsutil mb -l $GCE_REGION gs://$BUCKET/ &> /dev/null
|
|
661
566
|
warnOnError $? "Bucket failed to create or already exists - go check it\n"
|
|
662
567
|
|
|
663
568
|
## Create a service account
|
|
@@ -745,8 +650,9 @@ function installVelero() {
|
|
|
745
650
|
## Install velero chart => https://github.com/vmware-tanzu/helm-charts/blob/main/charts/velero/values.yaml
|
|
746
651
|
## Helpful debugging link => https://github.com/vmware-tanzu/helm-charts/issues/351
|
|
747
652
|
addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
653
|
+
[ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="3"
|
|
748
654
|
helm upgrade --install velero vmware-tanzu/velero \
|
|
749
|
-
--version
|
|
655
|
+
--version $VELERO_HELM_CHART \
|
|
750
656
|
--namespace velero \
|
|
751
657
|
--set credentials.useSecret="false" \
|
|
752
658
|
--set configuration.provider="gcp" \
|
|
@@ -758,7 +664,7 @@ function installVelero() {
|
|
|
758
664
|
--set snapshotsEnabled="true" \
|
|
759
665
|
--set configuration.volumeSnapshotLocation.name=default \
|
|
760
666
|
--set "initContainers[0].name"="velero-plugin-for-gcp" \
|
|
761
|
-
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.
|
|
667
|
+
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.6.0" \
|
|
762
668
|
--set "initContainers[0].volumeMounts[0].mountPath"="/target" \
|
|
763
669
|
--set "initContainers[0].volumeMounts[0].name"="plugins" \
|
|
764
670
|
--set schedules.postgresql.schedule="0 2 * * *" \
|
|
@@ -770,13 +676,22 @@ function installVelero() {
|
|
|
770
676
|
--set schedules.timescale.template.ttl="720h" \
|
|
771
677
|
--set schedules.timescale.template.labelSelector.matchLabels.release="timescale-db" \
|
|
772
678
|
--set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
|
|
773
|
-
--set schedules.timescale.template.snapshotVolumes="true"
|
|
679
|
+
--set schedules.timescale.template.snapshotVolumes="true" \
|
|
680
|
+
--set schedules.redis.schedule="*/30 * * * *" \
|
|
681
|
+
--set schedules.redis.template.ttl="24h" \
|
|
682
|
+
--set schedules.redis.template.labelSelector.matchLabels.name="redis" \
|
|
683
|
+
--set schedules.redis.template.snapshotVolumes="true"
|
|
774
684
|
|
|
775
685
|
velero get backups
|
|
776
686
|
cat<<DONE_VELERO
|
|
777
687
|
|
|
778
688
|
Velero docs => `color g 'open https://velero.io/docs'`
|
|
689
|
+
|
|
690
|
+
Creating initial backups from `color g 'velero-postgres'` and `color g 'velero-timescale'` schedules...
|
|
779
691
|
DONE_VELERO
|
|
692
|
+
sleep 2
|
|
693
|
+
velero backup create --from-schedule velero-postgresql
|
|
694
|
+
velero backup create --from-schedule velero-timescale
|
|
780
695
|
removeHelmRepo vmware-tanzu
|
|
781
696
|
echo -n "npm run ahoy && velero get backups" | pbcopy
|
|
782
697
|
}
|
|
@@ -799,6 +714,7 @@ PLUGIN_NOEXEC
|
|
|
799
714
|
fi
|
|
800
715
|
|
|
801
716
|
printf "\n***Executing local plugin code => `color y $PLUGIN`\n\n" && sleep 2
|
|
717
|
+
export HELM_WHAT
|
|
802
718
|
. $PLUGIN # executing with . allows the plugin to use functions like color
|
|
803
719
|
return 0
|
|
804
720
|
}
|
|
@@ -868,7 +784,7 @@ function doInstall() {
|
|
|
868
784
|
[ ! -z "$CHARTVER" ] && CHARTVER="--version $CHARTVER"
|
|
869
785
|
|
|
870
786
|
# set the dry-run flag on what
|
|
871
|
-
[ "`basename $0`" == "helmwhat" ] &&
|
|
787
|
+
[ "`basename $0`" == "helmwhat" ] && HELM_WHAT="--dry-run --debug"
|
|
872
788
|
|
|
873
789
|
# If we're referencing a plugin then execute it and continue
|
|
874
790
|
ifPluggedIn $SERVICE && continue
|
|
@@ -895,16 +811,7 @@ function doInstall() {
|
|
|
895
811
|
;;
|
|
896
812
|
|
|
897
813
|
"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
|
|
814
|
+
bootstrapLocalSetup elasticsearch
|
|
908
815
|
;;
|
|
909
816
|
|
|
910
817
|
"estafette"|"preemptible-killer")
|
|
@@ -912,7 +819,7 @@ function doInstall() {
|
|
|
912
819
|
;;
|
|
913
820
|
|
|
914
821
|
"grafana")
|
|
915
|
-
|
|
822
|
+
bootstrapLocalSetup grafana
|
|
916
823
|
;;
|
|
917
824
|
|
|
918
825
|
"monitoring")
|
|
@@ -925,18 +832,15 @@ function doInstall() {
|
|
|
925
832
|
;;
|
|
926
833
|
|
|
927
834
|
"postgres"|"postgresql")
|
|
928
|
-
|
|
929
|
-
addBitnamiRepo
|
|
930
|
-
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|
|
931
|
-
removeHelmRepo bitnami
|
|
835
|
+
bootstrapLocalSetup postgres
|
|
932
836
|
;;
|
|
933
837
|
|
|
934
838
|
"prometheus")
|
|
935
|
-
|
|
839
|
+
bootstrapLocalSetup prometheus set-values-local
|
|
936
840
|
;;
|
|
937
841
|
|
|
938
842
|
"redis")
|
|
939
|
-
|
|
843
|
+
bootstrapLocalSetup redis
|
|
940
844
|
;;
|
|
941
845
|
|
|
942
846
|
"reloader")
|
|
@@ -946,20 +850,19 @@ function doInstall() {
|
|
|
946
850
|
removeHelmRepo stakater
|
|
947
851
|
;;
|
|
948
852
|
|
|
949
|
-
"timescale-db")
|
|
950
|
-
|
|
951
|
-
checkTimescalePassword
|
|
952
|
-
helm upgrade --install timescale-db leverege/timescale-db
|
|
853
|
+
"timescale"|"timescale-db")
|
|
854
|
+
bootstrapLocalSetup timescale-db
|
|
953
855
|
;;
|
|
954
856
|
|
|
955
857
|
transponder-*)
|
|
956
858
|
# transponders use the same chart but different deployment name
|
|
957
|
-
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $
|
|
859
|
+
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $HELM_WHAT"
|
|
958
860
|
doHelmup "$HELMUP"
|
|
959
861
|
;;
|
|
960
862
|
|
|
961
863
|
"traefik")
|
|
962
|
-
|
|
864
|
+
installTraefikEnvironment
|
|
865
|
+
bootstrapLocalSetup traefik
|
|
963
866
|
;;
|
|
964
867
|
|
|
965
868
|
"velero")
|
|
@@ -1005,7 +908,7 @@ NO_SERVICE_MAN
|
|
|
1005
908
|
MUSEUM=$(<${OVERRIDE})
|
|
1006
909
|
printf "\n$YELO_WARN Local chartmuseum name override from ${SERVICE} to ${MUSEUM}\n"
|
|
1007
910
|
fi
|
|
1008
|
-
HELMUP="helm upgrade --install $SERVICE leverege/$MUSEUM -f $SERVICE/values.yaml $CHARTVER $
|
|
911
|
+
HELMUP="helm upgrade --install $SERVICE leverege/$MUSEUM -f $SERVICE/values.yaml $CHARTVER $HELM_WHAT"
|
|
1009
912
|
doHelmup $HELMUP
|
|
1010
913
|
SAVERR=$?
|
|
1011
914
|
if [ $SAVERR -ne 0 ];
|
|
@@ -1030,11 +933,180 @@ NOTRUNNING
|
|
|
1030
933
|
}
|
|
1031
934
|
|
|
1032
935
|
# ---------- helmup MAIN ----------
|
|
1033
|
-
GITTOP=`git rev-parse --show-toplevel`
|
|
936
|
+
GITTOP=`git rev-parse --show-toplevel` # `&& cd $GITTOP
|
|
1034
937
|
K8S_UTILS="${GITTOP}/k8s-utils"
|
|
1035
938
|
|
|
1036
|
-
overwhelm
|
|
939
|
+
overwhelm # overwhelm.js # use overwhelm.js for local
|
|
1037
940
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
1038
941
|
|
|
1039
942
|
doInstall $@
|
|
1040
943
|
cd - &> /dev/null
|
|
944
|
+
|
|
945
|
+
# *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED *** DEPRECATED ***
|
|
946
|
+
function installPrometheusXXX() {
|
|
947
|
+
# Add the community helm repositories
|
|
948
|
+
addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
|
|
949
|
+
[ -z "$PROMETHEUS_HELM_CHART" ] && PROMETHEUS_HELM_CHART="15"
|
|
950
|
+
helm upgrade --install prometheus prometheus-community/prometheus \
|
|
951
|
+
--namespace monitoring \
|
|
952
|
+
--values prometheus/values.yaml \
|
|
953
|
+
--version $PROMETHEUS_HELM_CHART
|
|
954
|
+
removeHelmRepo prometheus-community
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function installRedisXXX() {
|
|
958
|
+
showInstalling "Redis Network Cache"
|
|
959
|
+
addBitnamiRepo latest
|
|
960
|
+
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="17" # latest chart 17 is redis v7
|
|
961
|
+
helm upgrade --install redis bitnami/redis \
|
|
962
|
+
--version $REDIS_HELM_CHART \
|
|
963
|
+
-f - <<REDIS_CHART_MODS
|
|
964
|
+
global:
|
|
965
|
+
storageClass: ssd
|
|
966
|
+
|
|
967
|
+
auth:
|
|
968
|
+
enabled: false
|
|
969
|
+
sentinel: false
|
|
970
|
+
|
|
971
|
+
master:
|
|
972
|
+
affinity:
|
|
973
|
+
nodeAffinity:
|
|
974
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
975
|
+
nodeSelectorTerms:
|
|
976
|
+
- matchExpressions:
|
|
977
|
+
- key: target-env
|
|
978
|
+
operator: In
|
|
979
|
+
values:
|
|
980
|
+
- database
|
|
981
|
+
|
|
982
|
+
tolerations:
|
|
983
|
+
- key: "database"
|
|
984
|
+
operator: "Equal"
|
|
985
|
+
value: "true"
|
|
986
|
+
effect: "NoSchedule"
|
|
987
|
+
|
|
988
|
+
persistence:
|
|
989
|
+
size: 1Gi # 8Gi is default
|
|
990
|
+
|
|
991
|
+
replica:
|
|
992
|
+
affinity:
|
|
993
|
+
nodeAffinity:
|
|
994
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
995
|
+
nodeSelectorTerms:
|
|
996
|
+
- matchExpressions:
|
|
997
|
+
- key: target-env
|
|
998
|
+
operator: In
|
|
999
|
+
values:
|
|
1000
|
+
- database
|
|
1001
|
+
|
|
1002
|
+
tolerations:
|
|
1003
|
+
- key: "database"
|
|
1004
|
+
operator: "Equal"
|
|
1005
|
+
value: "true"
|
|
1006
|
+
effect: "NoSchedule"
|
|
1007
|
+
|
|
1008
|
+
persistence:
|
|
1009
|
+
size: 8Gi # 8Gi is default
|
|
1010
|
+
|
|
1011
|
+
architecture: replication
|
|
1012
|
+
|
|
1013
|
+
sentinel:
|
|
1014
|
+
enabled: false
|
|
1015
|
+
|
|
1016
|
+
networkPolicy:
|
|
1017
|
+
enabled: true
|
|
1018
|
+
allowExternal: false
|
|
1019
|
+
ingressNSMatchLabels:
|
|
1020
|
+
redis: external
|
|
1021
|
+
ingressNSPodMatchLabels:
|
|
1022
|
+
redis-client: true
|
|
1023
|
+
|
|
1024
|
+
metrics:
|
|
1025
|
+
enabled: true
|
|
1026
|
+
|
|
1027
|
+
REDIS_CHART_MODS
|
|
1028
|
+
if [[ $? -ne 0 ]];
|
|
1029
|
+
then
|
|
1030
|
+
clearlyWarn noclear
|
|
1031
|
+
cat<<OLDER_REDIS
|
|
1032
|
+
The redis upgrade failed which may mean that the versions are different
|
|
1033
|
+
enough that k8s cannot gracefully upgrade from one version to the next.
|
|
1034
|
+
Try removing the existing deployment and redeploying redis:
|
|
1035
|
+
|
|
1036
|
+
$ `color r "helmdn redis && sleep 5 && helmup redis"`
|
|
1037
|
+
OLDER_REDIS
|
|
1038
|
+
fi
|
|
1039
|
+
printf "\n\nTo start a specific version => `color g 'REDIS_HELM_CHART="13.0.1" helmup redis'`\n\n"
|
|
1040
|
+
removeHelmRepo bitnami
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function installPostgreSQLXXX() {
|
|
1044
|
+
showInstalling "PostgreSQL Database"
|
|
1045
|
+
addBitnamiRepo
|
|
1046
|
+
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 10.16.2
|
|
1047
|
+
removeHelmRepo bitnami
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function checkTimescaleLocalValuesXXX() {
|
|
1051
|
+
local TSDIR="$GITTOP/timescale-db"
|
|
1052
|
+
local TSLCL="$TSDIR/tsdb-values.yaml"
|
|
1053
|
+
[ ! -d "$TSDIR" ] && mkdir "$TSDIR" && touch "$TSDIR/.nohelm"
|
|
1054
|
+
[ ! -f "$TSLCL" ] && cat > $TSLCL <<TIMESCALE_LOCAL_CHART
|
|
1055
|
+
postgresql:
|
|
1056
|
+
postgresqlExtendedConf:
|
|
1057
|
+
maxWorkerProcesses: 8
|
|
1058
|
+
maxParallelWorkers: 8
|
|
1059
|
+
maxConnections: 500
|
|
1060
|
+
sharedBuffers: 2GB
|
|
1061
|
+
effectiveCacheSize: 6GB
|
|
1062
|
+
maintenanceWorkMem: 1GB
|
|
1063
|
+
workMem: 20MB
|
|
1064
|
+
idle_in_transaction_session_timeout: 30000 # 30ms timeout
|
|
1065
|
+
maxWalSize: 2GB
|
|
1066
|
+
walKeepSegments: 64
|
|
1067
|
+
|
|
1068
|
+
resources:
|
|
1069
|
+
requests:
|
|
1070
|
+
memory: 4Gi
|
|
1071
|
+
cpu: 1000m
|
|
1072
|
+
|
|
1073
|
+
persistence:
|
|
1074
|
+
size: 200Gi
|
|
1075
|
+
|
|
1076
|
+
livenessProbe:
|
|
1077
|
+
enabled: true # false for repairs
|
|
1078
|
+
initialDelaySeconds: 30
|
|
1079
|
+
periodSeconds: 10
|
|
1080
|
+
timeoutSeconds: 5
|
|
1081
|
+
failureThreshold: 6
|
|
1082
|
+
successThreshold: 1
|
|
1083
|
+
|
|
1084
|
+
readinessProbe:
|
|
1085
|
+
enabled: true
|
|
1086
|
+
successThreshold: 1
|
|
1087
|
+
initialDelaySeconds: 5
|
|
1088
|
+
timeoutSeconds: 5
|
|
1089
|
+
periodSeconds: 10
|
|
1090
|
+
failureThreshold: 6
|
|
1091
|
+
# These values should be used when attempting to rebuild the slave VPCs
|
|
1092
|
+
# following a failure, typically caused by WAL problems. The failure
|
|
1093
|
+
# threshold of 240 with a period of 30 seconds should allow the recovery
|
|
1094
|
+
# process 2 hours of time for each slave VPC - lengthen as necessary.
|
|
1095
|
+
# initialDelaySeconds: 60
|
|
1096
|
+
# timeoutSeconds: 15
|
|
1097
|
+
# periodSeconds: 30
|
|
1098
|
+
# failureThreshold: 240
|
|
1099
|
+
TIMESCALE_LOCAL_CHART
|
|
1100
|
+
echo "$TSLCL"
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
function installTimescaleDbXXX() {
|
|
1104
|
+
showInstalling "Timescale Database (Leverege chart)"
|
|
1105
|
+
checkTimescalePassword
|
|
1106
|
+
TSDB_VAL="$(checkTimescaleLocalValues)"
|
|
1107
|
+
[ -z "$TIMESCALE_HELM_CHART" ] && TIMESCALE_HELM_CHART="2"
|
|
1108
|
+
helm upgrade --install timescale-db leverege/timescale-db \
|
|
1109
|
+
--version $TIMESCALE_HELM_CHART \
|
|
1110
|
+
-f $GITTOP/timescale-db/tsdb-values.yaml
|
|
1111
|
+
}
|
|
1112
|
+
|
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" $HELM_WHAT
|
|
17
|
+
|
|
18
|
+
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"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
showInstalling "Grafana"
|
|
4
|
+
|
|
5
|
+
createNamespaceIfNeeded monitoring
|
|
6
|
+
|
|
7
|
+
addHelmRepo grafana https://grafana.github.io/helm-charts
|
|
8
|
+
|
|
9
|
+
[ -z "$GRAFANA_HELM_CHART" ] && GRAFANA_HELM_CHART="6"
|
|
10
|
+
helm upgrade --install grafana grafana/grafana \
|
|
11
|
+
--namespace monitoring \
|
|
12
|
+
--values grafana/grafana-local.yaml \
|
|
13
|
+
--version $GRAFANA_HELM_CHART $HELM_WHAT
|
|
14
|
+
|
|
15
|
+
helmup monitoring-wtf
|
|
16
|
+
|
|
17
|
+
removeHelmRepo grafana
|