diff --git a/charts/backend/Chart.yaml b/charts/backend/Chart.yaml index 645a78c..67454f0 100644 --- a/charts/backend/Chart.yaml +++ b/charts/backend/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: backend description: Helm chart scaffolding for Backend applications. type: application -version: 3.6.3 +version: 3.6.4 appVersion: 1.3.0 diff --git a/charts/backend/templates/migrate-job.yaml b/charts/backend/templates/migrate-job.yaml new file mode 100644 index 0000000..ddc331b --- /dev/null +++ b/charts/backend/templates/migrate-job.yaml @@ -0,0 +1,70 @@ +{{- if .Values.migration.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "ucraft-base-helm.fullname" . }}-migrate + labels: + {{- include "ucraft-base-helm.labels" . | nindent 4 }} + {{- with $annotations := merge .Values.migration.annotations .Values.podAnnotations }} + annotations: + {{- $annotations | toYaml | nindent 4 }} + {{- end }} +spec: + template: + metadata: + labels: + {{- include "ucraft-base-helm.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: migration + {{- if .Values.migration.podAnnotations }} + annotations: {{- include "ucraft-base-helm.fullname" (dict "value" .Values.migration.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + {{- with .Values.migration.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 6 }} + {{- end }} + restartPolicy: "{{ .Values.migration.restartPolicy }}" + containers: + - name: "{{ include "ucraft-base-helm.fullname" . }}" + image: "{{ .Values.migration.image.repository }}:{{ .Values.migration.image.tag }}" + imagePullPolicy: {{ default "IfNotPresent" .Values.migration.image.pullPolicy }} + + {{- if .Values.migration.config.command }} + command: + {{- toYaml .Values.migration.config.command | nindent 14 }} + {{- end }} + + {{- if .Values.migration.config.args }} + args: + {{- range $v := .Values.migration.config.args }} + - "{{ $v }}" + {{- end }} + {{- end }} + + {{- if .Values.migration.config.env }} + env: + {{- range $k, $v := .Values.migration.config.env }} + - name: "{{ $k }}" + value: "{{ $v }}" + {{- end }} + {{- end }} + + {{- if .Values.migration.config.secrets }} + envFrom: + - secretRef: + name: {{ .Release.Name }}-migration-secret + {{- end }} + + + {{- if .Values.migration.extraVolumeMounts }} + volumeMounts: + {{- toYaml .Values.migration.extraVolumeMounts| nindent 12 }} + {{- end }} + {{- if .Values.migration.resources }} + resources: {{- toYaml .Values.migration.resources | nindent 12 }} + {{- end }} + {{- if .Values.migration.extraVolumes }} + volumes: + {{- toYaml .Values.migration.extraVolumes | nindent 6 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/backend/values.yaml b/charts/backend/values.yaml index 9fcb049..2a049c5 100644 --- a/charts/backend/values.yaml +++ b/charts/backend/values.yaml @@ -356,3 +356,72 @@ cronjob: gcp: # -- Service Account email to bind to the k8s service account serviceAccount: "" + +migration: + enabled: false + ## In case you want to use a custom image for migration, set this value + ## image: + ## registry: + ## repository: + ## tag: + ## digest: "" + ## + config: + command: [] + # - "/bin/sh" + args: [] + # - "-c" + # - "echo 'Environment $(hello_env)! Secret $(username).'" + + # -- Map of environment variables to use within the job + env: {} + # hello_env: "world" + + # -- Map of secrets that will be exposed as environment variables within the job + secrets: {} + # username: "password" + + # -- List of config maps to mount to the deployment + configMaps: [] + # - name: "volume-1" + # mountPath: "/etc/config" # Must be unique + # mountPropagation: None # If unset will default to 'None' + # files: [] + # - key: "file.cfg" # Key must be unique for each file + # contentsB64: "" # The file contents which have already been base-64 encoded + # contentsFile: "" # The path to a local file (note: contentsB64 will take precedence if not-empty) + + ## @param migration.args Override default container args (useful when using custom images) + ## + image: + repository: "busybox" + tag: "latest" + # -- Whether the repository is public + isRepositoryPublic: true + # -- The image pullPolicy to use + pullPolicy: "IfNotPresent" + extraVolumeMounts: [] + extraVolumes: [] + ## Container resource requests and limits + ## ref: https://kubernetes.io/docs/user-guide/compute-resources/ + ## @param migration.resources.limits The resources limits for the container + ## @param migration.resources.requests The requested resources for the container + ## + resources: + limits: {} + requests: {} + ## @param migration.hostAliases Add deployment host aliases + ## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ + ## + annotations: + helm.sh/hook: post-install, pre-upgrade, pre-rollback + helm.sh/hook-delete-policy: before-hook-creation, hook-succeeded + ## @param migration.podLabels Additional pod labels + ## Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + ## + restartPolicy: "OnFailure" + podLabels: {} + ## @param migration.podAnnotations Additional pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: {} diff --git a/charts/frontend/Chart.yaml b/charts/frontend/Chart.yaml index 62a5632..fb095db 100644 --- a/charts/frontend/Chart.yaml +++ b/charts/frontend/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: frontend description: A frontend Helm chart for Kubernetes type: application -version: 3.6.3 +version: 3.6.4 appVersion: "0.3.10"