Commit eaad608b authored by Waqar Ahmed's avatar Waqar Ahmed

Add library function to retrieve certificates

parent 17078844
{{/*
Retrieve true/false if certificate is available in ixCertificates
*/}}
{{- define "common.resources.cert_present" -}}
{{- $values := . -}}
{{- include "common.schema.validateKeys" (dict "values" . "checkKeys" (list "commonCertOptions")) -}}
{{- hasKey $values.ixCertificates $values.commonCertOptions.certKeyName -}}
{{- end -}}
{{/*
Retrieve certificate from variable name
*/}}
{{- define "common.resources.cert" -}}
{{- $values := . -}}
{{- include "common.schema.validateKeys" (dict "values" . "checkKeys" (list "commonCertOptions")) -}}
{{- if hasKey $values.ixCertificates $values.commonCertOptions.certKeyName -}}
{{- $cert := get $values.ixCertificates $values.commonCertOptions.certKeyName -}}
{{- if $values.commonCertOptions.publicKey -}}
{{ $cert.certificate }}
{{- else -}}
{{ $cert.privatekey }}
{{- end -}}
{{- end -}}
{{- end -}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment