X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=helm%2Finfrastructure%2Fsubcharts%2Fkong%2Ftemplates%2Fmigrations-post-upgrade.yaml;h=29418d1f51118801a1fcbcf0a3ee67f4caf23fce;hb=dbbf31ae9bcdac04367bf8644a380c87ce155570;hp=dcc9b77a63c9614145f2b4bdce1142be369bd054;hpb=38dc857062b14145f5b9db89d10eba0ae5b90d11;p=ric-plt%2Fric-dep.git diff --git a/helm/infrastructure/subcharts/kong/templates/migrations-post-upgrade.yaml b/helm/infrastructure/subcharts/kong/templates/migrations-post-upgrade.yaml old mode 100755 new mode 100644 index dcc9b77..29418d1 --- a/helm/infrastructure/subcharts/kong/templates/migrations-post-upgrade.yaml +++ b/helm/infrastructure/subcharts/kong/templates/migrations-post-upgrade.yaml @@ -6,11 +6,8 @@ kind: Job metadata: name: {{ template "kong.fullname" . }}-post-upgrade-migrations labels: - app: {{ template "kong.name" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - component: post-upgrade-migrations + {{- include "kong.metaLabels" . | nindent 4 }} + app.kubernetes.io/component: post-upgrade-migrations annotations: helm.sh/hook: "post-upgrade" helm.sh/hook-delete-policy: "before-hook-creation" @@ -19,58 +16,34 @@ spec: metadata: name: {{ template "kong.name" . }}-post-upgrade-migrations labels: - app: {{ template "kong.name" . }} - release: "{{ .Release.Name }}" - component: post-upgrade-migrations + {{- include "kong.metaLabels" . | nindent 8 }} + app.kubernetes.io/component: post-upgrade-migrations spec: + {{- if .Values.podSecurityPolicy.enabled }} + serviceAccountName: {{ template "kong.serviceAccountName" . }} + {{- end }} {{- if .Values.image.pullSecrets }} imagePullSecrets: {{- range .Values.image.pullSecrets }} - name: {{ . }} {{- end }} {{- end }} - {{- if .Values.postgresql.enabled }} initContainers: - - name: wait-for-postgres - image: "{{ .Values.waitImage.repository }}:{{ .Values.waitImage.tag }}" - env: - - 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 - command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ] + {{- if (eq .Values.env.database "postgres") }} + {{- include "kong.wait-for-postgres" . | nindent 6 }} {{- end }} containers: - name: {{ template "kong.name" . }}-post-upgrade-migrations image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - - name: KONG_NGINX_DAEMON - value: "off" - {{- if .Values.enterprise.enabled }} - {{- include "kong.license" . | nindent 8 }} - {{- end }} - {{- 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 }} + {{- include "kong.final_env" . | nindent 8 }} command: [ "/bin/sh", "-c", "kong migrations finish" ] + volumeMounts: + {{- include "kong.volumeMounts" . | nindent 8 }} + securityContext: + {{- include "kong.podsecuritycontext" . | nindent 8 }} restartPolicy: OnFailure + volumes: + {{- include "kong.volumes" . | nindent 6 -}} {{- end }}