Skip to content

Commit

Permalink
Moves outside host details to annotations,
Browse files Browse the repository at this point in the history
as DNS names may exceed the 63 char limit on label values
and they're not too useful for pod matching in services etc.
  • Loading branch information
solsson committed Jan 28, 2018
1 parent ac67d1c commit b0d09f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kafka/10broker-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data:
sed -i "s/#init#broker.id=#init#/broker.id=$KAFKA_BROKER_ID/" /etc/kafka/server.properties
LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
ANNOTATIONS=""
hash kubectl 2>/dev/null || {
sed -i "s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/" /etc/kafka/server.properties
Expand All @@ -32,12 +33,15 @@ data:
else
OUTSIDE_PORT=3240${KAFKA_BROKER_ID}
sed -i "s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|" /etc/kafka/server.properties
LABELS="$LABELS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
fi
if [ ! -z "$LABELS" ]; then
kubectl -n $POD_NAMESPACE label pod $POD_NAME $LABELS || echo "Failed to label $POD_NAMESPACE.$POD_NAME - RBAC issue?"
fi
if [ ! -z "$ANNOTATIONS" ]; then
kubectl -n $POD_NAMESPACE annotate pod $POD_NAME $ANNOTATIONS || echo "Failed to annotate $POD_NAMESPACE.$POD_NAME - RBAC issue?"
fi
}
server.properties: |-
Expand Down

0 comments on commit b0d09f7

Please sign in to comment.