diff --git a/charts/flink-job/templates/_helpers.tpl b/charts/flink-job/templates/_helpers.tpl index 3019f409..9024a868 100644 --- a/charts/flink-job/templates/_helpers.tpl +++ b/charts/flink-job/templates/_helpers.tpl @@ -278,7 +278,7 @@ Set a key=value in a dictionary, if the key is not defined {{- define "flink-job.sslVolumes" -}} {{- if $.Values.internalSsl.enabled -}} - {{ (dict "name" "truststore" "secret" (dict "secretName" (print (include "flink-job.fullname" . ) "-mtls-secret"))) | toYaml }} + {{ (dict "name" "truststore" "secret" (dict "secretName" (print (include "flink-job.nameWithimageHash" . ) "-mtls-secret"))) | toYaml }} {{- end -}} {{- end -}} @@ -287,3 +287,7 @@ Set a key=value in a dictionary, if the key is not defined {{ (dict "name" "truststore" "mountPath" "/flinkkeystore" "readOnly" true) | toYaml}} {{- end -}} {{- end -}} + +{{- define "flink-job.nameWithimageHash" -}} + {{ include "flink-job.fullname" . }}{{ (sha256sum (nospace (toString .Values.image))) | trunc 10 }} +{{- end -}} \ No newline at end of file diff --git a/charts/flink-job/templates/cert.yaml b/charts/flink-job/templates/cert.yaml index a2d02313..b506e5b6 100644 --- a/charts/flink-job/templates/cert.yaml +++ b/charts/flink-job/templates/cert.yaml @@ -2,24 +2,23 @@ apiVersion: cert-manager.io/v1 kind: Issuer metadata: - name: {{ printf "%s-mtls-issuer" ( include "flink-job.fullname" . ) | quote }} + name: {{ printf "%s-mtls-issuer" ( include "flink-job.nameWithimageHash" . ) | quote }} spec: selfSigned: {} --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: - name: {{ printf "%s-mtls-crt" ( include "flink-job.fullname" . ) | quote }} - imageHash: {{ sha256sum (nospace (toString .Values.image)) }} + name: {{ printf "%s-mtls-crt" ( include "flink-job.nameWithimageHash" . ) | quote }} spec: - secretName: {{ printf "%s-mtls-secret" ( include "flink-job.fullname" . ) | quote }} - commonName: {{ printf "%s-mtls-crt" ( include "flink-job.fullname" . ) | quote }} + secretName: {{ printf "%s-mtls-secret" ( include "flink-job.nameWithimageHash" . ) | quote }} + commonName: {{ printf "%s-mtls-crt" ( include "flink-job.nameWithimageHash" . ) | quote }} issuerRef: - name: {{ printf "%s-mtls-issuer" ( include "flink-job.fullname" . ) | quote }} + name: {{ printf "%s-mtls-issuer" ( include "flink-job.nameWithimageHash" . ) | quote }} keystores: jks: create: true passwordSecretRef: # Password used to encrypt the keystore key: password - name: {{ printf "%s-mtls-password" ( include "flink-job.fullname" . ) | quote }} + name: {{ printf "%s-mtls-password" ( include "flink-job.nameWithimageHash" . ) | quote }} {{- end -}} \ No newline at end of file