From caeec52dcfe68757b5588fd550850684eb196dc7 Mon Sep 17 00:00:00 2001 From: OZG-Cloud Team <noreply@ozg-sh.de> Date: Tue, 27 Feb 2024 13:22:03 +0100 Subject: [PATCH] improve ingress annotations and remove cluster_env --- src/main/helm/templates/ingress.yaml | 16 +++++++++------- src/main/helm/values.yaml | 2 -- src/test/helm/ingress-nginx-tests.yaml | 20 +++----------------- src/test/helm/ingress_test.yaml | 14 +++++++++++++- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main/helm/templates/ingress.yaml b/src/main/helm/templates/ingress.yaml index fe85cf3e..c03c8399 100644 --- a/src/main/helm/templates/ingress.yaml +++ b/src/main/helm/templates/ingress.yaml @@ -27,20 +27,20 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: - {{- if (.Values.ingress).certManagerAnnotations -}} - {{- range (.Values.ingress).certManagerAnnotations }} -{{ . | indent 4 }} + {{- with (.Values.ingress).annotations }} +{{ toYaml . | indent 4 }} {{- end }} - {{- else if (.Values.ingress).use_staging_cert }} + {{- if not (.Values.ingress).disableDefaultCertManager }} + {{- if (.Values.ingress).use_staging_cert }} cert-manager.io/cluster-issuer: letsencrypt-staging {{- else }} cert-manager.io/cluster-issuer: letsencrypt-prod {{- end }} - nginx.ingress.kubernetes.io/proxy-body-size: 42m + {{- end }} name: {{ include "app.name" . }} namespace: {{ include "app.namespace" . }} spec: - {{- if and (.Values.ingress).className (ne (.Values).cluster_env "dataport") }} + {{- if and (.Values.ingress).className }} ingressClassName: {{ .Values.ingress.className }} {{- end }} rules: @@ -57,9 +57,11 @@ spec: tls: - hosts: - {{ include "app.ingress.host" . }} + {{- if not (.Values.ingress).skipTlsSecret -}} {{- if (.Values.ingress).tlsSecretName }} secretName: {{ (.Values.ingress).tlsSecretName }} - {{- else if ne (.Values).cluster_env "dataport" }} + {{- else }} secretName: {{ .Values.ozgcloud.bezeichner }}-{{ include "app.name" . }}-tls {{- end }} + {{- end }} {{- end -}} \ No newline at end of file diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index 240501d3..11fdeb4a 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -22,8 +22,6 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -cluster_env: "" - baseUrl: test.sh.ozg-cloud.de image: diff --git a/src/test/helm/ingress-nginx-tests.yaml b/src/test/helm/ingress-nginx-tests.yaml index ea2c4874..4659dbbd 100644 --- a/src/test/helm/ingress-nginx-tests.yaml +++ b/src/test/helm/ingress-nginx-tests.yaml @@ -43,27 +43,13 @@ tests: path: spec.tls[0].secretName value: helm-fs-adapter-tls - - it: should not create afm ingress tls/ingressClass - release: - name: afm-adapter - set: - cluster_env: dataport - asserts: - - isNull: - path: spec.ingressClassName - - isNull: - path: spec.tls[0].secretName - - it: should not create afm ingress tls/ingressClass - release: - name: fs-adapter + - it: should not set secretName set: - image.name: formsolutions-adapter - cluster_env: dataport + ingress.skipTlsSecret: true asserts: - - isNull: - path: spec.ingressClassName - isNull: path: spec.tls[0].secretName + - it: should not set ingressClassName asserts: - isNull: diff --git a/src/test/helm/ingress_test.yaml b/src/test/helm/ingress_test.yaml index e5086079..493d124a 100644 --- a/src/test/helm/ingress_test.yaml +++ b/src/test/helm/ingress_test.yaml @@ -125,7 +125,19 @@ tests: - equal: path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-prod - - it: should set proxy body size to 42m + + - it: should disable default cert-manager + set: + ingress.disableDefaultCertManager: true + asserts: + - notExists: + path: metadata.annotations["cert-manager.io/cluster-issuer"] + + - it: should set ingress annotation proxy body size to 42m + set: + ingress: + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: 42m asserts: - equal: path: metadata.annotations["nginx.ingress.kubernetes.io/proxy-body-size"] -- GitLab