{{/* Get Certificate Data */}} {{/* Call this template: {{ include "tc.v1.common.lib.scaleCertificate.getData" (dict "rootCtx" $rootCtx "objectData" $objectData) -}} rootCtx: The root context of the chart. objectData: The object data of the certificate */}} {{- define "tc.v1.common.lib.scaleCertificate.getData" -}} {{- $objectData := .objectData -}} {{- $rootCtx := .rootCtx -}} {{- $certID := (toString $objectData.id) -}} {{/* Make sure certificate exists */}} {{- if hasKey $rootCtx.Values "ixCertificates" -}} {{- if not $rootCtx.Values.ixCertificates -}} {{- fail "Certificate - Expected non-empty " -}} {{- end -}} {{- if not (hasKey $rootCtx.Values.ixCertificates $certID) -}} {{- fail (printf "Certificate - Expected certificate with [%q] to exist in " $certID) -}} {{- end -}} {{- end -}} {{- $data := get $rootCtx.Values.ixCertificates $certID -}} {{- range $flag := (list "revoked" "expired") -}} {{- if (get $data $flag) -}} {{- fail (printf "Certificate - Expected non-%s certificate with [%q]" $flag $certID) -}} {{- end -}} {{- end -}} {{- range $key := (list "certificate" "privatekey") -}} {{- if not (get $data $key) -}} {{- fail (printf "Certificate - Expected non-empty [%s] in certificate with [%q] in " $key $certID) -}} {{- end -}} {{- end -}} {{- $data | toJson -}} {{- end -}}