diff --git a/manifest_staging/charts/secrets-store-csi-driver/templates/_helpers.tpl b/manifest_staging/charts/secrets-store-csi-driver/templates/_helpers.tpl index 74aad8a81..1d1cbf1a7 100644 --- a/manifest_staging/charts/secrets-store-csi-driver/templates/_helpers.tpl +++ b/manifest_staging/charts/secrets-store-csi-driver/templates/_helpers.tpl @@ -53,3 +53,12 @@ Return the appropriate apiVersion for CSIDriver. {{- print "storage.k8s.io/v1beta1" -}} {{- end -}} {{- end -}} + +{{/* +Extract server version when tag has value like 'v1@sha256:3dd721a17' +*/}} +{{- define "imagetag.semver" -}} + {{- $tag := index . 0 -}} + {{- $version := regexFind "^v[0-9]+(\\.[0-9]+)*" $tag -}} + {{- print $version -}} +{{- end -}} diff --git a/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver-windows.yaml b/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver-windows.yaml index d68dc4f37..6d40addfe 100644 --- a/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver-windows.yaml +++ b/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver-windows.yaml @@ -74,17 +74,17 @@ spec: - "--nodeid=$(KUBE_NODE_NAME)" - "--provider-volume={{ .Values.windows.providersDir }}" - "--additional-provider-volume-paths={{ join "," .Values.windows.additionalProvidersDirs }}" - {{- if and (semverCompare ">= v0.0.15-0" .Values.windows.image.tag) .Values.enableSecretRotation }} + {{- if and (semverCompare ">= v0.0.15-0" (include "imagetag.semver" (list .Values.windows.image.tag))) .Values.enableSecretRotation }} - "--enable-secret-rotation={{ .Values.enableSecretRotation }}" {{- end }} - {{- if and (semverCompare ">= v0.0.15-0" .Values.windows.image.tag) .Values.rotationPollInterval }} + {{- if and (semverCompare ">= v0.0.15-0" (include "imagetag.semver" (list .Values.windows.image.tag))) .Values.rotationPollInterval }} - "--rotation-poll-interval={{ .Values.rotationPollInterval }}" {{- end }} - "--metrics-addr={{ .Values.windows.metricsAddr }}" - {{- if and (semverCompare ">= v0.0.22-0" .Values.windows.image.tag) .Values.providerHealthCheck }} + {{- if and (semverCompare ">= v0.0.22-0" (include "imagetag.semver" (list .Values.windows.image.tag))) .Values.providerHealthCheck }} - "--provider-health-check={{ .Values.providerHealthCheck }}" {{- end }} - {{- if and (semverCompare ">= v0.0.22-0" .Values.windows.image.tag) .Values.providerHealthCheckInterval }} + {{- if and (semverCompare ">= v0.0.22-0" (include "imagetag.semver" (list .Values.windows.image.tag))) .Values.providerHealthCheckInterval }} - "--provider-health-check-interval={{ .Values.providerHealthCheckInterval }}" {{- end }} {{- if .Values.maxCallRecvMsgSize }} @@ -102,7 +102,7 @@ spec: apiVersion: v1 fieldPath: spec.nodeName imagePullPolicy: {{ .Values.windows.image.pullPolicy }} - {{- if semverCompare ">= v0.0.9-0" .Values.windows.image.tag }} + {{- if semverCompare ">= v0.0.9-0" (include "imagetag.semver" (list .Values.windows.image.tag)) }} ports: - containerPort: {{ .Values.livenessProbe.port }} name: healthz @@ -140,7 +140,7 @@ spec: resources: {{ toYaml . | indent 12 }} {{- end }} - {{- if semverCompare ">= v0.0.9-0" .Values.windows.image.tag }} + {{- if semverCompare ">= v0.0.9-0" (include "imagetag.semver" (list .Values.windows.image.tag)) }} - name: liveness-probe {{- if .Values.windows.livenessProbeImage.digest }} image: "{{ .Values.windows.livenessProbeImage.repository }}@{{ .Values.windows.livenessProbeImage.digest }}" diff --git a/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver.yaml b/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver.yaml index 4f008569f..04fdbde05 100644 --- a/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver.yaml +++ b/manifest_staging/charts/secrets-store-csi-driver/templates/secrets-store-csi-driver.yaml @@ -74,17 +74,17 @@ spec: - "--nodeid=$(KUBE_NODE_NAME)" - "--provider-volume={{ .Values.linux.providersDir }}" - "--additional-provider-volume-paths={{ join "," .Values.linux.additionalProvidersDirs }}" - {{- if and (semverCompare ">= v0.0.15-0" .Values.linux.image.tag) .Values.enableSecretRotation }} + {{- if and (semverCompare ">= v0.0.15-0" (include "imagetag.semver" (list .Values.linux.image.tag))) .Values.enableSecretRotation }} - "--enable-secret-rotation={{ .Values.enableSecretRotation }}" {{- end }} - {{- if and (semverCompare ">= v0.0.15-0" .Values.linux.image.tag) .Values.rotationPollInterval }} + {{- if and (semverCompare ">= v0.0.15-0" (include "imagetag.semver" (list .Values.linux.image.tag))) .Values.rotationPollInterval }} - "--rotation-poll-interval={{ .Values.rotationPollInterval }}" {{- end }} - "--metrics-addr={{ .Values.linux.metricsAddr }}" - {{- if and (semverCompare ">= v0.0.22-0" .Values.linux.image.tag) .Values.providerHealthCheck }} + {{- if and (semverCompare ">= v0.0.22-0" (include "imagetag.semver" (list .Values.linux.image.tag))) .Values.providerHealthCheck }} - "--provider-health-check={{ .Values.providerHealthCheck }}" {{- end }} - {{- if and (semverCompare ">= v0.0.22-0" .Values.linux.image.tag) .Values.providerHealthCheckInterval }} + {{- if and (semverCompare ">= v0.0.22-0" (include "imagetag.semver" (list .Values.linux.image.tag))) .Values.providerHealthCheckInterval }} - "--provider-health-check-interval={{ .Values.providerHealthCheckInterval }}" {{- end }} {{- if .Values.maxCallRecvMsgSize }} @@ -104,7 +104,7 @@ spec: imagePullPolicy: {{ .Values.linux.image.pullPolicy }} securityContext: privileged: true - {{- if semverCompare ">= v0.0.8-0" .Values.linux.image.tag }} + {{- if semverCompare ">= v0.0.8-0" (include "imagetag.semver" (list .Values.linux.image.tag)) }} ports: - containerPort: {{ .Values.livenessProbe.port }} name: healthz @@ -143,7 +143,7 @@ spec: resources: {{ toYaml . | indent 12 }} {{- end }} - {{- if semverCompare ">= v0.0.8-0" .Values.linux.image.tag }} + {{- if semverCompare ">= v0.0.8-0" (include "imagetag.semver" (list .Values.linux.image.tag)) }} - name: liveness-probe {{- if .Values.linux.livenessProbeImage.digest }} image: "{{ .Values.linux.livenessProbeImage.repository }}@{{ .Values.linux.livenessProbeImage.digest }}"