This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c67636  feat: add extraInitContainers (#375)
4c67636 is described below

commit 4c676364f22911c083c179ef4fe1d9a3142bc891
Author: ohayak <[email protected]>
AuthorDate: Fri Nov 4 09:13:16 2022 +0100

    feat: add extraInitContainers (#375)
---
 charts/apisix/README.md          | 1 +
 charts/apisix/templates/_pod.tpl | 7 +++++--
 charts/apisix/values.yaml        | 5 +++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 6d3b60f..5bef844 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -82,6 +82,7 @@ The following tables lists the configurable parameters of the 
apisix chart and t
 | `apisix.httpRouter`                               | HTTP routing strategy. 
See [APISIX Router](https://apisix.apache.org/docs/apisix/terminology/router/) 
for the detail.                                                                 
                                                                                
                                                   | `[]` |
 | `extraVolumes`                                    | Additional `volume`, See 
[Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for 
the detail.                                                                     
                                                                                
                                                     | `[]` |
 | `extraVolumeMounts`                               | Additional 
`volumeMounts`, See [Kubernetes 
Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail.  
                                                                                
                                                                                
                                  | `[]` |
+| `extraInitContainers`                             | Additional 
`initContainers`, See [Kubernetes 
initContainers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
 for the detail.                                                                
                                                                                
                                                    | `[]` |
 
 ### gateway parameters
 
diff --git a/charts/apisix/templates/_pod.tpl b/charts/apisix/templates/_pod.tpl
index 0aa952e..5b77893 100644
--- a/charts/apisix/templates/_pod.tpl
+++ b/charts/apisix/templates/_pod.tpl
@@ -132,8 +132,8 @@ spec:
   dnsPolicy: ClusterFirstWithHostNet
   {{- end }}
   hostNetwork: {{ .Values.apisix.hostNetwork }}
-  {{- if .Values.etcd.enabled }}
   initContainers:
+    {{- if .Values.etcd.enabled }}
     - name: wait-etcd
       image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
       {{- if .Values.etcd.fullnameOverride }}
@@ -141,7 +141,10 @@ spec:
       {{ else }}
       command: ['sh', '-c', "until nc -z {{ .Release.Name }}-etcd.{{ 
.Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }} {{ 
.Values.etcd.service.port }}; do echo waiting for etcd `date`; sleep 2; done;"]
       {{- end }}
-  {{- end }}
+    {{- end }}
+    {{- if .Values.extraInitContainers }}
+    {{- toYaml .Values.extraInitContainers | nindent 4 }}
+    {{- end }}
   volumes:
     - configMap:
         name: {{ include "apisix.fullname" . }}
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 72d7e45..5cc2f4a 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -311,6 +311,11 @@ extraVolumeMounts: []
 #   mountPath: /usr/share/extras
 #   readOnly: true
 
+extraInitContainers: []
+# - name: init-myservice
+#   image: busybox:1.28
+#   command: ['sh', '-c', "until nslookup myservice.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do 
echo waiting for myservice; sleep 2; done"]
+
 discovery:
   enabled: false
   registry: {}

Reply via email to