Skip to content

Commit

Permalink
Change cert-names each deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
mbjtrifork committed Aug 10, 2023
1 parent bf482d3 commit 51fa6d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 5 additions & 1 deletion charts/flink-job/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

Expand All @@ -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 -}}
13 changes: 6 additions & 7 deletions charts/flink-job/templates/cert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

0 comments on commit 51fa6d3

Please sign in to comment.