diff --git a/stable/kong/Chart.yaml b/stable/kong/Chart.yaml index 069b6bd36a..dac372075f 100644 --- a/stable/kong/Chart.yaml +++ b/stable/kong/Chart.yaml @@ -10,5 +10,5 @@ maintainers: name: kong sources: - https://github.com/Kong/kong -version: 0.10.0 +version: 0.10.1 appVersion: 1.1 diff --git a/stable/kong/templates/_helpers.tpl b/stable/kong/templates/_helpers.tpl index 0a01a7855a..9083d1b3df 100644 --- a/stable/kong/templates/_helpers.tpl +++ b/stable/kong/templates/_helpers.tpl @@ -75,3 +75,27 @@ Create the ingress servicePort value string {{- end -}} {{- end -}} {{- end -}} + +{{- define "kong.wait-for-db" -}} +- name: wait-for-db + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if .Values.postgresql.enabled }} + - name: KONG_PG_HOST + value: {{ template "kong.postgresql.fullname" . }} + - name: KONG_PG_PORT + value: "{{ .Values.postgresql.service.port }}" + - name: KONG_PG_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "kong.postgresql.fullname" . }} + key: postgresql-password + {{- end }} + {{- if .Values.cassandra.enabled }} + - name: KONG_CASSANDRA_CONTACT_POINTS + value: {{ template "kong.cassandra.fullname" . }} + {{- end }} + {{- include "kong.env" . | nindent 2 }} + command: [ "/bin/sh", "-c", "until kong start; do echo 'waiting for db'; sleep 1; done; kong stop" ] +{{- end -}} diff --git a/stable/kong/templates/controller-deployment.yaml b/stable/kong/templates/controller-deployment.yaml index d9a76324f1..326b4f25d2 100644 --- a/stable/kong/templates/controller-deployment.yaml +++ b/stable/kong/templates/controller-deployment.yaml @@ -35,26 +35,7 @@ spec: {{- end }} {{- end }} initContainers: - - name: wait-for-db - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - env: - {{- include "kong.env" . | indent 8 }} - {{- if .Values.postgresql.enabled }} - - name: KONG_PG_HOST - value: {{ template "kong.postgresql.fullname" . }} - - name: KONG_PG_PORT - value: "{{ .Values.postgresql.service.port }}" - - name: KONG_PG_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "kong.postgresql.fullname" . }} - key: postgresql-password - {{- end }} - {{- if .Values.cassandra.enabled }} - - name: KONG_CASSANDRA_CONTACT_POINTS - value: {{ template "kong.cassandra.fullname" . }} - {{- end }} - command: [ "/bin/sh", "-c", "until kong start; do echo 'waiting for db'; sleep 1; done; kong stop" ] + {{- include "kong.wait-for-db" . | nindent 6 }} containers: - name: admin-api image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/stable/kong/templates/deployment.yaml b/stable/kong/templates/deployment.yaml index c0f5303026..eca2eefea2 100644 --- a/stable/kong/templates/deployment.yaml +++ b/stable/kong/templates/deployment.yaml @@ -33,27 +33,7 @@ spec: {{- end }} {{- end }} initContainers: - - name: wait-for-db - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - {{- if .Values.postgresql.enabled }} - - name: KONG_PG_HOST - value: {{ template "kong.postgresql.fullname" . }} - - name: KONG_PG_PORT - value: "{{ .Values.postgresql.service.port }}" - - name: KONG_PG_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "kong.postgresql.fullname" . }} - key: postgresql-password - {{- end }} - {{- if .Values.cassandra.enabled }} - - name: KONG_CASSANDRA_CONTACT_POINTS - value: {{ template "kong.cassandra.fullname" . }} - {{- end }} - {{- include "kong.env" . | indent 8 }} - command: [ "/bin/sh", "-c", "until kong start; do echo 'waiting for db'; sleep 1; done; kong stop" ] + {{- include "kong.wait-for-db" . | nindent 6 }} containers: - name: {{ template "kong.name" . }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"