feat(helm): add securityContext and pull policy values to migration job (#7652)

* fix(helm): corrected indentation in migration-job.yaml

* feat(helm): add securityContext and pull policy values to migration job
This commit is contained in:
Zackeus Bengtsson 2025-01-15 21:51:08 +01:00 committed by GitHub
parent 8c26e1a66d
commit 801f450e8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,50 +1,53 @@
{{- if .Values.migrationJob.enabled }} {{- if .Values.migrationJob.enabled }}
# This job runs the prisma migrations for the LiteLLM DB. # This job runs the prisma migrations for the LiteLLM DB.
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: {{ include "litellm.fullname" . }}-migrations name: {{ include "litellm.fullname" . }}-migrations
annotations: annotations:
argocd.argoproj.io/hook: PreSync argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation # delete old migration on a new deploy in case the migration needs to make updates argocd.argoproj.io/hook-delete-policy: BeforeHookCreation # delete old migration on a new deploy in case the migration needs to make updates
checksum/config: {{ toYaml .Values | sha256sum }} checksum/config: {{ toYaml .Values | sha256sum }}
spec: spec:
template: template:
metadata: metadata:
annotations: annotations:
{{- with .Values.migrationJob.annotations }} {{- with .Values.migrationJob.annotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
containers: containers:
- name: prisma-migrations - name: prisma-migrations
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "main-%s" .Chart.AppVersion) }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "main-%s" .Chart.AppVersion) }}"
command: ["python", "litellm/proxy/prisma_migration.py"] imagePullPolicy: {{ .Values.image.pullPolicy }}
workingDir: "/app" securityContext:
env: {{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.db.useExisting }} command: ["python", "litellm/proxy/prisma_migration.py"]
- name: DATABASE_USERNAME workingDir: "/app"
valueFrom: env:
secretKeyRef: {{- if .Values.db.useExisting }}
name: {{ .Values.db.secret.name }} - name: DATABASE_USERNAME
key: {{ .Values.db.secret.usernameKey }} valueFrom:
- name: DATABASE_PASSWORD secretKeyRef:
valueFrom: name: {{ .Values.db.secret.name }}
secretKeyRef: key: {{ .Values.db.secret.usernameKey }}
name: {{ .Values.db.secret.name }} - name: DATABASE_PASSWORD
key: {{ .Values.db.secret.passwordKey }} valueFrom:
- name: DATABASE_HOST secretKeyRef:
value: {{ .Values.db.endpoint }} name: {{ .Values.db.secret.name }}
- name: DATABASE_NAME key: {{ .Values.db.secret.passwordKey }}
value: {{ .Values.db.database }} - name: DATABASE_HOST
- name: DATABASE_URL value: {{ .Values.db.endpoint }}
value: {{ .Values.db.url | quote }} - name: DATABASE_NAME
{{- else }} value: {{ .Values.db.database }}
- name: DATABASE_URL - name: DATABASE_URL
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }} value: {{ .Values.db.url | quote }}
{{- end }} {{- else }}
- name: DISABLE_SCHEMA_UPDATE - name: DATABASE_URL
value: "false" # always run the migration from the Helm PreSync hook, override the value set value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }}
restartPolicy: OnFailure {{- end }}
backoffLimit: {{ .Values.migrationJob.backoffLimit }} - name: DISABLE_SCHEMA_UPDATE
value: "false" # always run the migration from the Helm PreSync hook, override the value set
restartPolicy: OnFailure
backoffLimit: {{ .Values.migrationJob.backoffLimit }}
{{- end }} {{- end }}