Skip to content

Commit b0d09f7

Browse files
committed
Moves outside host details to annotations,
as DNS names may exceed the 63 char limit on label values and they're not too useful for pod matching in services etc.
1 parent ac67d1c commit b0d09f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kafka/10broker-config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data:
1212
sed -i "s/#init#broker.id=#init#/broker.id=$KAFKA_BROKER_ID/" /etc/kafka/server.properties
1313
1414
LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
15+
ANNOTATIONS=""
1516
1617
hash kubectl 2>/dev/null || {
1718
sed -i "s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/" /etc/kafka/server.properties
@@ -32,12 +33,15 @@ data:
3233
else
3334
OUTSIDE_PORT=3240${KAFKA_BROKER_ID}
3435
sed -i "s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|" /etc/kafka/server.properties
35-
LABELS="$LABELS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
36+
ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
3637
fi
3738
3839
if [ ! -z "$LABELS" ]; then
3940
kubectl -n $POD_NAMESPACE label pod $POD_NAME $LABELS || echo "Failed to label $POD_NAMESPACE.$POD_NAME - RBAC issue?"
4041
fi
42+
if [ ! -z "$ANNOTATIONS" ]; then
43+
kubectl -n $POD_NAMESPACE annotate pod $POD_NAME $ANNOTATIONS || echo "Failed to annotate $POD_NAMESPACE.$POD_NAME - RBAC issue?"
44+
fi
4145
}
4246
4347
server.properties: |-

0 commit comments

Comments
 (0)