Files
charts/bitnami/kong/templates/migrate-job.yaml
T
48e66298ad [bitnami/kong] fix: 🔒 Move service-account token auto-mount to pod declaration (#22419)
* [bitnami/kong] fix: 🔒 Move service-account token auto-mount to pod declaration

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* fix: 🐛 Remove duplicate value

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

---------

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Signed-off-by: Javier J. Salmerón-García <jsalmeron@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
2024-01-19 11:56:21 +01:00

121 lines
5.9 KiB
YAML

{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if or (eq .Values.database "postgresql") (eq .Values.database "cassandra") }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "common.names.fullname" . }}-migrate
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: server
{{- if or .Values.migration.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.migration.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
template:
metadata:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.migration.podLabels .Values.commonLabels ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/component: migration
{{- if .Values.migration.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.migration.podAnnotations "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "kong.imagePullSecrets" . | nindent 6 }}
restartPolicy: OnFailure
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
automountServiceAccountToken: {{ .Values.migration.automountServiceAccountToken }}
{{- if .Values.migration.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.migration.hostAliases "context" $) | nindent 8 }}
{{- end }}
containers:
- name: kong-migrate
image: {{ template "kong.migration.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.migration.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.migration.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.migration.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.migration.args "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
env:
- name: KONG_MIGRATE
value: "yes"
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
- name: KONG_EXIT_AFTER_MIGRATE
value: "yes"
- name: KONG_DATABASE
value: {{ include "kong.database" . | quote }}
{{- if (eq .Values.database "postgresql") }}
{{- if .Values.postgresql.auth.usePasswordFiles }}
- name: KONG_POSTGRESQL_PASSWORD_FILE
value: {{ printf "/bitnami/kong/secrets/%s" (include "kong.postgresql.databaseSecretKey" .) }}
{{- else }}
- name: KONG_PG_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "kong.postgresql.secretName" . }}
key: {{ include "kong.postgresql.databaseSecretKey" . }}
{{- end }}
- name: KONG_PG_HOST
value: {{ include "kong.postgresql.host" . }}
- name: KONG_PG_PORT
value: {{ include "kong.postgresql.port" . }}
- name: KONG_PG_USER
value: {{ include "kong.postgresql.user" . }}
{{- end }}
{{- if (eq .Values.database "cassandra") }}
{{- if .Values.cassandra.usePasswordFile }}
- name: KONG_CASSANDRA_PASSWORD_FILE
value: {{ printf "/bitnami/kong/secrets/%s" (include "kong.cassandra.databaseSecretKey" .) }}
{{- else }}
- name: KONG_CASSANDRA_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "kong.cassandra.secretName" . }}
key: {{ include "kong.cassandra.databaseSecretKey" . }}
{{- end }}
- name: KONG_CASSANDRA_CONTACT_POINTS
value: {{ include "kong.cassandra.contactPoints" . }}
- name: KONG_CASSANDRA_PORT
value: {{ include "kong.cassandra.port" . | quote }}
- name: KONG_CASSANDRA_USER
value: {{ include "kong.cassandra.user" . | quote }}
{{- end }}
{{- if .Values.migration.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.migration.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.migration.extraEnvVarsCM .Values.migration.extraEnvVarsSecret }}
envFrom:
{{- if .Values.migration.extraEnvVarsCM }}
- configMapRef:
name: {{ .Values.migration.extraEnvVarsCM }}
{{- end }}
{{- if .Values.migration.extraEnvVarsSecret }}
- secretRef:
name: {{ .Values.migration.extraEnvVarsSecret }}
{{- end }}
{{- end }}
{{- if .Values.migration.extraVolumeMounts }}
volumeMounts:
{{- include "common.tplvalues.render" (dict "value" .Values.migration.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.migration.resources }}
resources: {{- toYaml .Values.migration.resources | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumes }}
volumes:
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 6 }}
{{- end }}
{{- end }}