diff --git a/charts/backend/Chart.yaml b/charts/backend/Chart.yaml index 22d4302..645a78c 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.2 +version: 3.6.3 appVersion: 1.3.0 diff --git a/charts/frontend/Chart.yaml b/charts/frontend/Chart.yaml index cc0d646..62a5632 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.2 +version: 3.6.3 appVersion: "0.3.10" diff --git a/charts/frontend/templates/cronjob.yaml b/charts/frontend/templates/cronjob.yaml index 4610e4e..1f32dda 100644 --- a/charts/frontend/templates/cronjob.yaml +++ b/charts/frontend/templates/cronjob.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: CronJob metadata: - name: {{ include "laravel.fullname" . }} + name: {{ include "ucraft-base-helm.fullname" . }} spec: schedule: "{{ .Values.cronjob.schedule }}" concurrencyPolicy: "{{ .Values.cronjob.concurrencyPolicy }}" @@ -14,7 +14,7 @@ spec: template: metadata: labels: - app: {{ include "laravel.fullname" . }} + app: {{ include "ucraft-base-helm.fullname" . }} annotations: {{- if .Values.cronjob.configMaps }} {{- range $v := .Values.cronjob.configMaps }} @@ -54,7 +54,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} containers: - - name: "{{ include "laravel.fullname" . }}" + - name: "{{ include "ucraft-base-helm.fullname" . }}" image: "{{ .Values.cronjob.image.repository }}:{{ .Values.cronjob.image.tag }}" imagePullPolicy: {{ default "IfNotPresent" .Values.cronjob.image.pullPolicy }} diff --git a/charts/frontend/templates/migrate-public-job.yaml b/charts/frontend/templates/migrate-public-job.yaml new file mode 100644 index 0000000..cd2ba16 --- /dev/null +++ b/charts/frontend/templates/migrate-public-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.image.repository }}:{{ .Values.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/frontend/values.yaml b/charts/frontend/values.yaml index 49ad29a..a990fab 100644 --- a/charts/frontend/values.yaml +++ b/charts/frontend/values.yaml @@ -147,6 +147,75 @@ extraDeploy: ports: - containerPort: 80 +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: {} + cronjob: enabled: false