forked from ibm-cloud-architecture/refarch-kc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-infra.sh
executable file
·32 lines (24 loc) · 1.28 KB
/
install-infra.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
#!/bin/bash
SCRIPTLOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $SCRIPTLOC/ocpversion.sh
# Create namespaces for Strimzi and Kafka
kubectl create ns strimzi
kubectl create ns kafka
# Install Strimzi Helm chart
helm repo add strimzi https://strimzi.io/charts
helm install strimzi strimzi/strimzi-kafka-operator -n strimzi --set watchNamespaces={kafka} --wait --timeout 300s
# Install Strimzi custom resource to create cluster
kubectl apply -f $SCRIPTLOC/kafka-strimzi.yml -n kafka
# Create namespace for Postgres
kubectl create ns postgres
# Create a service account for the postgres container to use
kubectl create serviceaccount -n postgres pgserviceaccount
# Postgres requires root permissions which must be explicitly granted on OpenShift
if [ ! -z "$OCPVERSION" ]; then
oc adm policy add-scc-to-user anyuid -z pgserviceaccount -n postgres
fi
# Install Postgres Helm chart
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install postgresql bitnami/postgresql -n postgres --wait --timeout=300s --set postgresqlPassword=supersecret --set persistence.enabled=false --set serviceAccount.enabled=true --set serviceAccount.name=pgserviceaccount
# Wait for cluster to be ready before continuing
kubectl wait --for=condition=Ready kafkas/my-cluster -n kafka --timeout 180s