mirror of
https://github.com/truenas/charts.git
synced 2026-11-27 06:23:07 +08:00
Add library function to retrieve certificates
This commit is contained in:
25
library/common/2101.0.0/templates/lib/resources/_certs.tpl
Normal file
25
library/common/2101.0.0/templates/lib/resources/_certs.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{{/*
|
||||
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 -}}
|
||||
Reference in New Issue
Block a user