From 4f22a28ce3bd85f52c8eee6a791d47e447063920 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Fri, 23 Feb 2024 17:03:14 +0100 Subject: [PATCH] add ingress annotations --- src/main/helm/templates/ingress.yaml | 10 ++++++++-- src/test/helm/ingress_nginx_cors_test.yaml | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/helm/templates/ingress.yaml b/src/main/helm/templates/ingress.yaml index 4b8a3497..c9e606ed 100644 --- a/src/main/helm/templates/ingress.yaml +++ b/src/main/helm/templates/ingress.yaml @@ -25,10 +25,16 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - {{- with .Values.ingress.configuration_snippet}} - annotations: {{- toYaml . | nindent 4 }} + annotations: + {{- if .Values.ingress.configuration_snippet }} + {{- with .Values.ingress.configuration_snippet }} + {{- toYaml . | nindent 4 }} {{- end }} more_set_headers "Access-Control-Allow-Origin: {{ (include "app.alfaAddress" .) }}"; + {{- end }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- if (.Values.ingress).certManagerAnnotations -}} {{- range (.Values.ingress).certManagerAnnotations }} {{ . | indent 4 }} diff --git a/src/test/helm/ingress_nginx_cors_test.yaml b/src/test/helm/ingress_nginx_cors_test.yaml index f415a7e2..831fe9f0 100644 --- a/src/test/helm/ingress_nginx_cors_test.yaml +++ b/src/test/helm/ingress_nginx_cors_test.yaml @@ -44,3 +44,23 @@ tests: more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-XSRF-TOKEN"; more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range"; more_set_headers "Access-Control-Allow-Origin: https://helm.test.sh.ozg-cloud.de"; + - it: Should disable nginx configuration snippet + set: + ingress: + configuration_snippet: null + asserts: + - notExists: + path: metadata.annotations["nginx.ingress.kubernetes.io/configuration-snippet"] + - it: Should contain annotations + set: + ingress: + annotations: + foo: bar + hello: world + asserts: + - equal: + path: metadata.annotations.foo + value: bar + - equal: + path: metadata.annotations.hello + value: world \ No newline at end of file -- GitLab