-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·45 lines (33 loc) · 1.28 KB
/
deploy.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
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Enter the following parameters:"
echo "- namespace"
echo "- cluster name"
echo "- topic name"
exit 1
fi
#set the namespace name
NS=$1
#set the kafka cluster name
CLUSTER_NAME=$2
#set the topic name
TOPIC_NAME=$3
oc new-project $NS
# update the operator installer yaml with namespace
sed -i 's/namespace: .*/namespace: '$NS'/' install/cluster-operator/*RoleBinding*.yaml
# install operator
oc apply -f install/strimzi-admin
oc apply -f install/cluster-operator -n $NS
# duplicate the crd to a working folder
mkdir crd/working/
cp crd/cluster_template crd/working/$CLUSTER_NAME -rf
# set cluster name in broker
sed -i 's/name: .*/name: '$CLUSTER_NAME'/' crd/working/$CLUSTER_NAME/kafka-broker.yaml
sed -i 's/namespace: .*/namespace: '$NS'/' crd/working/$CLUSTER_NAME/kafka-broker.yaml
# set parent cluster and topic name
sed -i 's/strimzi.io\/cluster: .*/strimzi.io\/cluster: '$CLUSTER_NAME'/' crd/working/$CLUSTER_NAME/kafka-topic.yaml
sed -i 's/namespace: .*/namespace: '$NS'/' crd/working/$CLUSTER_NAME/kafka-topic.yaml
sed -i 's/name: .*/name: '$TOPIC_NAME'/' crd/working/$CLUSTER_NAME/kafka-topic.yaml
sed -i 's/topicName: .*/topicName: '$TOPIC_NAME'/' crd/working/$CLUSTER_NAME/kafka-topic.yaml
oc apply -f crd/working/$CLUSTER_NAME