|
14 | 14 | LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
|
15 | 15 | ANNOTATIONS=""
|
16 | 16 |
|
| 17 | + [ -z "$ADVERTISE_ADDR" ] && echo "ADVERTISE_ADDR is empty, will advertise detected DNS name" |
| 18 | + OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}') |
| 19 | + OUTSIDE_PORT=$((32400 + ${KAFKA_BROKER_ID})) |
| 20 | + SEDS+=("s|#init#advertised.listeners=PLAINTEXT://#init#|advertised.listeners=PLAINTEXT://${ADVERTISE_ADDR}:9092,CONTROLLER://${ADVERTISE_ADDR}:9093,OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|") |
| 21 | + ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT" |
| 22 | +
|
17 | 23 | if ! command -v kubectl >/dev/null; then
|
18 | 24 | SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/")
|
19 | 25 | else
|
|
25 | 31 | LABELS="$LABELS kafka-broker-rack=$ZONE"
|
26 | 32 | fi
|
27 | 33 |
|
28 |
| - [ -z "$ADVERTISE_ADDR" ] && echo "ADVERTISE_ADDR is empty, will advertise detected DNS name" |
29 |
| - OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}') |
30 |
| - OUTSIDE_PORT=$((32400 + ${KAFKA_BROKER_ID})) |
31 |
| - SEDS+=("s|#init#advertised.listeners=PLAINTEXT://#init#|advertised.listeners=PLAINTEXT://${ADVERTISE_ADDR}:9092,OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|") |
32 |
| - ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT" |
33 |
| -
|
34 | 34 | if [ ! -z "$LABELS" ]; then
|
35 | 35 | kubectl -n $POD_NAMESPACE label pod $POD_NAME $LABELS || echo "Failed to label $POD_NAMESPACE.$POD_NAME - RBAC issue?"
|
36 | 36 | fi
|
|
73 | 73 |
|
74 | 74 | ############################# Socket Server Settings #############################
|
75 | 75 |
|
76 |
| - # The address the socket server listens on. It will get the value returned from |
| 76 | + # The address the socket server listens on. It will get the value returned from |
77 | 77 | # java.net.InetAddress.getCanonicalHostName() if not configured.
|
78 | 78 | # FORMAT:
|
79 | 79 | # listeners = listener_name://host_name:port
|
|
82 | 82 | #listeners=PLAINTEXT://:9092
|
83 | 83 | listeners=PLAINTEXT://:9092,OUTSIDE://:9094
|
84 | 84 |
|
85 |
| - # Hostname and port the broker will advertise to producers and consumers. If not set, |
| 85 | + # Hostname and port the broker will advertise to producers and consumers. If not set, |
86 | 86 | # it uses the value for "listeners" if configured. Otherwise, it will use the value
|
87 | 87 | # returned from java.net.InetAddress.getCanonicalHostName().
|
88 | 88 | #advertised.listeners=PLAINTEXT://your.host.name:9092
|
|
0 commit comments