From e367b615a083cccca04435caa0fd5612c588515f Mon Sep 17 00:00:00 2001 From: "Jorge E. Gamboa G." Date: Tue, 28 May 2024 10:41:40 +0200 Subject: [PATCH] Adding pre-hook to helm chart --- .DS_Store | Bin 0 -> 6148 bytes charts/base-otc/templates/deployment.yaml | 2 ++ .../base-otc/templates/hooks/pre-install.yaml | 34 ++++++++++++++++++ charts/base-otc/values.yaml | 3 ++ 4 files changed, 39 insertions(+) create mode 100644 .DS_Store create mode 100644 charts/base-otc/templates/hooks/pre-install.yaml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..35717b6f8682138524442f0f20473ca4477f5fbc GIT binary patch literal 6148 zcmeHKy-EW?5S~e*Mzn~X`o0vp$Lc&E&`g;%yOG|qz3*SS~2k-?1 zzu6s=+nljeL}p<2+nb-=x$lmfTO#7twBICZ5K$c}SXsyLg@|9YBo(!60$J7=4w~&= zHX4^A&G1(lkY`t;JsQvjO@img$AhA8lqE@bm~~;RKOSwp@4P-8g#P}w{&8A(H&$+u zN^76{Qc6?m2D?-BrW{eM;oKTFXMrypm-xK^^>zZA^>-W55{raR$({Md}+KZ8Qdq0b^jsfP5b!s9>y^ zdvu=;4DJX3tikLAb2&>$PNWzs<{sgJuuld0RMsN~`*heNjf)j?k3OAP4Mvz}1c z?T+;$7fu{|w9yza20{j^{<0zc|8V*FKTNVKW55{rR}641X(uh*lJ?fp%}K9~pdF}) o#N{4mDVVrcj96*K+fXO4M=}A%in&KvAoe5RXt2Q;_*Diz0MI>Y`~Uy| literal 0 HcmV?d00001 diff --git a/charts/base-otc/templates/deployment.yaml b/charts/base-otc/templates/deployment.yaml index b565ad8..410d760 100644 --- a/charts/base-otc/templates/deployment.yaml +++ b/charts/base-otc/templates/deployment.yaml @@ -36,6 +36,8 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + command: {{ .Values.command | toYaml | nindent 12 }} # Add this line for ENTRYPOINT + args: {{ .Values.args | toYaml | nindent 12 }} # Add this line for CMD env: {{- if .Values.image.env }} {{- range $key, $value := .Values.image.env }} diff --git a/charts/base-otc/templates/hooks/pre-install.yaml b/charts/base-otc/templates/hooks/pre-install.yaml new file mode 100644 index 0000000..9637985 --- /dev/null +++ b/charts/base-otc/templates/hooks/pre-install.yaml @@ -0,0 +1,34 @@ +{{- if .Values.preJob.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "pre-job" + labels: + {{- include "base-otc.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + name: "pre-job" + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + restartPolicy: Never + containers: + - name: "pre-job-container" + image: "{{ .Values.preJob.image }}" + env: + {{- if .Values.preJob.env }} + {{- range $key, $value := .Values.preJob.env }} + - name: {{ $key | quote }} + value: {{ $value | quote }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/base-otc/values.yaml b/charts/base-otc/values.yaml index cea2b34..ca83a2e 100644 --- a/charts/base-otc/values.yaml +++ b/charts/base-otc/values.yaml @@ -9,6 +9,9 @@ image: # repository: nginx pullPolicy: IfNotPresent +preJob: + enabled: false + imagePullSecrets: [] nameOverride: "" fullnameOverride: ""