Skip to content

Commit e57e4ad

Browse files
committed
Fix init container indentation
Signed-off-by: SharonDiskin <[email protected]>
1 parent 4f12337 commit e57e4ad

File tree

2 files changed

+50
-53
lines changed

2 files changed

+50
-53
lines changed

charts/emissary-ingress/templates/deployment.yaml

Lines changed: 42 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -132,51 +132,52 @@ spec:
132132
{{- end }}
133133
{{- if or .Values.initContainers (and .Values.waitForApiext (eq .Values.waitForApiext.enabled true)) }}
134134
initContainers:
135-
{{- if and .Values.waitForApiext (eq .Values.waitForApiext.enabled true) }}
136-
- name: wait-for-apiext
137-
image: istio/kubectl:1.5.10
138-
imagePullPolicy: IfNotPresent
139-
{{- with .Values.waitForApiext.securityContext }}
140-
securityContext:
141-
{{- toYaml . | nindent 10 }}
142-
{{- end }}
143-
command: ["/bin/sh", "-c"]
144-
args:
145-
- |
146-
deployment_name={{ .Values.waitForApiext.deploymentName | default "emissary-apiext" | quote }}
147-
deployment_namespace={{ .Values.waitForApiext.deploymentNamespace | default "emissary-system" | quote }}
148-
while true; do
149-
echo "checking if deployment/$deployment_name in namespace: $deployment_namespace exists."
150-
if kubectl get deployment "$deployment_name" -n $deployment_namespace > /dev/null 2>&1; then
151-
echo "$deployment_name.$deployment_namespace exists."
152-
echo "checking if $deployment_name.$deployment_namespace is fully available..."
153-
kubectl wait --for=condition=available deployment/"$deployment_name" -n $deployment_namespace --timeout=5m
154-
if [ $? -eq 0 ]; then
155-
echo "$deployment_name.$deployment_namespace is available"
156-
while true; do
157-
desired_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.spec.replicas}')
158-
current_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.status.replicas}')
159-
if [[ $current_replicas != $desired_replicas ]]; then
160-
echo "$deployment_name.$deployment_namespace is in the process of restarting. Have: $current_replicas, want $desired_replicas"
161-
sleep 3
162-
else
163-
echo "$deployment_name.$deployment_namespace is fully ready and not currently restarting. Have: $current_replicas, want $desired_replicas"
135+
{{- if and .Values.waitForApiext (eq .Values.waitForApiext.enabled true) }}
136+
- name: wait-for-apiext
137+
image: istio/kubectl:1.5.10
138+
imagePullPolicy: IfNotPresent
139+
{{- with .Values.waitForApiext.securityContext }}
140+
securityContext:
141+
{{- toYaml . | nindent 12 }}
142+
{{- end }}
143+
command: ["/bin/sh", "-c"]
144+
args:
145+
- |
146+
deployment_name={{ .Values.waitForApiext.deploymentName | default "emissary-apiext" | quote }}
147+
deployment_namespace={{ .Values.waitForApiext.deploymentNamespace | default "emissary-system" | quote }}
148+
while true; do
149+
echo "checking if deployment/$deployment_name in namespace: $deployment_namespace exists."
150+
if kubectl get deployment "$deployment_name" -n $deployment_namespace > /dev/null 2>&1; then
151+
echo "$deployment_name.$deployment_namespace exists."
152+
echo "checking if $deployment_name.$deployment_namespace is fully available..."
153+
kubectl wait --for=condition=available deployment/"$deployment_name" -n $deployment_namespace --timeout=5m
154+
if [ $? -eq 0 ]; then
155+
echo "$deployment_name.$deployment_namespace is available"
156+
while true; do
157+
desired_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.spec.replicas}')
158+
current_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.status.replicas}')
159+
if [[ $current_replicas != $desired_replicas ]]; then
160+
echo "$deployment_name.$deployment_namespace is in the process of restarting. Have: $current_replicas, want $desired_replicas"
161+
sleep 3
162+
else
163+
echo "$deployment_name.$deployment_namespace is fully ready and not currently restarting. Have: $current_replicas, want $desired_replicas"
164+
break
165+
fi
166+
done
164167
break
168+
else
169+
echo "$deployment_name.$deployment_namespace did not become available within the timeout"
165170
fi
166-
done
167-
break
168171
else
169-
echo "$deployment_name.$deployment_namespace did not become available within the timeout"
172+
echo "$deployment_name.$deployment_namespace does not exist yet. Waiting..."
173+
sleep 3
170174
fi
171-
else
172-
echo "$deployment_name.$deployment_namespace does not exist yet. Waiting..."
173-
sleep 3
174-
fi
175-
done
176-
{{- end }}
177-
{{- if .Values.initContainers }}
178-
{{- toYaml .Values.initContainers | nindent 10 }}
179-
{{- end }}
175+
done
176+
{{- end }}
177+
# This block adds user-provided initContainers as separate list items
178+
{{- if .Values.initContainers }}
179+
{{- toYaml .Values.initContainers | nindent 8 }}
180+
{{- end }}
180181
{{- end }}
181182
containers:
182183
{{- if .Values.prometheusExporter.enabled }}
@@ -215,19 +216,7 @@ spec:
215216
{{- end}}
216217
- name: admin
217218
containerPort: {{ .Values.adminService.port }}
218-
{{- if .Values.adminService.goPluginMetricsPort}}
219-
- name: go-plugin-metrics-port
220-
containerPort: {{ .Values.adminService.goPluginMetricsPort}}
221-
{{- end}}
222219
env:
223-
- name: HOST_IP
224-
valueFrom:
225-
fieldRef:
226-
fieldPath: status.hostIP
227-
{{- if .Values.adminService.goPluginMetricsPort}}
228-
- name: ENABLE_PLUGIN_FILTER_METRICS
229-
value: "true"
230-
{{- end }}
231220
{{- if .Values.prometheusExporter.enabled }}
232221
- name: STATSD_ENABLED
233222
value: "true"

docs/releaseNotes.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ items:
9494
github:
9595
- title: "Remove usage of md5"
9696
link: https://github.com/emissary-ingress/emissary/pull/5794
97+
- title: Fix Helm Chart InitContainer Templating
98+
type: bugfix
99+
body: >-
100+
This release fixes a Helm chart (version 8.9.1) templating issue that caused user-provided
101+
`initContainers` to be incorrectly processed, leading to deployment failures
102+
with a "cannot unmarshal object into Go struct field ... args of type string" error.
103+
The chart now correctly adds custom init containers as distinct entries in the Pod specification.
104+
97105

98106
- version: 3.9.0
99107
prevVersion: 3.8.0

0 commit comments

Comments
 (0)