init certManager

This commit is contained in:
Stavros kois
2023-12-06 22:49:02 +02:00
parent 796ed60b62
commit dc0d5e328f
5 changed files with 41 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ tests:
global:
traefik:
addIngressAnnotations: false
certManager:
addIngressAnnotations: false
ingress:
my-ingress1:
enabled: true

View File

@@ -16,6 +16,8 @@ tests:
global:
traefik:
addIngressAnnotations: false
certManager:
addIngressAnnotations: false
labels:
g_label1: global_label1
g_label2: "{{ .Values.label2 }}"

View File

@@ -20,7 +20,7 @@ objectData: The object data to be used to render the Ingress.
{{- $_ := set $objectData "annotations" dict -}}
{{- end -}}
{{- /* include "tc.v1.common.lib.ingress.integration.certManager" (dict "rootCtx" $rootCtx "objectData" $objectData) */ -}}
{{- include "tc.v1.common.lib.ingress.integration.certManager" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.ingress.integration.traefik" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.ingress.integration.homepage" (dict "rootCtx" $rootCtx "objectData" $objectData) -}}
{{/* TODO: fix last - */}}

View File

@@ -0,0 +1,33 @@
{{- define "tc.v1.common.lib.ingress.integration.certManager" -}}
{{- $objectData := .objectData -}}
{{- $rootCtx := .rootCtx -}}
{{- $certManager := $objectData.integrations.certManager -}}
{{- $enabled := false -}}
{{- if (hasKey $rootCtx.Values.global "certManager") -}}
{{- $enabled = $rootCtx.Values.global.certManager.addIngressAnnotations -}}
{{- end -}}
{{- if and $certManager (kindIs "bool" $certManager.enabled) -}}
{{- $enabled = $certManager.enabled -}}
{{- end -}}
{{- if $enabled -}}
{{- include "tc.v1.common.lib.ingress.integration.certManager.validate" (dict "objectData" $objectData) -}}
{{- $_ := set $objectData.annotations "cert-manager.io/cluster-issuer" "TODO:" -}}
{{- $_ := set $objectData.annotations "cert-manager.io/private-key-rotation-policy" "Always" -}}
{{- end -}}
{{- end -}}
{{- define "tc.v1.common.lib.ingress.integration.certManager.validate" -}}
{{- $objectData := .objectData -}}
{{- $certManager := $objectData.integrations.certManager -}}
{{- if $certManager -}}
{{- end -}}
{{- end -}}

View File

@@ -10,6 +10,9 @@ global:
metallb:
# -- Adds metalLB annotations to services
addServiceAnnotations: true
certManager:
# -- Adds cert-manager annotations to ingresses
addIngressAnnotations: true
traefik:
# -- Adds traefik annotations to services (when needed)
addServiceAnnotations: true