@leverege/build-tools 2.0.5 → 2.0.7
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/web/dnsify/index.js +3 -1
- package/lib/web/packleate/Packleator.js +3 -1
- package/lib/web/packleate/index.js +3 -1
- package/package.json +7 -7
- package/src/circleate +20 -46
- package/src/helmup +6 -24
- package/src/overwhelm +1 -1
- package/lib/server/circleate +0 -573
- package/lib/server/decrypt-secrets +0 -108
- package/lib/server/dockreate +0 -353
- package/lib/server/encrypt-secrets +0 -49
- package/lib/server/getfbcfg +0 -23
- package/lib/server/getjson +0 -48
- package/lib/server/git-tar +0 -89
- package/lib/server/helmdn +0 -111
- package/lib/server/helmify +0 -283
- package/lib/server/helmup +0 -349
- package/lib/server/overwhelm +0 -320
- package/lib/server/pkgck +0 -136
- package/lib/server/pkglint +0 -35
- package/lib/server/test.json +0 -4
- package/src/dnsify/CloudflareAPI.js +0 -99
- package/src/dnsify/accounts.json.enc +0 -0
- package/src/dnsify/index.js +0 -82
- package/src/packleate/Packleator.js +0 -281
- package/src/packleate/index.js +0 -86
- package/src/packleate/logo-ansi.js +0 -16
- package/src/test.json +0 -4
package/lib/server/helmify
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Check if Helm is installed first
|
|
4
|
-
if ! [ -x "$(command -v helm)" ]; then
|
|
5
|
-
echo 'Error: helm is not installed.'
|
|
6
|
-
echo 'To install: brew install kubernetes-helm'
|
|
7
|
-
exit 1
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
# Check if Chart Museum is installed
|
|
11
|
-
if ! [ -x "$(command -v chartmuseum)" ]; then
|
|
12
|
-
echo 'Error: chartmuseum is not installed.'
|
|
13
|
-
echo 'To install: see instructions at https://leverege.atlassian.net/wiki/spaces/PLAT/pages/679542800/Helm+Charts+via+ChartMuseum'
|
|
14
|
-
exit 1
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
# Check if Chart Museum is running
|
|
18
|
-
url='http://localhost:8080/'
|
|
19
|
-
status_code=$(curl --write-out %{http_code} --silent --output /dev/null ${url})
|
|
20
|
-
|
|
21
|
-
if [[ "$status_code" -ne 200 ]] ; then
|
|
22
|
-
echo 'Error: Chart Museum is not running'
|
|
23
|
-
echo 'To run: chartmuseum --debug --port=8080 --storage="google" --storage-google-bucket="leverege-helm-charts" --storage-google-prefix=""'
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# Bootstrap Helm charts
|
|
28
|
-
chartname=${PWD##*/}
|
|
29
|
-
chartname_go=${chartname//-/_}
|
|
30
|
-
|
|
31
|
-
if [ -d helm ];
|
|
32
|
-
then
|
|
33
|
-
printf "\nThere is an existing Helm repo, do you want to override?\n\n"
|
|
34
|
-
printf "Hit return to continue or ^C to exit\n\n"; read ANS
|
|
35
|
-
rm -rf helm
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
createService() {
|
|
39
|
-
cat<<SVC_YAML > service.yaml
|
|
40
|
-
kind: Service
|
|
41
|
-
apiVersion: v1
|
|
42
|
-
metadata:
|
|
43
|
-
name: $chartname
|
|
44
|
-
spec:
|
|
45
|
-
type: NodePort
|
|
46
|
-
selector:
|
|
47
|
-
app: $chartname
|
|
48
|
-
ports:
|
|
49
|
-
- name: $chartname-input
|
|
50
|
-
protocol: TCP
|
|
51
|
-
port: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
52
|
-
targetPort: api
|
|
53
|
-
SVC_YAML
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# Make chart directory
|
|
57
|
-
mkdir helm
|
|
58
|
-
mkdir helm/templates
|
|
59
|
-
|
|
60
|
-
# Make Chart.yaml
|
|
61
|
-
cd helm
|
|
62
|
-
|
|
63
|
-
PACKAGE_VERSION=$(node -p "require('../package.json').version")
|
|
64
|
-
|
|
65
|
-
cat<<CHARTYAML > Chart.yaml
|
|
66
|
-
name: $chartname
|
|
67
|
-
version: 1.0.0 # version of the Helm Chart
|
|
68
|
-
appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
|
|
69
|
-
|
|
70
|
-
CHARTYAML
|
|
71
|
-
|
|
72
|
-
# Bootstrap values.yaml
|
|
73
|
-
cat<<VALUESYAML > values.yaml
|
|
74
|
-
### These are default env variable values for your application
|
|
75
|
-
### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
|
|
76
|
-
### Overwrite these values in values-local or respective values files in platform-k8s
|
|
77
|
-
|
|
78
|
-
# List your env variables here
|
|
79
|
-
$chartname_go:
|
|
80
|
-
VERSION: vX.Y.Z
|
|
81
|
-
SERVER_PORT: 8080
|
|
82
|
-
IMAGE: gcr.io/leverege-docker-images/$chartname
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
MAX_CHILD_PROCESSES: "1"
|
|
86
|
-
|
|
87
|
-
MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
|
|
88
|
-
MODEL_FIREBASE_DATABASE_URL: https://OVH:<PROJECT_NAME>.firebaseio.com
|
|
89
|
-
MODEL_FIREBASE_CONFIG: /var/config/keys/model-data-config
|
|
90
|
-
|
|
91
|
-
SECRET_KEY: key.json
|
|
92
|
-
|
|
93
|
-
PUBSUB_SERVICE_ACCOUNT: /var/config/keys/pubsub
|
|
94
|
-
|
|
95
|
-
TRANSPORT_CONFIG: "{
|
|
96
|
-
\"type\": \"pubsub\",
|
|
97
|
-
\"projectId\": \"OVH:<PROJECT_NAME>\",
|
|
98
|
-
\"keyFilename\": \"/var/config/keys/pubsub/key.json\" ,
|
|
99
|
-
\"publisher\": {
|
|
100
|
-
\"batching\": {
|
|
101
|
-
\"maxMilliseconds\": 0,
|
|
102
|
-
\"maxMessages\": 999
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}"
|
|
106
|
-
LOG_CONFIG: "{
|
|
107
|
-
\"type\": \"bunyan\",
|
|
108
|
-
\"name\": \"${logName}\",
|
|
109
|
-
\"level\": \"info\",
|
|
110
|
-
\"streams\": [
|
|
111
|
-
{
|
|
112
|
-
\"type\": \"stackdriver\",
|
|
113
|
-
\"logName\": \"${logName}\"
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}"
|
|
117
|
-
CACHE_CONFIG: "{
|
|
118
|
-
\"type\": \"redis\",
|
|
119
|
-
\"connection\": {
|
|
120
|
-
\"host\": \"redis-master\",
|
|
121
|
-
\"port\": \"6379\"
|
|
122
|
-
}
|
|
123
|
-
}"
|
|
124
|
-
LIMIT_CONFIG: "{
|
|
125
|
-
\"type\":\"redis\",
|
|
126
|
-
\"connection\":{
|
|
127
|
-
\"host\":\"redis-master\",
|
|
128
|
-
\"port\":6379
|
|
129
|
-
},
|
|
130
|
-
\"limitOptions\":{
|
|
131
|
-
\"frequency\":30,
|
|
132
|
-
\"period\":60000,
|
|
133
|
-
\"duration\":600000
|
|
134
|
-
}
|
|
135
|
-
}"
|
|
136
|
-
NODE_ENVIRONMENT: production
|
|
137
|
-
|
|
138
|
-
VALUESYAML
|
|
139
|
-
|
|
140
|
-
# Bootstrap templates
|
|
141
|
-
cd templates
|
|
142
|
-
cat<<DEPLOYMENT_YAML > deployment.yaml
|
|
143
|
-
apiVersion: apps/v1beta1
|
|
144
|
-
kind: Deployment
|
|
145
|
-
metadata:
|
|
146
|
-
name: {{ .Chart.Name }}
|
|
147
|
-
spec:
|
|
148
|
-
template:
|
|
149
|
-
metadata:
|
|
150
|
-
labels:
|
|
151
|
-
app: {{ .Chart.Name }}
|
|
152
|
-
chart/version: {{ .Chart.Version }}
|
|
153
|
-
chart/appVersion: {{ .Chart.AppVersion }}
|
|
154
|
-
annotations:
|
|
155
|
-
prometheus.io/port: '5111'
|
|
156
|
-
prometheus.io/scrape: 'true'
|
|
157
|
-
spec:
|
|
158
|
-
volumes:
|
|
159
|
-
- name: model-firebase-key
|
|
160
|
-
secret:
|
|
161
|
-
secretName: model-data
|
|
162
|
-
- name: tmpfs
|
|
163
|
-
emptyDir: {}
|
|
164
|
-
- name: pubsub-key
|
|
165
|
-
secret:
|
|
166
|
-
secretName: pubsub
|
|
167
|
-
{{- if (.Values.$chartname_go.PREEMPTIBLE) and eq .Values.$chartname_go.PREEMPTIBLE "true" }}
|
|
168
|
-
tolerations:
|
|
169
|
-
- key: "preemptible"
|
|
170
|
-
operator: "Equal"
|
|
171
|
-
value: "true"
|
|
172
|
-
effect: "NoSchedule"
|
|
173
|
-
affinity:
|
|
174
|
-
podAntiAffinity:
|
|
175
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
176
|
-
- weight: 100
|
|
177
|
-
podAffinityTerm:
|
|
178
|
-
labelSelector:
|
|
179
|
-
matchExpressions:
|
|
180
|
-
- key: app
|
|
181
|
-
operator: In
|
|
182
|
-
values:
|
|
183
|
-
- {{ .Chart.Name }}
|
|
184
|
-
topologyKey: kubernetes.io/hostname
|
|
185
|
-
nodeAffinity:
|
|
186
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
187
|
-
- preference:
|
|
188
|
-
matchExpressions:
|
|
189
|
-
- key: cloud.google.com/gke-preemptible
|
|
190
|
-
operator: Exists
|
|
191
|
-
weight: 50
|
|
192
|
-
{{- end }}
|
|
193
|
-
containers:
|
|
194
|
-
- name: {{ .Chart.Name }}
|
|
195
|
-
image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
|
|
196
|
-
imagePullPolicy: Always
|
|
197
|
-
securityContext:
|
|
198
|
-
readOnlyRootFilesystem: true
|
|
199
|
-
runAsNonRoot: true
|
|
200
|
-
runAsUser: 1000
|
|
201
|
-
allowPrivilegeEscalation: false
|
|
202
|
-
readinessProbe:
|
|
203
|
-
httpGet:
|
|
204
|
-
path: /
|
|
205
|
-
port: node-metrics
|
|
206
|
-
initialDelaySeconds: 10
|
|
207
|
-
{{- if (.Values.$chartname_go.LIVENESS_PROBE) and eq .Values.$chartname_go.LIVENESS_PROBE "true" }}
|
|
208
|
-
livenessProbe:
|
|
209
|
-
httpGet:
|
|
210
|
-
path: /livenessProbe
|
|
211
|
-
port: api
|
|
212
|
-
initialDelaySeconds: 15
|
|
213
|
-
periodSeconds: 60
|
|
214
|
-
{{- end }}
|
|
215
|
-
resources:
|
|
216
|
-
requests:
|
|
217
|
-
cpu: "50m"
|
|
218
|
-
memory: "256Mi"
|
|
219
|
-
limits:
|
|
220
|
-
cpu: "100m"
|
|
221
|
-
memory: "512Mi"
|
|
222
|
-
ports:
|
|
223
|
-
{{- if .Values.$chartname_go.SERVER_PORT }}
|
|
224
|
-
- name: api
|
|
225
|
-
containerPort: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
226
|
-
{{- end }}
|
|
227
|
-
- name: node-metrics
|
|
228
|
-
containerPort: 5111
|
|
229
|
-
volumeMounts:
|
|
230
|
-
- name: model-firebase-key
|
|
231
|
-
mountPath: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT | quote }}
|
|
232
|
-
- name: tmpfs
|
|
233
|
-
mountPath: "/tmp"
|
|
234
|
-
- name: pubsub-key
|
|
235
|
-
mountPath: {{ .Values.default.PUBSUB_SERVICE_ACCOUNT | quote }}
|
|
236
|
-
env:
|
|
237
|
-
- name: NODE_ENV
|
|
238
|
-
value: {{ .Values.default.NODE_ENVIRONMENT }}
|
|
239
|
-
- name: CACHE_CONFIG
|
|
240
|
-
value: {{ required "Cache config required" .Values.default.CACHE_CONFIG | quote }}
|
|
241
|
-
- name: LIMIT_CONFIG
|
|
242
|
-
value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
|
|
243
|
-
- name: TRANSPORT_CONFIG
|
|
244
|
-
value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
|
|
245
|
-
- name: LOG_CONFIG
|
|
246
|
-
value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
|
|
247
|
-
- name: MAX_CHILD_PROCESSES
|
|
248
|
-
value: {{ .Values.default.MAX_CHILD_PROCESSES | default 1 | quote }}
|
|
249
|
-
- name: MODEL_FIREBASE_SERVICE_ACCOUNT
|
|
250
|
-
value: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}/{{ .Values.default.SECRET_KEY }}
|
|
251
|
-
- name: MODEL_FIREBASE_DATABASE_URL
|
|
252
|
-
value: {{ .Values.default.MODEL_FIREBASE_DATABASE_URL | quote }}
|
|
253
|
-
DEPLOYMENT_YAML
|
|
254
|
-
|
|
255
|
-
read -p "Does your server need an open port to the Internet (i.e. ingress or service)? [Y or N] " -n 1 -r
|
|
256
|
-
echo # (optional) move to a new line
|
|
257
|
-
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
258
|
-
then
|
|
259
|
-
echo
|
|
260
|
-
echo '**********************************'
|
|
261
|
-
echo ' CREATING SERVICE TEMPLATES '
|
|
262
|
-
echo '**********************************'
|
|
263
|
-
createService
|
|
264
|
-
|
|
265
|
-
fi
|
|
266
|
-
|
|
267
|
-
# Print out some hints
|
|
268
|
-
cat<<HINTS
|
|
269
|
-
|
|
270
|
-
*** IMPORTANT ***
|
|
271
|
-
|
|
272
|
-
1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
|
|
273
|
-
2. You may not need all the default env variables so feel free to remove them as well
|
|
274
|
-
3. Adjust limit/request cpu and memory values as needed
|
|
275
|
-
4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
|
|
276
|
-
|
|
277
|
-
Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
|
|
278
|
-
|
|
279
|
-
5. Finally, follow chart museum directions to add your chart ors
|
|
280
|
-
|
|
281
|
-
helm push helm/ chartmuseum
|
|
282
|
-
|
|
283
|
-
HINTS
|
package/lib/server/helmup
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
# This script is used to ease the pain of transition testing to chart museum
|
|
4
|
-
# for adding / updating deployments on a fluster.
|
|
5
|
-
#
|
|
6
|
-
# printf "\nRUNNING LOCALLY\n" && sleep 2
|
|
7
|
-
PLATFORM=(
|
|
8
|
-
api-server
|
|
9
|
-
db-curator
|
|
10
|
-
emailer
|
|
11
|
-
imagine
|
|
12
|
-
message-processor
|
|
13
|
-
messenger
|
|
14
|
-
reason
|
|
15
|
-
scheduler
|
|
16
|
-
transponder-bq
|
|
17
|
-
transponder-fb
|
|
18
|
-
transponder-postgres
|
|
19
|
-
# transponder-sql
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
SYSTEM=(
|
|
23
|
-
coredns
|
|
24
|
-
disks
|
|
25
|
-
elastic
|
|
26
|
-
monitoring
|
|
27
|
-
polaris
|
|
28
|
-
redis
|
|
29
|
-
velero
|
|
30
|
-
# custom-metrics
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
# Simple ANSI color coded string generator.
|
|
34
|
-
function color() {
|
|
35
|
-
local color=
|
|
36
|
-
case "$1" in
|
|
37
|
-
'g') color="92m" ;; # green
|
|
38
|
-
'c') color="96m" ;; # lt blue
|
|
39
|
-
'y') color="93m" ;; # yellow
|
|
40
|
-
'r') color="91m" ;; # red
|
|
41
|
-
'toast') color="1;3;7;91;103;5m" ;;
|
|
42
|
-
esac
|
|
43
|
-
printf "\e[$color$2\e[0m"
|
|
44
|
-
}
|
|
45
|
-
RED_ERROR=`color r '***ERROR:'`
|
|
46
|
-
YELO_WARN="`color y '***WARNING:'`"
|
|
47
|
-
|
|
48
|
-
function setOrUnset() {
|
|
49
|
-
local setting=`color toast "NEEDS TO BE SET"`
|
|
50
|
-
[ ! -z "$1" ] && setting=`color g $1`
|
|
51
|
-
echo "$setting"
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function createSSDYAML(){
|
|
56
|
-
cat<<EOSSD > ${K8S_UTILS}/ssd-storageclass.yaml
|
|
57
|
-
apiVersion: storage.k8s.io/v1
|
|
58
|
-
kind: StorageClass
|
|
59
|
-
metadata:
|
|
60
|
-
name: ssd
|
|
61
|
-
provisioner: kubernetes.io/gce-pd
|
|
62
|
-
parameters:
|
|
63
|
-
type: pd-ssd
|
|
64
|
-
EOSSD
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function checkSSDStorageClass(){
|
|
68
|
-
kubectl get storageclass ssd
|
|
69
|
-
if [[ $? -eq 1 ]]; then
|
|
70
|
-
printf "\n*** SSD Storage Class not defined ***\n\n"
|
|
71
|
-
if [ ! -f ${K8S_UTILS}/ssd-storageclass.yaml ]; then
|
|
72
|
-
createSSDYAML
|
|
73
|
-
fi
|
|
74
|
-
kubectl apply -f ${K8S_UTILS}/ssd-storageclass.yaml
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
printf "\n*** Attaching PVC to SSD Class ***\n\n"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function installVelero() {
|
|
81
|
-
## Set the project id by parsing current context
|
|
82
|
-
currContext=`kubectl config current-context`
|
|
83
|
-
|
|
84
|
-
IFS='_'
|
|
85
|
-
read -ra ADDR <<< "$currContext"
|
|
86
|
-
|
|
87
|
-
PROJECT_ID=${ADDR[1]} # project id is the second string split by _
|
|
88
|
-
|
|
89
|
-
gcloud config set project $PROJECT_ID
|
|
90
|
-
|
|
91
|
-
## Create a bucket
|
|
92
|
-
BUCKET="$PROJECT_ID-velero"
|
|
93
|
-
|
|
94
|
-
gsutil mb gs://$BUCKET/
|
|
95
|
-
|
|
96
|
-
## Create a service account
|
|
97
|
-
gcloud iam service-accounts create velero \
|
|
98
|
-
--display-name "Velero service account"
|
|
99
|
-
|
|
100
|
-
SERVICE_ACCOUNT_EMAIL=$(gcloud iam service-accounts list \
|
|
101
|
-
--filter="displayName:Velero service account" \
|
|
102
|
-
--format 'value(email)')
|
|
103
|
-
|
|
104
|
-
## Attach roles
|
|
105
|
-
ROLE_PERMISSIONS=(
|
|
106
|
-
compute.disks.get
|
|
107
|
-
compute.disks.create
|
|
108
|
-
compute.disks.createSnapshot
|
|
109
|
-
compute.snapshots.get
|
|
110
|
-
compute.snapshots.create
|
|
111
|
-
compute.snapshots.useReadOnly
|
|
112
|
-
compute.snapshots.delete
|
|
113
|
-
compute.zones.get
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
gcloud iam roles create velero.server \
|
|
117
|
-
--project $PROJECT_ID \
|
|
118
|
-
--title "Velero Server" \
|
|
119
|
-
--permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")"
|
|
120
|
-
|
|
121
|
-
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
122
|
-
--member serviceAccount:$SERVICE_ACCOUNT_EMAIL \
|
|
123
|
-
--role projects/$PROJECT_ID/roles/velero.server
|
|
124
|
-
|
|
125
|
-
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://${BUCKET}
|
|
126
|
-
|
|
127
|
-
## Create keys
|
|
128
|
-
gcloud iam service-accounts keys create credentials-velero \
|
|
129
|
-
--iam-account $SERVICE_ACCOUNT_EMAIL
|
|
130
|
-
|
|
131
|
-
## Create velero namespace
|
|
132
|
-
kubectl create ns velero
|
|
133
|
-
|
|
134
|
-
## Create kubernetes secret
|
|
135
|
-
kubectl create secret generic velero-credentials --namespace velero --from-file cloud=credentials-velero
|
|
136
|
-
|
|
137
|
-
## Install velero
|
|
138
|
-
helm upgrade --install velero stable/velero \
|
|
139
|
-
--namespace velero \
|
|
140
|
-
--set configuration.provider="gcp" \
|
|
141
|
-
--set configuration.backupStorageLocation.name="gcp" \
|
|
142
|
-
--set configuration.volumeSnapshotLocation.name="gcp" \
|
|
143
|
-
--set configuration.backupStorageLocation.bucket="${BUCKET}" \
|
|
144
|
-
--set credentials.existingSecret="velero-credentials" \
|
|
145
|
-
--set "initContainers[0].name"="velero-plugin-for-gcp" \
|
|
146
|
-
--set "initContainers[0].image"="velero/velero-plugin-for-gcp:v1.0.0" \
|
|
147
|
-
--set "initContainers[0].volumeMounts[0].mountPath"="/target" \
|
|
148
|
-
--set "initContainers[0].volumeMounts[0].name"="plugins" \
|
|
149
|
-
--set schedules.timescale.schedule="0 3 * * *" \
|
|
150
|
-
--set schedules.timescale.template.ttl="720h" \
|
|
151
|
-
--set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
|
|
152
|
-
--set schedules.timescale.template.snapshotVolumes="true" \
|
|
153
|
-
|
|
154
|
-
## Instruct users to move velero keys
|
|
155
|
-
printf "\n$YELO_WARN MOVE THE SERVICE ACCOUNT TO YOUR KEYS FOLDER"
|
|
156
|
-
printf "\n$YELO_WARN NO REALLY...MOVE credentials-velero file NOW"
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
# ---------- helmup MAIN ----------
|
|
160
|
-
command -v chartmuseum &> /dev/null
|
|
161
|
-
if [ $? -ne 0 ];
|
|
162
|
-
then
|
|
163
|
-
cat<<NOMUSEUM
|
|
164
|
-
|
|
165
|
-
$RED_ERROR Missing chartmuseum. Head over to the wiki site and follow the
|
|
166
|
-
instructions in the section entitled Installing ChartMuseum down
|
|
167
|
-
in the How-to articles -> Helm Charts via ChartMuseum.
|
|
168
|
-
|
|
169
|
-
NOMUSEUM
|
|
170
|
-
exit 1
|
|
171
|
-
fi
|
|
172
|
-
|
|
173
|
-
GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
|
|
174
|
-
if [ -d "${GITTOP}/k8-utils" ];
|
|
175
|
-
then
|
|
176
|
-
cat<<BADK8
|
|
177
|
-
|
|
178
|
-
$YELO_WARN The k8_utils directory should be renamed to k8s_utils
|
|
179
|
-
|
|
180
|
-
This repository has the old k8_util directory name in place. Please rename
|
|
181
|
-
it to the newer k8s_utils directory that `color c helmup` will be looking for.
|
|
182
|
-
|
|
183
|
-
Run this => `color g "git mv k8-utils k8s-utils; git add k8*utils"`
|
|
184
|
-
|
|
185
|
-
$YELO_WARN Don't forget to commit and push after the renaming.
|
|
186
|
-
|
|
187
|
-
BADK8
|
|
188
|
-
exit 1
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
K8S_UTILS="${GITTOP}/k8s-utils"
|
|
192
|
-
if [ ! -d "$K8S_UTILS" ];
|
|
193
|
-
then
|
|
194
|
-
cat<<EOK8S
|
|
195
|
-
|
|
196
|
-
$RED_ERROR Missing the k8s utils dir => `color y $K8S_UTILS`
|
|
197
|
-
|
|
198
|
-
This is a relatively new directory setup that should be copied over from one
|
|
199
|
-
of the other configuration branches. The new-baseline branch should have this
|
|
200
|
-
setup in place, so check there.
|
|
201
|
-
|
|
202
|
-
EOK8S
|
|
203
|
-
|
|
204
|
-
exit 1
|
|
205
|
-
fi
|
|
206
|
-
|
|
207
|
-
npm run ahoy
|
|
208
|
-
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
209
|
-
|
|
210
|
-
helm repo update &> /dev/null && helm search chartmuseum
|
|
211
|
-
|
|
212
|
-
function doInstall() {
|
|
213
|
-
|
|
214
|
-
for PARAM in "$@";
|
|
215
|
-
do
|
|
216
|
-
IFS="/" read SERVICE CHARTVER <<< "$PARAM"
|
|
217
|
-
[ ! -z "$CHARTVER" ] && CHARTVER="--version $CHARTVER"
|
|
218
|
-
|
|
219
|
-
case "$SERVICE" in
|
|
220
|
-
"platform")
|
|
221
|
-
doInstall "${PLATFORM[@]}"
|
|
222
|
-
;;
|
|
223
|
-
|
|
224
|
-
"system")
|
|
225
|
-
doInstall "${SYSTEM[@]}"
|
|
226
|
-
;;
|
|
227
|
-
|
|
228
|
-
"coredns")
|
|
229
|
-
helm install --name coredns --namespace=kube-system stable/coredns
|
|
230
|
-
printf "\nGithub repo is here => https://github.com/helm/charts/tree/master/stable/coredns\n\n"
|
|
231
|
-
;;
|
|
232
|
-
|
|
233
|
-
"descheduler")
|
|
234
|
-
helm repo add akomljen-charts https://raw.githubusercontent.com/komljen/helm-charts/master/charts/
|
|
235
|
-
helm upgrade --install descheduler akomljen-charts/descheduler --set schedule="*/15 * * * *",deschedulerPolicy.strategies.RemovePodsViolatingNodeAffinity.params.nodeAffinityType={preferredDuringSchedulingIgnoredDuringExecution}
|
|
236
|
-
;;
|
|
237
|
-
|
|
238
|
-
"disks")
|
|
239
|
-
checkSSDStorageClass
|
|
240
|
-
helm upgrade --install disks ./disks
|
|
241
|
-
;;
|
|
242
|
-
|
|
243
|
-
"elastic"|"elasticsearch")
|
|
244
|
-
checkSSDStorageClass
|
|
245
|
-
helm repo add elastic https://helm.elastic.co
|
|
246
|
-
helm upgrade --install elasticsearch elastic/elasticsearch --set volumeClaimTemplate.storageClassName="ssd"
|
|
247
|
-
;;
|
|
248
|
-
|
|
249
|
-
"monitoring")
|
|
250
|
-
helm dep up ./monitoring && helm upgrade --install monitoring ./monitoring
|
|
251
|
-
;;
|
|
252
|
-
|
|
253
|
-
"mysql")
|
|
254
|
-
helm dep up ./mysql && helm upgrade --install mysql ./mysql
|
|
255
|
-
printf "\n***Proxy 4306 with this => kubectl port-forward svc/mysql 4306:3306\n\n"
|
|
256
|
-
printf "\n***Grab MYSQL Root Password => MYSQL_ROOT_PASSWORD=\$(kubectl get secret --namespace default mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)"
|
|
257
|
-
printf "\n***Set MYSQL_HOST to 127.0.0.1 and MYSQL_PORT to 4306 and run => mysql -h \${MYSQL_HOST} -P\${MYSQL_PORT} -u root -p\${MYSQL_ROOT_PASSWORD} \n\n"
|
|
258
|
-
printf "\n***Set Make sure to make api-server an admin \n\n"
|
|
259
|
-
;;
|
|
260
|
-
|
|
261
|
-
"polaris")
|
|
262
|
-
helm repo add reactiveops-stable https://charts.reactiveops.com/stable
|
|
263
|
-
helm upgrade --install polaris reactiveops-stable/polaris --namespace polaris
|
|
264
|
-
printf "\n***Proxy 8081 with this=> kubectl port-forward --namespace polaris svc/polaris-dashboard 8081:80\n\n"
|
|
265
|
-
;;
|
|
266
|
-
|
|
267
|
-
"redis")
|
|
268
|
-
# https://github.com/helm/charts/tree/master/stable/redis
|
|
269
|
-
[ -z "$REDIS_HELM_CHART" ] && REDIS_HELM_CHART="v9.1.5"
|
|
270
|
-
helm upgrade --install redis stable/redis \
|
|
271
|
-
--version $REDIS_HELM_CHART \
|
|
272
|
-
--set usePassword=false,cluster.slaveCount=3,networkPolicy.enabled=true,metrics.enabled=true
|
|
273
|
-
printf "To start a specific version => `color c 'REDIS_HELM_CHART="v9.1.5" helmup redis'`\n\n"
|
|
274
|
-
;;
|
|
275
|
-
|
|
276
|
-
"timescale-db")
|
|
277
|
-
helm dep up ./timescale-db && helm upgrade --install timescale-db ./timescale-db
|
|
278
|
-
;;
|
|
279
|
-
|
|
280
|
-
"ingress")
|
|
281
|
-
helm upgrade --install ingress ./ingress
|
|
282
|
-
;;
|
|
283
|
-
|
|
284
|
-
"custom-metrics")
|
|
285
|
-
kubectl create -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/deploy/production/adapter.yaml
|
|
286
|
-
;;
|
|
287
|
-
|
|
288
|
-
"velero")
|
|
289
|
-
installVelero # because it's a little more involved
|
|
290
|
-
;;
|
|
291
|
-
|
|
292
|
-
*)
|
|
293
|
-
if [ ! -d $SERVICE ] || [ ! -f $SERVICE/values-local.yaml ];
|
|
294
|
-
then
|
|
295
|
-
printf "\n$YELO_WARN Skipping unknown service => $SERVICE\n\n"
|
|
296
|
-
continue
|
|
297
|
-
fi
|
|
298
|
-
|
|
299
|
-
if [ -f $SERVICE/.nohelm ];
|
|
300
|
-
then
|
|
301
|
-
printf "\n$YELO_WARN Helmup disabled for service => `color g $SERVICE`"
|
|
302
|
-
printf "\n$YELO_WARN remove `color y $SERVICE/.nohelm` to enable\n"
|
|
303
|
-
sleep 1 # sleep on it to make sure people see the deprecation
|
|
304
|
-
continue
|
|
305
|
-
fi
|
|
306
|
-
|
|
307
|
-
printf "\n--------------------------------------------------------------\nCharting $SERVICE\n"
|
|
308
|
-
# By default the museum chart name will be the same as the service, but
|
|
309
|
-
# we have the flexibility to override the naming when the charts are
|
|
310
|
-
# reference by the downstream repositories via the .helmup-charmuseum file.
|
|
311
|
-
OVERRIDE="$SERVICE/.helmup-chartmuseum"
|
|
312
|
-
MUSEUM=$SERVICE
|
|
313
|
-
if [ -f $OVERRIDE ];
|
|
314
|
-
then
|
|
315
|
-
MUSEUM=$(<${OVERRIDE})
|
|
316
|
-
printf "\n$YELO_WARN Local chartmuseum name override from ${SERVICE} to ${MUSEUM}\n"
|
|
317
|
-
fi
|
|
318
|
-
HELMUP="helm upgrade --install $SERVICE chartmuseum/$MUSEUM -f $SERVICE/values.yaml $CHARTVER"
|
|
319
|
-
printf "Helming => `color g \"$HELMUP\"`\n" && $HELMUP
|
|
320
|
-
SAVERR=$?
|
|
321
|
-
if [ $SAVERR -ne 0 ];
|
|
322
|
-
then
|
|
323
|
-
cat<<NOTRUNNING
|
|
324
|
-
|
|
325
|
-
$RED_ERROR helm exited with error status: $SAVERR
|
|
326
|
-
|
|
327
|
-
$RED_ERROR The $SERVICE chart failed to upgrade or install. There may be an
|
|
328
|
-
issue with the service's helm charts, or chartmuseum may not be
|
|
329
|
-
up and running? If the latter, try firing it up with:
|
|
330
|
-
|
|
331
|
-
chartmuseum \\
|
|
332
|
-
--port="8080" \\
|
|
333
|
-
--storage-google-bucket="leverege-helm-charts" \\
|
|
334
|
-
--storage-google-prefix="" \\
|
|
335
|
-
--storage="google" &> /dev/null &
|
|
336
|
-
|
|
337
|
-
NOTRUNNING
|
|
338
|
-
exit 1
|
|
339
|
-
fi
|
|
340
|
-
;;
|
|
341
|
-
esac
|
|
342
|
-
done
|
|
343
|
-
|
|
344
|
-
printf "\nRunning => helm ls\n\n"
|
|
345
|
-
helm ls
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
doInstall $@
|
|
349
|
-
cd - &> /dev/null
|