diff --git a/test/minio/1.2.0/templates/_helpers.tpl b/test/minio/1.2.0/templates/_helpers.tpl index c769c2fb2a..1aeab6171a 100644 --- a/test/minio/1.2.0/templates/_helpers.tpl +++ b/test/minio/1.2.0/templates/_helpers.tpl @@ -4,3 +4,33 @@ Determine secret name. {{- define "minio.secretName" -}} {{- include "common.names.fullname" . -}} {{- end -}} + + +{{/* +Retrieve true/false if minio certificate is configured +*/}} +{{- define "minio.certAvailable" -}} +{{- $values := (. | mustDeepCopy) -}} +{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate) -}} +{{- template "common.resources.cert_present" $values -}} +{{- end -}} + + +{{/* +Retrieve public key of minio certificate +*/}} +{{- define "minio.cert.publicKey" -}} +{{- $values := (. | mustDeepCopy) -}} +{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate "publicKey" true) -}} +{{ include "common.resources.cert" $values }} +{{- end -}} + + +{{/* +Retrieve private key of minio certificate +*/}} +{{- define "minio.cert.privateKey" -}} +{{- $values := (. | mustDeepCopy) -}} +{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate) -}} +{{ include "common.resources.cert" $values }} +{{- end -}} diff --git a/test/minio/1.2.0/templates/secrets.yaml b/test/minio/1.2.0/templates/secrets.yaml index f44495e5e1..26c1d2c896 100644 --- a/test/minio/1.2.0/templates/secrets.yaml +++ b/test/minio/1.2.0/templates/secrets.yaml @@ -7,3 +7,7 @@ type: Opaque data: accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }} secretkey: {{ if .Values.secretKey }}{{ .Values.secretKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 40 | b64enc | quote }}{{ end }} + {{- if eq (include "minio.certAvailable" .) true -}} + certPublicKey: {{ template "minio.cert.publicKey" . }} + certPrivateKey: {{ template "minio.cert.privateKey" . }} + {{- end -}}