-
Notifications
You must be signed in to change notification settings - Fork 33
/
setup_f5_gke.sh
executable file
·602 lines (544 loc) · 21.4 KB
/
setup_f5_gke.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
INSTANCE_TYPE=""
CHART_VERSION="5.9.7"
GKE_MASTER_VERSION="1.29.4-gke.1043002"
NODE_POOL="cloud.google.com/gke-nodepool: default-pool"
PROMETHEUS="install"
SCRIPT_CMD="$0"
GCLOUD_PROJECT=
CLUSTER_NAME=
NAMESPACE=default
UPGRADE=0
GCS_BUCKET=
CREATE_MODE=
PURGE=0
FORCE=0
MY_VALUES=()
ML_MODEL_STORE="fusion"
DRY_RUN=""
SOLR_DISK_GB=50
ENABLE_SOLR_BACKUP=0
SOLR_BACKUP_NFS_GB=1024
function print_usage() {
CMD="$1"
ERROR_MSG="$2"
if [ "$ERROR_MSG" != "" ]; then
echo -e "\nERROR: $ERROR_MSG\n"
fi
echo -e " -c Name of the GKE cluster (required)\n"
echo -e " -p GCP Project ID (required)\n"
echo -e " -r Helm release name for installing Fusion 5; defaults to the namespace, see -n option\n"
echo -e " -n Kubernetes namespace to install Fusion 5 into, defaults to 'default'\n"
echo -e " -i Instance type, defaults to '${INSTANCE_TYPE}'\n"
echo -e " -t Enable TLS for the ingress, requires a hostname to be specified with -h\n"
echo -e " -z GCP Zone (deprecated), see usage for --region\n"
echo -e " -h Hostname for the ingress to route requests to this Fusion cluster. If used with the -t parameter,"
echo -e " then the hostname must be a public DNS record that can be updated to point to the IP of the LoadBalancer\n"
echo -e " --prometheus Enable Prometheus and Grafana for monitoring Fusion services, pass one of: install, provided, none;"
echo -e " defaults to 'install' which installs Prometheus and Grafana from the stable Helm repo,"
echo -e " 'provided' enables pod annotations on Fusion services to work with Prometheus but does not install anything\n"
echo -e " --gke GKE Master version; defaults to '-' which uses the default version for the selected region / zone (differs between zones)\n"
echo -e " --version Fusion Helm Chart version; defaults to the latest release from Lucidworks, such as ${CHART_VERSION}\n"
echo -e " --values Custom values file containing config overrides; defaults to gke_<cluster>_<namespace>_fusion_values.yaml"
echo -e " (can be specified multiple times to add additional yaml files, see example-values/*.yaml)\n"
echo -e " --num-solr Number of Solr pods to deploy, defaults to 1. If a multiaz deployment is created the default value will be 3\n"
echo -e " --num-kafka Number of Kafka pods to deploy, defaults to 1. If a multiaz deployment is created the default value will be 3\n"
echo -e " --solr-disk-gb Size (in gigabytes) of the Solr persistent volume claim, defaults to 50\n"
echo -e " --enable-solr-backup Enable creation of a GCP Fileshare for solr backups and automation of backup \n"
echo -e " --solr-backup-fs-gb Size (in gigabytes) of the GCP Fileshare for solr backups, defaults to ${SOLR_BACKUP_NFS_GB}\n"
echo -e " --node-pool Node pool label to assign pods to specific nodes, this option is only useful for existing clusters where you defined a custom node pool;"
echo -e " defaults to '${NODE_POOL}', wrap the arg in double-quotes\n"
echo -e " --create Create a cluster in GKE; provide the mode of the cluster to create, one of: demo, multi_az\n "
echo -e " --region GCP Region to launch the cluster in, defaults to 'us-west1'; for single node demo clusters a random zone from the region will be selected\n"
echo -e " --upgrade Perform a Helm upgrade on an existing Fusion installation\n"
echo -e " --dry-run Perform a dry-run of the upgrade to see what would change\n"
echo -e " --purge Uninstall and purge all Fusion objects from the specified namespace and cluster."
echo -e " Be careful! This operation cannot be undone.\n"
echo -e " --force Force upgrade or purge a deployment if your account is not the value 'owner' label on the namespace\n"
}
if [ $# -gt 0 ]; then
while true; do
case "$1" in
-b)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -c parameter!"
exit 1
fi
echo -e "\nWARNING: The GCS bucket parameter is no longer supported by this script!\n"
shift 2
;;
-c)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -c parameter!"
exit 1
fi
CLUSTER_NAME="$2"
shift 2
;;
-n)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -n parameter!"
exit 1
fi
NAMESPACE="$2"
shift 2
;;
-p)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -p parameter!"
exit 1
fi
GCLOUD_PROJECT="$2"
shift 2
;;
-r)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -r parameter!"
exit 1
fi
RELEASE="$2"
shift 2
;;
-t)
TLS_ENABLED=1
shift 1
;;
-h)
if [[ -h "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -h parameter!"
exit 1
fi
INGRESS_HOSTNAME="$2"
shift 2
;;
-i)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -i parameter!"
exit 1
fi
INSTANCE_TYPE="$2"
shift 2
;;
--prometheus)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --prometheus parameter!"
exit 1
fi
PROMETHEUS="$2"
shift 2
;;
--gke)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --gke parameter!"
exit 1
fi
GKE_MASTER_VERSION="$2"
shift 2
;;
--num-solr)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --num-solr parameter!"
exit 1
fi
SOLR_REPLICAS=$2
shift 2
;;
--num-kafka)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --num-kafka parameter!"
exit 1
fi
KAFKA_REPLICAS=$2
shift 2
;;
--solr-disk-gb)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --solr-disk-gb parameter!"
exit 1
fi
SOLR_DISK_GB=$2
shift 2
;;
--enable-solr-backup)
ENABLE_SOLR_BACKUP=1
shift 1
;;
--solr-backup-fs-gb)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --solr-backup-fs-gb parameter!"
exit 1
fi
SOLR_BACKUP_NFS_GB=$2
shift 2
;;
--node-pool)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --node-pool parameter!"
exit 1
fi
NODE_POOL="$2"
shift 2
;;
--version)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --version parameter!"
exit 1
fi
CHART_VERSION="$2"
shift 2
;;
--values)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --values parameter!"
exit 1
fi
MY_VALUES+=("$2")
shift 2
;;
--create)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --create parameter!"
exit 1
fi
CREATE_MODE="$2"
shift 2
;;
--region)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the --region parameter!"
exit 1
fi
GCLOUD_REGION="$2"
shift 2
;;
-z)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Missing value for the -z parameter!"
exit 1
fi
GCLOUD_ZONE="$2"
shift 2
;;
--upgrade)
UPGRADE=1
shift 1
;;
--dry-run)
DRY_RUN="--dry-run"
shift 1
;;
--purge)
PURGE=1
shift 1
;;
--force)
FORCE=1
shift 1
;;
-help|-usage|--help|--usage)
print_usage "$SCRIPT_CMD"
exit 0
;;
--)
shift
break
;;
*)
if [ "$1" != "" ]; then
print_usage "$SCRIPT_CMD" "Unrecognized or misplaced argument: $1!"
exit 1
else
break # out-of-args, stop looping
fi
;;
esac
done
fi
if [ "$CREATE_MODE" != "" ] && [ "$UPGRADE" == "1" ]; then
print_usage "$SCRIPT_CMD" "Must specify either the --create or --upgrade options but not both!"
exit 1
fi
if [ "$CLUSTER_NAME" == "" ]; then
print_usage "$SCRIPT_CMD" "Please provide the GKE cluster name using: -c <cluster>"
exit 1
fi
if [ "$GCLOUD_PROJECT" == "" ]; then
print_usage "$SCRIPT_CMD" "Please provide the GCP project name using: -p <project>"
exit 1
fi
if [ "${TLS_ENABLED}" == "1" ] && [ -z "${INGRESS_HOSTNAME}" ]; then
print_usage "$SCRIPT_CMD" "if -t is specified -h must be specified and a domain that you can update to add an A record to point to the GCP Loadbalancer IP"
exit 1
fi
valid="0-9a-zA-Z\-"
if [[ $NAMESPACE =~ [^$valid] ]]; then
echo -e "\nERROR: Namespace $NAMESPACE must only contain 0-9, a-z, A-Z, or dash!\n"
exit 1
fi
if [ -z ${RELEASE+x} ]; then
# keep "f5" as the default for legacy purposes when using the default namespace
if [ "${NAMESPACE}" == "default" ]; then
RELEASE="f5"
else
RELEASE="$NAMESPACE"
fi
fi
if [[ $RELEASE =~ [^$valid] ]]; then
echo -e "\nERROR: Release $RELEASE must only contain 0-9, a-z, A-Z, or dash!\n"
exit 1
fi
gcloud --version > /dev/null 2<&1
has_prereq=$?
if [ $has_prereq == 1 ]; then
echo -e "\nERROR: Must install GCloud command line tools! See https://cloud.google.com/sdk/docs/quickstarts"
exit 1
fi
# verify the user is logged in ...
who_am_i=$(gcloud auth list --filter=status:ACTIVE --format="value(account)")
if [ "$who_am_i" == "" ]; then
echo -e "\nERROR: GCloud user unknown, please use: 'gcloud auth login <account>' before proceeding with this script!"
exit 1
fi
OWNER_LABEL="${who_am_i//@/-}"
echo -e "\nLogged in as: $who_am_i\n"
hash kubectl
has_prereq=$?
if [ $has_prereq == 1 ]; then
echo -e "\nERROR: Must install kubectl before proceeding with this script! For GKE, see: https://cloud.google.com/sdk/docs/"
exit 1
fi
hash helm
has_prereq=$?
if [ $has_prereq == 1 ]; then
echo -e "\nERROR: Must install helm before proceeding with this script! See: https://helm.sh/docs/using_helm/#quickstart"
exit 1
fi
# try to set the compute/zone based on args
current_value=$(gcloud config get-value compute/zone)
if [ -n "${GCLOUD_REGION}" ]; then
if [ "${current_value}" != "${GCLOUD_REGION}" ]; then
gcloud config set compute/zone "${GCLOUD_REGION}"
echo -e "Set compute/zone to '${GCLOUD_REGION}'"
fi
else
if [ -n "${GCLOUD_ZONE}" ]; then
if [ "${current_value}" != "${GCLOUD_ZONE}" ]; then
gcloud config set compute/zone "${GCLOUD_ZONE}"
echo -e "Set compute/zone to '${GCLOUD_ZONE}'"
fi
fi
fi
current_value=$(gcloud config get-value project)
if [ "${current_value}" != "${GCLOUD_PROJECT}" ]; then
gcloud config set project "${GCLOUD_PROJECT}"
fi
gcloud beta container clusters list --filter="${CLUSTER_NAME}" | grep "${CLUSTER_NAME}" > /dev/null 2>&1
cluster_status=$?
if [ -z ${GCLOUD_REGION+x} ]; then
# region is not set ... but if they passed -z or --z1, then we'll try to guess the region from the zone, else go with us-west1
if [ -n "${GCLOUD_ZONE}" ]; then
GCLOUD_REGION=$(cut -d'-' -f1 -f2 <<<"$GCLOUD_ZONE")
else
GCLOUD_REGION="us-west1"
fi
echo -e "Using '${GCLOUD_REGION}' for the GCloud region setting; pass '--region <REGION>' to this script to control the region."
fi
if [ "$cluster_status" != "0" ] && [ "${PURGE}" == "0" ] && [ "${UPGRADE}" == "0" ]; then
if [ "$CREATE_MODE" == "" ]; then
CREATE_MODE="multi_az" # the default ...
fi
echo -e "\nLaunching $CREATE_MODE GKE cluster ${CLUSTER_NAME} (K8s Master: ${GKE_MASTER_VERSION}) in project ${GCLOUD_PROJECT} in region ${GCLOUD_REGION} for deploying Lucidworks Fusion 5 ...\n"
if [ "$CREATE_MODE" == "demo" ]; then
if [ "${INSTANCE_TYPE}" == "" ]; then
INSTANCE_TYPE="n1-standard-32"
fi
if [ -z ${SOLR_REPLICAS+x} ]; then
SOLR_REPLICAS=1
fi
if [ -z ${KAFKA_REPLICAS+x} ]; then
KAFKA_REPLICAS=1
fi
#Get zone in case it is not defined
if [ -z ${GCLOUD_ZONE+x} ]; then
GCLOUD_ZONE=$(gcloud compute zones list --filter=region:${GCLOUD_REGION} | grep -m1 "${GCLOUD_REGION}-[a-z]" | cut -d' ' -f 1 | tail -1)
echo -e "Using zone '${GCLOUD_ZONE}' for your demo cluster."
# update the compute/zone based on the updated zone
current_value=$(gcloud config get-value compute/zone)
if [ "${current_value}" != "${GCLOUD_ZONE}" ]; then
gcloud config set compute/zone "${GCLOUD_ZONE}"
fi
fi
gcloud beta container --project "${GCLOUD_PROJECT}" clusters create "${CLUSTER_NAME}" --zone "${GCLOUD_ZONE}" \
--no-enable-basic-auth \
--cluster-version ${GKE_MASTER_VERSION} \
--machine-type ${INSTANCE_TYPE} \
--image-type "cos_containerd" \
--disk-type "pd-standard" \
--disk-size "100" \
--scopes "https://www.googleapis.com/auth/devstorage.full_control","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" \
--num-nodes "1" \
--logging=NONE \
--monitoring=NONE \
--enable-ip-alias \
--network "projects/${GCLOUD_PROJECT}/global/networks/default" \
--subnetwork "projects/${GCLOUD_PROJECT}/regions/${GCLOUD_REGION}/subnetworks/default" \
--default-max-pods-per-node "50" \
--addons HorizontalPodAutoscaling,HttpLoadBalancing \
--no-enable-autoupgrade --enable-autorepair
elif [ "$CREATE_MODE" == "multi_az" ]; then
if [ "${INSTANCE_TYPE}" == "" ]; then
INSTANCE_TYPE="n1-standard-4"
fi
if [ -z ${SOLR_REPLICAS+x} ]; then
SOLR_REPLICAS=3
fi
if [ -z ${KAFKA_REPLICAS+x} ]; then
KAFKA_REPLICAS=3
fi
# make sure the compute/region is updated
current_value=$(gcloud config get-value compute/region)
if [ "${current_value}" != "${GCLOUD_REGION}" ]; then
gcloud config set compute/region "${GCLOUD_REGION}"
fi
gcloud beta container --project "${GCLOUD_PROJECT}" clusters create "${CLUSTER_NAME}" --region "${GCLOUD_REGION}" \
--no-enable-basic-auth \
--cluster-version ${GKE_MASTER_VERSION} \
--machine-type ${INSTANCE_TYPE} \
--image-type "cos_containerd" \
--disk-type "pd-standard" \
--disk-size "100" \
--metadata disable-legacy-endpoints=true \
--scopes "https://www.googleapis.com/auth/devstorage.full_control","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" \
--num-nodes "1" \
--monitoring=SYSTEM \
--logging=SYSTEM,WORKLOAD \
--enable-ip-alias \
--network "projects/${GCLOUD_PROJECT}/global/networks/default" \
--subnetwork "projects/${GCLOUD_PROJECT}/regions/${GCLOUD_REGION}/subnetworks/default" \
--default-max-pods-per-node "50" \
--enable-autoscaling \
--min-nodes "0" \
--max-nodes "3" \
--addons HorizontalPodAutoscaling,HttpLoadBalancing \
--no-enable-autoupgrade --enable-autorepair
else
echo -e "\nERROR: No '--create <MODE>' arg provided and ${CLUSTER_NAME} not found! Please create the ${CLUSTER_NAME} cluster before running this script.\n"
exit 1
fi
echo -e "\nCluster '${CLUSTER_NAME}' deployed ... testing if it is healthy"
gcloud beta container clusters list --filter="${CLUSTER_NAME}" | grep "${CLUSTER_NAME}"
cluster_status=$?
if [ "$cluster_status" != "0" ]; then
echo -e "\nERROR: Status of GKE cluster ${CLUSTER_NAME} is suspect, check the Google Cloud console before proceeding!\n"
exit 1
fi
else
ACTION="install"
if [ "${PURGE}" == "1" ]; then
ACTION="purge"
elif [ "${UPGRADE}" == "1" ]; then
ACTION="upgrade"
fi
if [ "${CREATE_MODE}" != "" ]; then
print_usage "$SCRIPT_CMD" "Cluster '${CLUSTER_NAME}' exists! Refusing to try to create new cluster in mode: ${CREATE_MODE}"
exit 1
fi
echo -e "\nCluster '${CLUSTER_NAME}' exists, starting to ${ACTION} Lucidworks Fusion"
fi
gcloud container clusters get-credentials $CLUSTER_NAME
current=$(kubectl config current-context)
# Pass in custom values
VALUES_STRING=""
for v in "${MY_VALUES[@]}"; do
VALUES_STRING="${VALUES_STRING} --values ${v}"
done
if [ "${ENABLE_SOLR_BACKUP}" == "1" ]; then
BACKUP_VALUES="gke_${CLUSTER_NAME}_${RELEASE}_backup_values.yaml"
VALUES_STRING="${VALUES_STRING} --values ${BACKUP_VALUES}"
if [ -z "${GCLOUD_ZONE}" ]; then
GCLOUD_ZONE=$(gcloud --project "${GCLOUD_PROJECT}" compute zones list --filter=region:${GCLOUD_REGION} | grep -m1 "${GCLOUD_REGION}-[a-z]" | cut -d' ' -f 1 | tail -1)
fi
${SCRIPT_DIR}/setup_gke_filestore.sh -n "${NAMESPACE}" --zone "${GCLOUD_ZONE}" -r "${RELEASE}" -c "${CLUSTER_NAME}" -p "${GCLOUD_PROJECT}" --backup-values-file "${BACKUP_VALUES}" || exit 1
fi
INGRESS_VALUES=""
if [ "${TLS_ENABLED}" == "1" ]; then
# need to create the namespace if it doesn't exist yet
if ! kubectl get namespace "${NAMESPACE}" > /dev/null 2>&1; then
if [ "${UPGRADE}" != "1" ]; then
kubectl create namespace "${NAMESPACE}"
kubectl label namespace "${NAMESPACE}" "owner=${OWNER_LABEL}"
echo -e "\nCreated namespace ${NAMESPACE} with owner label ${OWNER_LABEL}\n"
fi
fi
cat <<EOF | kubectl -n "${NAMESPACE}" apply -f -
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: "${RELEASE}-managed-certificate"
spec:
domains:
- "${INGRESS_HOSTNAME}"
EOF
TLS_VALUES="tls-values.yaml"
INGRESS_VALUES="${INGRESS_VALUES} --values ${TLS_VALUES} --tls"
tee "${TLS_VALUES}" << END
api-gateway:
service:
type: "NodePort"
ingress:
enabled: true
host: "${INGRESS_HOSTNAME}"
path: "/*"
tls:
enabled: true
annotations:
"networking.gke.io/managed-certificates": "${RELEASE}-managed-certificate"
"kubernetes.io/ingress.class": "gce"
END
fi
# Invoke the generic K8s setup script to complete the install/upgrade
INGRESS_ARG=""
if [ ! -z "${INGRESS_HOSTNAME}" ]; then
INGRESS_ARG=" --ingress ${INGRESS_HOSTNAME} ${INGRESS_VALUES}"
fi
UPGRADE_ARGS=""
if [ "${UPGRADE}" == "1" ]; then
UPGRADE_ARGS=" --upgrade"
if [ "${FORCE}" == "1" ]; then
UPGRADE_ARGS="$UPGRADE_ARGS --force"
fi
if [ "${DRY_RUN}" != "" ]; then
UPGRADE_ARGS="$UPGRADE_ARGS --dry-run"
fi
else
if [ "${PURGE}" == "1" ]; then
UPGRADE_ARGS=" --purge"
if [ "${FORCE}" == "1" ]; then
UPGRADE_ARGS="$UPGRADE_ARGS --force"
fi
fi
fi
if [ -z ${SOLR_REPLICAS+x} ]; then
SOLR_REPLICAS=1
fi
if [ -z ${KAFKA_REPLICAS+x} ]; then
KAFKA_REPLICAS=1
fi
( ${SCRIPT_DIR}/setup_f5_k8s.sh -c $CLUSTER_NAME -r "${RELEASE}" --provider "gke" -n "${NAMESPACE}" --node-pool "${NODE_POOL}" \
--version ${CHART_VERSION} --prometheus ${PROMETHEUS} --num-solr "${SOLR_REPLICAS}" --num-kafka "${KAFKA_REPLICAS}" --solr-disk-gb "${SOLR_DISK_GB}" ${VALUES_STRING}${INGRESS_ARG}${UPGRADE_ARGS} )
setup_result=$?
# Open the proxy URL in the browser on a mac
if [ "${setup_result}" == "0" ] && [ "${PURGE}" != "1" ]; then
hash open
has_open=$?
if [ "${has_open}" == "0" ] && [ "${TLS_ENABLED}" == "" ] && [ "${UPGRADE}" == "0" ]; then
PROXY_HOST=$(kubectl --namespace "${NAMESPACE}" get service proxy -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
PROXY_PORT=$(kubectl --namespace "${NAMESPACE}" get service proxy -o jsonpath='{.spec.ports[?(@.protocol=="TCP")].port}')
PROXY_URL="$PROXY_HOST:$PROXY_PORT"
if [ "${PROXY_URL}" != ":" ]; then
open "http://${PROXY_URL}"
fi
fi
fi
exit $setup_result