@@ -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"
0 commit comments