From edc95876a42df25d5d476f7c3e275c1066092a91 Mon Sep 17 00:00:00 2001 From: Amey Karandikar Date: Fri, 15 Mar 2024 11:17:55 -0400 Subject: [PATCH] added support for init container --- charts/accessnode/templates/_cv.tpl | 30 +++++++-------------- charts/accessnode/templates/_pvc.tpl | 23 ++++++++++++++++ charts/accessnode/templates/deploy.yaml | 10 +------ charts/commandcenter/templates/_cv.tpl | 30 +++++++-------------- charts/commandcenter/templates/_pvc.tpl | 23 ++++++++++++++++ charts/commandcenter/templates/deploy.yaml | 15 +++++------ charts/config/templates/_cv.tpl | 30 +++++++-------------- charts/config/templates/_pvc.tpl | 23 ++++++++++++++++ charts/config/templates/secret.yaml | 6 +++++ charts/config/values.yaml | 2 ++ charts/cs/templates/_cv.tpl | 30 +++++++-------------- charts/cs/templates/_pvc.tpl | 23 ++++++++++++++++ charts/cs/templates/deploy.yaml | 10 +------ charts/mediaagent/templates/_cv.tpl | 30 +++++++-------------- charts/mediaagent/templates/_pvc.tpl | 23 ++++++++++++++++ charts/mediaagent/templates/deploy.yaml | 10 +------ charts/networkgateway/templates/_cv.tpl | 30 +++++++-------------- charts/networkgateway/templates/_pvc.tpl | 23 ++++++++++++++++ charts/networkgateway/templates/deploy.yaml | 10 +------ charts/webserver/templates/_cv.tpl | 30 +++++++-------------- charts/webserver/templates/_pvc.tpl | 23 ++++++++++++++++ charts/webserver/templates/deploy.yaml | 10 +------ 22 files changed, 243 insertions(+), 201 deletions(-) diff --git a/charts/accessnode/templates/_cv.tpl b/charts/accessnode/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/accessnode/templates/_cv.tpl +++ b/charts/accessnode/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/accessnode/templates/_pvc.tpl b/charts/accessnode/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/accessnode/templates/_pvc.tpl +++ b/charts/accessnode/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/accessnode/templates/deploy.yaml b/charts/accessnode/templates/deploy.yaml index 3781b98..e87bd02 100644 --- a/charts/accessnode/templates/deploy.yaml +++ b/charts/accessnode/templates/deploy.yaml @@ -53,15 +53,7 @@ spec: {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "10Gi") }} {{- include "cv.deployment.volumes" (list . "jobresults" "20Gi") }} diff --git a/charts/commandcenter/templates/_cv.tpl b/charts/commandcenter/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/commandcenter/templates/_cv.tpl +++ b/charts/commandcenter/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/commandcenter/templates/_pvc.tpl b/charts/commandcenter/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/commandcenter/templates/_pvc.tpl +++ b/charts/commandcenter/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/commandcenter/templates/deploy.yaml b/charts/commandcenter/templates/deploy.yaml index f69ce63..3bab783 100644 --- a/charts/commandcenter/templates/deploy.yaml +++ b/charts/commandcenter/templates/deploy.yaml @@ -50,20 +50,17 @@ spec: volumeMounts: # This section contains list of persistent volumes that has to be mounted onto the container. # This can be left with default settings as mentioned in this template. + {{- if eq (include "cv.utils.isMinVersion" (list . 11 36)) "true" }} + - name: cv-storage-certsandlogs + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Apache/conf + subPath: apacheconf + {{- end }} {{- include "cv.commonVolumeMounts" . }} {{- include "cv.additionalVolumeMounts" . }} {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "10Gi") }} {{- include "cv.deployment.additionalVolumes" . }} diff --git a/charts/config/templates/_cv.tpl b/charts/config/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/config/templates/_cv.tpl +++ b/charts/config/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/config/templates/_pvc.tpl b/charts/config/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/config/templates/_pvc.tpl +++ b/charts/config/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/config/templates/secret.yaml b/charts/config/templates/secret.yaml index b1a87c6..d854363 100644 --- a/charts/config/templates/secret.yaml +++ b/charts/config/templates/secret.yaml @@ -15,6 +15,12 @@ data: {{- if (.Values.secret).authcode }} CV_CSAUTH_CODE: {{ or (.Values.secret).authcode "" | b64enc }} {{- end }} +{{- if (.Values.secret).CCCertificate }} + CCCertificate: {{ or (.Values.secret).CCCertificate "" | b64enc }} +{{- end }} +{{- if (.Values.secret).CCCertificatePassword }} + CCCertificatePassword: {{ or (.Values.secret).CCCertificatePassword "" | b64enc}} +{{- end }} --- diff --git a/charts/config/values.yaml b/charts/config/values.yaml index 36e407b..a6088da 100644 --- a/charts/config/values.yaml +++ b/charts/config/values.yaml @@ -5,6 +5,8 @@ # user: # Optional. Plain text user name used for install. # password: # Optional. Plain text password. # authcode: # Optional. Authcode can be given in place of username/password + # CCCertificate # Optional. Certificate for Command Center. + # CCCertificatePassword # Optional. Plain text password for Command Center certificate. # Optional. If pullsecret.create=true then an image pull secret will be created. # pullsecret: diff --git a/charts/cs/templates/_cv.tpl b/charts/cs/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/cs/templates/_cv.tpl +++ b/charts/cs/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/cs/templates/_pvc.tpl b/charts/cs/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/cs/templates/_pvc.tpl +++ b/charts/cs/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/cs/templates/deploy.yaml b/charts/cs/templates/deploy.yaml index 5e00c54..bb42cfb 100644 --- a/charts/cs/templates/deploy.yaml +++ b/charts/cs/templates/deploy.yaml @@ -72,15 +72,7 @@ spec: {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "50Gi") }} {{- include "cv.deployment.volumes" (list . "csdb" "100Gi") }} diff --git a/charts/mediaagent/templates/_cv.tpl b/charts/mediaagent/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/mediaagent/templates/_cv.tpl +++ b/charts/mediaagent/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/mediaagent/templates/_pvc.tpl b/charts/mediaagent/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/mediaagent/templates/_pvc.tpl +++ b/charts/mediaagent/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/mediaagent/templates/deploy.yaml b/charts/mediaagent/templates/deploy.yaml index 5042f42..35560b8 100644 --- a/charts/mediaagent/templates/deploy.yaml +++ b/charts/mediaagent/templates/deploy.yaml @@ -60,15 +60,7 @@ spec: {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "10Gi") }} {{- include "cv.deployment.volumes" (list . "jobresults" "20Gi") }} diff --git a/charts/networkgateway/templates/_cv.tpl b/charts/networkgateway/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/networkgateway/templates/_cv.tpl +++ b/charts/networkgateway/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/networkgateway/templates/_pvc.tpl b/charts/networkgateway/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/networkgateway/templates/_pvc.tpl +++ b/charts/networkgateway/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/networkgateway/templates/deploy.yaml b/charts/networkgateway/templates/deploy.yaml index 8fa0577..81c8610 100644 --- a/charts/networkgateway/templates/deploy.yaml +++ b/charts/networkgateway/templates/deploy.yaml @@ -50,15 +50,7 @@ spec: {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "10Gi") }} {{- include "cv.deployment.additionalVolumes" . }} diff --git a/charts/webserver/templates/_cv.tpl b/charts/webserver/templates/_cv.tpl index 10bf142..6f49ec3 100644 --- a/charts/webserver/templates/_cv.tpl +++ b/charts/webserver/templates/_cv.tpl @@ -166,6 +166,9 @@ Values in defaults.yaml gets the last priority {{- if eq (include "cv.utils.isMinVersion" (list . 11 40)) "true" }} {{- $initContainer = true }} {{- end }} +{{- if .Release.IsUpgrade -}} +{{- $initContainer = false }} +{{- end }} {{- $initContainer = ternary $defaults.initContainer $initContainer (hasKey $defaults "initContainer") }} {{- $initContainer = ternary .Values.initContainer $initContainer (hasKey .Values "initContainer") }} {{- $initContainer | toString }} @@ -281,31 +284,16 @@ cv.commondeploymentpecs creates pod specifications that are common to all deploy {{- define "cv.initContainer" }} {{- $objectname := include "cv.metadataname" . }} {{- if eq (include "cv.useInitContainer" .) "true" }} - initContainers: + initContainers: - name: {{ $objectname }}-init image: {{ include "cv.image" . }} command: ["/bin/sh", "-c"] args: - - echo -e "CV_COMMCELL_USER=$(echo ${CV_COMMCELL_USER})\nCV_COMMCELL_PWD=$(echo ${CV_COMMCELL_PWD})\nCV_CSAUTH_CODE=$(echo ${CV_CSAUTH_CODE})" > /tmp/artifact/creds.txt - env: - {{- if ((.Values).secret).user }} - - name: CV_COMMCELL_USER - value: {{ .Values.secret.user }} - {{- end }} - {{- if ((.Values).secret).password }} - - name: CV_COMMCELL_PWD - value: {{ .Values.secret.password }} - {{- end }} - {{- if ((.Values).secret).authcode }} - - name: CV_CSAUTH_CODE - value: {{ .Values.secret.authcode }} - {{- end }} - envFrom: - - secretRef: - name: {{ include "cv.metadataname2" (list . "cvcreds") }} - optional: true + - cp /tmp/secretcontents/* /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets volumeMounts: - - name: tmp - mountPath: /tmp/artifact + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + - name: cv-storage-secretssvolume + mountPath: /tmp/secretcontents {{- end }} {{- end }} diff --git a/charts/webserver/templates/_pvc.tpl b/charts/webserver/templates/_pvc.tpl index 4f157b1..5e0ffb7 100644 --- a/charts/webserver/templates/_pvc.tpl +++ b/charts/webserver/templates/_pvc.tpl @@ -172,8 +172,31 @@ storageClass: - name: cv-storage-certsandlogs mountPath: /opt/{{include "cv.utils.getOemPath" .}}/appdata subPath: certificates + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: configsecrets + mountPath: /opt/{{include "cv.utils.getOemPath" .}}/Base64/Temp/k8ssecrets + subPath: k8ssecrets + {{- end }} {{- end }} +{{- define "cv.commonVolumes" }} + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels + - path: "annotations" + fieldRef: + fieldPath: metadata.annotations + {{- if eq (include "cv.useInitContainer" .) "true" }} + - name: cv-storage-secretssvolume + secret: + secretName: {{ include "cv.metadataname2" (list . "cvcreds") }} + - name: configsecrets + emptyDir: {} + {{- end }} +{{- end }} {{- define "cv.deployment.volumes" }} {{- $root := index . 0 }} diff --git a/charts/webserver/templates/deploy.yaml b/charts/webserver/templates/deploy.yaml index 3683da0..d5b4a72 100644 --- a/charts/webserver/templates/deploy.yaml +++ b/charts/webserver/templates/deploy.yaml @@ -56,15 +56,7 @@ spec: {{ include "cv.commonContainerSpecs" . }} volumes: - - name: podinfo - downwardAPI: - items: - - path: "labels" - fieldRef: - fieldPath: metadata.labels - - path: "annotations" - fieldRef: - fieldPath: metadata.annotations + {{- include "cv.commonVolumes" . }} {{- if not $statefulset }} {{- include "cv.deployment.volumes" (list . "certsandlogs" "10Gi") }} {{- include "cv.deployment.volumes" (list . "cache" "10Gi") }}