File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 14
14
LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
15
15
ANNOTATIONS=""
16
16
17
- hash kubectl 2 >/dev/null || {
17
+ if ! command -v kubectl >/dev/null; then
18
18
SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/")
19
- } && {
19
+ else
20
20
ZONE=$(kubectl get node "$NODE_NAME" -o=go-template='{{index .metadata.labels "topology.kubernetes.io/zone"}}')
21
21
if [ "x$ZONE" == "x<no value>" ]; then
22
22
SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# zone label not found for node $NODE_NAME/")
37
37
if [ ! -z "$ANNOTATIONS" ]; then
38
38
kubectl -n $POD_NAMESPACE annotate pod $POD_NAME $ANNOTATIONS || echo "Failed to annotate $POD_NAMESPACE.$POD_NAME - RBAC issue?"
39
39
fi
40
- }
40
+ fi
41
41
printf '%s\n' "${SEDS[@]}" | sed -f - /etc/kafka-configmap/server.properties > /etc/kafka/server.properties.tmp
42
42
[ $? -eq 0 ] && mv /etc/kafka/server.properties.tmp /etc/kafka/server.properties
43
43
ln -s /etc/kafka/server.properties /etc/kafka/server.properties.$POD_NAME
You can’t perform that action at this time.
0 commit comments