diff --git a/kafka/10broker-config.yml b/kafka/10broker-config.yml index 8f9841ea..b9740b5f 100644 --- a/kafka/10broker-config.yml +++ b/kafka/10broker-config.yml @@ -19,9 +19,7 @@ data: SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/") } && { ZONE=$(kubectl get node "$NODE_NAME" -o=go-template='{{index .metadata.labels "failure-domain.beta.kubernetes.io/zone"}}') - if [ $? -ne 0 ]; then - SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# zone lookup failed, see -c init-config logs/") - elif [ "x$ZONE" == "x" ]; then + if [ "x$ZONE" == "x" ]; then SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# zone label not found for node $NODE_NAME/") else SEDS+=("s/#init#broker.rack=#init#/broker.rack=$ZONE/") @@ -29,13 +27,9 @@ data: fi OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}') - if [ $? -ne 0 ]; then - echo "Outside (i.e. cluster-external access) host lookup command failed" - else - OUTSIDE_PORT=3240${KAFKA_BROKER_ID} - SEDS+=("s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|") - ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT" - fi + OUTSIDE_PORT=3240${KAFKA_BROKER_ID} + SEDS+=("s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|") + ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT" if [ ! -z "$LABELS" ]; then kubectl -n $POD_NAMESPACE label pod $POD_NAME $LABELS || echo "Failed to label $POD_NAMESPACE.$POD_NAME - RBAC issue?"