Skip to content

Commit b865375

Browse files
committed
Update probes
1 parent 4eb928a commit b865375

File tree

6 files changed

+21
-23
lines changed

6 files changed

+21
-23
lines changed

k8s/kafka-persistent.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ spec:
8686
- name: SERVER_log_retention_hours
8787
value: "2147483647"
8888
- name: SERVER_zookeeper_connect
89-
value: "zk-0.zk:2181,zk-1.zk:2181,zk-2.zk:2181"
89+
value: "zk-0.zk:2181"
9090
- name: SERVER_log_dirs
9191
value: "/opt/kafka/data/logs"
9292
- name: SERVER_zookeeper_connection_timeout_ms
@@ -95,14 +95,14 @@ spec:
9595
exec:
9696
command:
9797
- kafka_server_status.sh
98-
initialDelaySeconds: 30
99-
timeoutSeconds: 5
98+
initialDelaySeconds: 50
99+
timeoutSeconds: 60
100100
readinessProbe:
101101
exec:
102102
command:
103103
- kafka_server_status.sh
104-
initialDelaySeconds: 30
105-
timeoutSeconds: 5
104+
initialDelaySeconds: 50
105+
timeoutSeconds: 60
106106
volumeMounts:
107107
- name: data
108108
mountPath: /opt/kafka/data
@@ -111,7 +111,6 @@ spec:
111111
name: data
112112
spec:
113113
accessModes: [ "ReadWriteOnce" ]
114-
storageClassName: "standard"
115114
resources:
116115
requests:
117116
storage: 1Gi

k8s/kafka-zk-persistent.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ spec:
106106
readinessProbe:
107107
exec:
108108
command:
109-
- kafka_server_status.sh
110-
initialDelaySeconds: 30
111-
timeoutSeconds: 5
109+
- kafka_server_status.sh
110+
initialDelaySeconds: 60
111+
timeoutSeconds: 30
112112
livenessProbe:
113113
exec:
114114
command:
115-
- kafka_server_status.sh
116-
initialDelaySeconds: 30
117-
timeoutSeconds: 5
115+
- kafka_server_status.sh
116+
initialDelaySeconds: 60
117+
timeoutSeconds: 30
118118
volumeMounts:
119119
- name: kafka-data
120120
mountPath: /opt/kafka/data
@@ -127,23 +127,20 @@ spec:
127127
name: kafka-data
128128
spec:
129129
accessModes: [ "ReadWriteOnce" ]
130-
storageClassName: "standard"
131130
resources:
132131
requests:
133132
storage: 1Gi
134133
- metadata:
135134
name: zk-data
136135
spec:
137136
accessModes: [ "ReadWriteOnce" ]
138-
storageClassName: "standard"
139137
resources:
140138
requests:
141139
storage: 1Gi
142140
- metadata:
143141
name: zk-datalog
144142
spec:
145143
accessModes: [ "ReadWriteOnce" ]
146-
storageClassName: "standard"
147144
resources:
148145
requests:
149146
storage: 1Gi

k8s/kafka-zk.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ spec:
7575
# livenessProbe:
7676
# exec:
7777
# command:
78-
# - kafka_server_status.sh
78+
# - kafka_server_status.sh
7979
# initialDelaySeconds: 60
8080
# timeoutSeconds: 60
8181
# readinessProbe:
8282
# exec:
8383
# command:
84-
# - kafka_server_status.sh
84+
# - kafka_server_status.sh
8585
# initialDelaySeconds: 60
8686
# timeoutSeconds: 60

k8s/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function check()
7878
echo "ERROR: Max number of attempts was reached (${MAX_ATTEMPTS})"
7979
exit 1
8080
fi
81-
READY_REPLICAS=$(kubectl get -f $1 -o jsonpath='{.items[?(@.kind=="StatefulSet")].status.currentReplicas}' 2>&1)
81+
READY_REPLICAS=$(kubectl get -f $1 -o jsonpath='{.items[?(@.kind=="StatefulSet")].status.readyReplicas}' 2>&1)
8282
echo "[${ATTEMPTS}/${MAX_ATTEMPTS}] - Ready replicas : ${READY_REPLICAS:-0}/$REPLICAS ... "
8383
done
8484
kubectl get all

kafka_server_status.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
22

3-
### Default properties
3+
### bootstrap servers, timeout
4+
timeout=${1:-60}
5+
bootstrap_servers=${2:-"localhost:${SERVER_port}"}
46

5-
timeout 30 $KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server localhost:${SERVER_port} --list > /dev/null 2>&1
7+
timeout $timeout $KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server $bootstrap_servers --list > /dev/null 2>&1
68
if [[ $? -eq 0 ]]; then
7-
echo -e "\033[32mKafka server is running, :-)\033[0m"
9+
echo -e "\033[32mKafka topics list command executed successfully, :-)\033[0m"
810
exit 0
911
else
10-
echo -e "\033[31mKafka server is not running, :-(\033[0m"
12+
echo -e "\033[31mKafka topics list command failed, :-(\033[0m"
1113
exit 1
1214
fi

openshift/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function check()
7373
echo "ERROR: Max number of attempts was reached (${MAX_ATTEMPTS})"
7474
exit 1
7575
fi
76-
READY_REPLICAS=$(oc get statefulset -l component=${2:-kafka} -o jsonpath='{.items[?(@.kind=="StatefulSet")].status.currentReplicas}' 2>&1)
76+
READY_REPLICAS=$(oc get statefulset -l component=${2:-kafka} -o jsonpath='{.items[?(@.kind=="StatefulSet")].status.readyReplicas}' 2>&1)
7777
echo "[${ATTEMPTS}/${MAX_ATTEMPTS}] - Ready replicas : ${READY_REPLICAS:-0}/$REPLICAS ... "
7878
done
7979
oc get all

0 commit comments

Comments
 (0)