Skip to content

Commit c2ffe2b

Browse files
committed
[helm] Using config map for STS configuration entries
1 parent 0e265ad commit c2ffe2b

4 files changed

Lines changed: 29 additions & 30 deletions

File tree

helm/templates/configmap.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,25 @@ data:
5353
{{- end }}
5454
5555
{{- end }}
56+
57+
entrypoint.sh: |
58+
#!/bin/sh
59+
set -e
60+
61+
COMPONENT="$1"
62+
63+
FLUSS_SERVER_ID=${POD_NAME##*-}
64+
cp /opt/conf/server.yaml $FLUSS_HOME/conf
65+
66+
BIND_LISTENERS="INTERNAL://${POD_IP}:{{ .Values.listeners.internal.port }}, CLIENT://${POD_IP}:{{ .Values.listeners.client.port }}"
67+
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.${COMPONENT}-server-hs.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}"
68+
69+
echo "" >> $FLUSS_HOME/conf/server.yaml
70+
echo "bind.listeners: ${BIND_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml
71+
echo "advertised.listeners: ${ADVERTISED_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml
72+
73+
if [ "$COMPONENT" = "tablet" ]; then
74+
echo "tablet-server.id: ${FLUSS_SERVER_ID}" >> $FLUSS_HOME/conf/server.yaml
75+
fi
76+
77+
exec bin/${COMPONENT}-server.sh start-foreground

helm/templates/sts-coordinator.yaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,8 @@ spec:
7171
containerPort: {{ .Values.listeners.client.port }}
7272
command:
7373
- "/bin/sh"
74-
- "-c"
75-
- |
76-
export FLUSS_SERVER_ID=${POD_NAME##*-} && \
77-
cp /opt/conf/server.yaml $FLUSS_HOME/conf && \
78-
79-
BIND_LISTENERS="INTERNAL://${POD_IP}:{{ .Values.listeners.internal.port }}, CLIENT://${POD_IP}:{{ .Values.listeners.client.port }}" && \
80-
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.coordinator-server-hs.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \
81-
82-
echo "" >> $FLUSS_HOME/conf/server.yaml && \
83-
echo "bind.listeners: ${BIND_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml && \
84-
echo "advertised.listeners: ${ADVERTISED_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml && \
85-
86-
bin/coordinator-server.sh start-foreground
74+
- "/opt/conf/entrypoint.sh"
75+
- "coordinator"
8776
livenessProbe:
8877
failureThreshold: 100
8978
timeoutSeconds: 1

helm/templates/sts-tablet.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,8 @@ spec:
6767
containerPort: {{ .Values.listeners.client.port }}
6868
command:
6969
- "/bin/sh"
70-
- "-c"
71-
- |
72-
export FLUSS_SERVER_ID=${POD_NAME##*-} && \
73-
cp /opt/conf/server.yaml $FLUSS_HOME/conf && \
74-
75-
BIND_LISTENERS="INTERNAL://${POD_IP}:{{ .Values.listeners.internal.port }}, CLIENT://${POD_IP}:{{ .Values.listeners.client.port }}" && \
76-
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.tablet-server-hs.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \
77-
78-
echo "" >> $FLUSS_HOME/conf/server.yaml && \
79-
echo "tablet-server.id: ${FLUSS_SERVER_ID}" >> $FLUSS_HOME/conf/server.yaml && \
80-
echo "bind.listeners: ${BIND_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml && \
81-
echo "advertised.listeners: ${ADVERTISED_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml && \
82-
83-
bin/tablet-server.sh start-foreground
70+
- "/opt/conf/entrypoint.sh"
71+
- "tablet"
8472
livenessProbe:
8573
failureThreshold: 100
8674
timeoutSeconds: 1

helm/tests/security_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ tests:
274274
path: data["server.yaml"]
275275
pattern: 'security\.sasl\.enabled\.mechanisms: PLAIN,PLAIN'
276276
- it: writes server yaml using expected destination path
277-
template: templates/sts-tablet.yaml
277+
template: templates/configmap.yaml
278278
asserts:
279279
- matchRegex:
280-
path: spec.template.spec.containers[0].command[2]
280+
path: data["entrypoint.sh"]
281281
pattern: 'cp /opt/conf/server\.yaml \$FLUSS_HOME/conf'
282282
- matchRegex:
283-
path: spec.template.spec.containers[0].command[2]
283+
path: data["entrypoint.sh"]
284284
pattern: '>> \$FLUSS_HOME/conf/server\.yaml'

0 commit comments

Comments
 (0)