[stable/kong] dry out wait-for-db container (#13439)

Signed-off-by: Harry Bagdi <harrybagdi@gmail.com>
This commit is contained in:
Harry
2019-05-01 11:56:18 -07:00
committed by Kubernetes Prow Robot
parent cbeabdb842
commit b7789c0536
4 changed files with 27 additions and 42 deletions
+1 -1
View File
@@ -10,5 +10,5 @@ maintainers:
name: kong
sources:
- https://github.com/Kong/kong
version: 0.10.0
version: 0.10.1
appVersion: 1.1
+24
View File
@@ -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 -}}
@@ -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 }}"
+1 -21
View File
@@ -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 }}"