Skip to content

Commit 5a07d3c

Browse files
committed
The || && construct never worked without kubectl
1 parent 27944d9 commit 5a07d3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kafka/10broker-config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ data:
1414
LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
1515
ANNOTATIONS=""
1616
17-
hash kubectl 2>/dev/null || {
17+
if ! command -v kubectl >/dev/null; then
1818
SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/")
19-
} && {
19+
else
2020
ZONE=$(kubectl get node "$NODE_NAME" -o=go-template='{{index .metadata.labels "topology.kubernetes.io/zone"}}')
2121
if [ "x$ZONE" == "x<no value>" ]; then
2222
SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# zone label not found for node $NODE_NAME/")
@@ -37,7 +37,7 @@ data:
3737
if [ ! -z "$ANNOTATIONS" ]; then
3838
kubectl -n $POD_NAMESPACE annotate pod $POD_NAME $ANNOTATIONS || echo "Failed to annotate $POD_NAMESPACE.$POD_NAME - RBAC issue?"
3939
fi
40-
}
40+
fi
4141
printf '%s\n' "${SEDS[@]}" | sed -f - /etc/kafka-configmap/server.properties > /etc/kafka/server.properties.tmp
4242
[ $? -eq 0 ] && mv /etc/kafka/server.properties.tmp /etc/kafka/server.properties
4343
ln -s /etc/kafka/server.properties /etc/kafka/server.properties.$POD_NAME

0 commit comments

Comments
 (0)