update certs and add todo note

This commit is contained in:
Stavros kois
2022-12-12 19:46:32 +02:00
parent 34db500037
commit 0a08a94bb1
3 changed files with 15 additions and 11 deletions
@@ -2,9 +2,9 @@
{{- $cert := .cert -}}
{{- $root := .root -}}
{{- if not (hasKey $cert "id") -}}
{{- if not (hasKey $cert "id") -}} {{/* This is something that should not happen when using this library */}}
{{- fail (printf "Certificate (%s) has no <id> key" $cert.nameOverride) -}}
{{- end -}}
{{- end -}} {{/* It can only happen when consuing this function within this library */}}
{{- $certID := (toString $cert.id) -}}
{{- if (include "ix.v1.common.certificate.exists" (dict "root" $root "certID" $certID)) -}}
@@ -30,9 +30,9 @@ Example keys (certificate, privatekey, expired, revoked)
{{- $useRevoked := $root.Values.global.defaults.useRevokedCerts -}}
{{- $useExpired := $root.Values.global.defaults.useExpiredCerts -}}
{{- if not $key -}}
{{- if not $key -}} {{/* This is something that should not happen when using this library */}}
{{- fail "You need to provide a <key> when calling this template (certificate.get)" -}}
{{- end -}}
{{- end -}} {{/* It can only happen when consuing this function within this library */}}
{{- if eq (include "ix.v1.common.certificate.exists" (dict "root" $root "certID" $certID)) "true" -}}
{{- $certificate := (get $root.Values.ixCertificates (toString $certID)) -}}
@@ -46,22 +46,26 @@ Example keys (certificate, privatekey, expired, revoked)
{{- end -}}
{{- if (hasKey $certificate "revoked") -}}
{{- if and (not $useRevoked) (eq (get $certificate "revoked") true) -}}
{{- fail (printf "Certificate (%s) has been revoked" $certID) -}}
{{- if (eq (get $certificate "revoked") true) -}}
{{- if not $useRevoked -}}
{{- fail (printf "Certificate (%s) has been revoked" $certID) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if (hasKey $certificate "expired") -}}
{{- if and (not $useExpired) (eq (get $certificate "expired") true) -}}
{{- fail (printf "Certificate (%s) is expired" $certID) -}}
{{- if (eq (get $certificate "expired") true) -}}
{{- if not $useExpired -}}
{{- fail (printf "Certificate (%s) is expired" $certID) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if (hasKey $certificate $key) -}}
{{- get $certificate $key -}}
{{- else -}}
{{- else -}} {{/* This is something that should not happen when using this library */}}
{{- fail (printf "Key (%s) does not exist in certificate (%s)" $key $certID) -}}
{{- end -}}
{{- end -}} {{/* It can only happen when consuing this function within this library */}}
{{- else -}}
{{- fail (printf "Certificate (%s) was not found." $certID) -}}
@@ -14,7 +14,7 @@ That's why the custom dict is expected.
{{- include "ix.v1.common.container.fixedEnvs" $root | trim -}}
{{- end -}} {{/* Finish fixedEnv */}}
{{- with $envs -}}
{{- range $k, $v := . -}}
{{- range $k, $v := . -}} {{/* TODO: Check if there is a user provided env that exist in fixedEnv and error out */}}
{{- $name := $k -}}
{{- $value := $v -}}
{{- if kindIs "int" $name -}}