Skip to content

Commit a144de8

Browse files
authored
Merge pull request #306 from Yolean/advertise-pod-ip
Allow override of listener name
2 parents 10d8057 + 31e3985 commit a144de8

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

kafka/10broker-config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ data:
2626
LABELS="$LABELS kafka-broker-rack=$ZONE"
2727
fi
2828
29+
[ -z "$ADVERTISE_ADDR" ] && echo "ADVERTISE_ADDR is empty, will advertise detected DNS name"
2930
OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
3031
OUTSIDE_PORT=$((32400 + ${KAFKA_BROKER_ID}))
31-
SEDS+=("s|#init#advertised.listeners=PLAINTEXT://#init#|advertised.listeners=PLAINTEXT://:9092,OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|")
32+
SEDS+=("s|#init#advertised.listeners=PLAINTEXT://#init#|advertised.listeners=PLAINTEXT://${ADVERTISE_ADDR}:9092,OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|")
3233
ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
3334
3435
if [ ! -z "$LABELS" ]; then

variants/advertise-pod-ip/kafka.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: kafka
5+
spec:
6+
template:
7+
spec:
8+
initContainers:
9+
- name: init-config
10+
env:
11+
- name: ADVERTISE_ADDR
12+
valueFrom:
13+
fieldRef:
14+
fieldPath: status.podIP
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bases:
2+
- ../scale-3-5
3+
patchesStrategicMerge:
4+
- kafka.yaml

0 commit comments

Comments
 (0)