From f2811753072c177b3e2fe76939e30fccb177b3e7 Mon Sep 17 00:00:00 2001 From: Boemeltrein <130394941+Boemeltrein@users.noreply.github.com> Date: Sat, 26 Jul 2025 14:37:22 +0200 Subject: [PATCH] fix(common): nginx authentik integration (#37739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Based upon https://discord.com/channels/830763548678291466/1396239425230340136 When using the NGINX Authentik integration you will get a `502 Bad Gateway`. According the docs from authentik those for annotations are needed: image The common add these as well: ``` nginx.ingress.kubernetes.io/backend-protocol: HTTPS nginx.ingress.kubernetes.io/force-ssl-redirect: 'true' ``` Those are not needed. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code - [ ] 📜 Documentation Changes **🧪 How Has This Been Tested?** 1. https://github.com/Boemeltrein/TalosCluster/blob/main/clusters/main/kubernetes/apps/librespeed/app/helm-release.yaml 2. Tested first with setting annotations myself. That works 3. Using the authentik integration, it won't work. 4. Remove the added annotation with openlens in the ingress, make it works instantly. **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made changes to the documentation - [x] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):`, `chore(chart-name):`, `docs(chart-name):` or `fix(docs):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Alfred Göppel <43101280+alfi0812@users.noreply.github.com> Co-authored-by: Alfred Göppel <43101280+alfi0812@users.noreply.github.com> --- charts/library/common-test/Chart.yaml | 1 - charts/library/common-test/tests/ingress/nginx_test.yaml | 2 -- charts/library/common/Chart.yaml | 2 +- .../common/templates/lib/ingress/integrations/nginx/_auth.tpl | 2 -- 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/charts/library/common-test/Chart.yaml b/charts/library/common-test/Chart.yaml index dc852063acd..0c72d74cb6a 100644 --- a/charts/library/common-test/Chart.yaml +++ b/charts/library/common-test/Chart.yaml @@ -35,4 +35,3 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/library/common-test type: application version: 1.0.0 - diff --git a/charts/library/common-test/tests/ingress/nginx_test.yaml b/charts/library/common-test/tests/ingress/nginx_test.yaml index fffa0486e18..f8aa9ecb5b1 100644 --- a/charts/library/common-test/tests/ingress/nginx_test.yaml +++ b/charts/library/common-test/tests/ingress/nginx_test.yaml @@ -112,8 +112,6 @@ tests: nginx.ingress.kubernetes.io/auth-signin: https://external.host/outpost.goauthentik.io/start?rd=$scheme://$http_host$escaped_request_uri nginx.ingress.kubernetes.io/auth-snippet: proxy_set_header X-Forwarded-Host $http_host; nginx.ingress.kubernetes.io/auth-url: http://internal.host/outpost.goauthentik.io/auth/nginx - nginx.ingress.kubernetes.io/backend-protocol: HTTPS - nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - it: should pass with ingress created with authelia annotations from nginx set: diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index f0949b92abd..9d88196cc09 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -48,5 +48,5 @@ sources: - https://hub.docker.com/_/ - https://hub.docker.com/r/mikefarah/yq type: library -version: 28.13.0 +version: 28.13.1 diff --git a/charts/library/common/templates/lib/ingress/integrations/nginx/_auth.tpl b/charts/library/common/templates/lib/ingress/integrations/nginx/_auth.tpl index 207895d3d65..52562b91b23 100644 --- a/charts/library/common/templates/lib/ingress/integrations/nginx/_auth.tpl +++ b/charts/library/common/templates/lib/ingress/integrations/nginx/_auth.tpl @@ -23,8 +23,6 @@ {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/auth-method" "GET" -}} {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/auth-response-headers" (join "," $respHeaders) -}} {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/auth-snippet" "proxy_set_header X-Forwarded-Host $http_host;" -}} - {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/backend-protocol" "HTTPS" -}} - {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/force-ssl-redirect" "true" -}} {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/auth-url" (printf "http://%s/outpost.goauthentik.io/auth/nginx" $auth.internalHost) -}} {{- $_ := set $objectData.annotations "nginx.ingress.kubernetes.io/auth-signin" (printf "https://%s/outpost.goauthentik.io/start?rd=$scheme://$http_host$escaped_request_uri" $auth.externalHost) -}} {{- end -}}