From 41e5d6258f2ae298cfd3a8cad2605a7446c79e61 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 9 Feb 2025 21:04:03 +0200 Subject: [PATCH] feat(traefik-integration): actually default to false (#31868) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [x] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 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 - [x] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [x] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ 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):` or `chore(chart-name):` **➕ 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._ --- .../library/common-test/tests/ingress/traefik_test.yaml | 1 + .../library/common-test/tests/traefik/enabled_test.yaml | 5 +++++ charts/library/common/templates/class/_ingress.tpl | 6 ++++-- .../templates/lib/ingress/integrations/_traefik.tpl | 9 ++++----- .../common/templates/spawner/traefik/_middleware.tpl | 2 +- cspell.config.yaml | 1 + website/src/content/docs/common/ingress/traefik.md | 4 ++-- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/charts/library/common-test/tests/ingress/traefik_test.yaml b/charts/library/common-test/tests/ingress/traefik_test.yaml index 9967e416baa..4d32a0d2759 100644 --- a/charts/library/common-test/tests/ingress/traefik_test.yaml +++ b/charts/library/common-test/tests/ingress/traefik_test.yaml @@ -34,6 +34,7 @@ tests: - path: /test-path integrations: traefik: + enabled: true middlewares: - name: my-compress - name: some-existing-middleware-on-this-namespace diff --git a/charts/library/common-test/tests/traefik/enabled_test.yaml b/charts/library/common-test/tests/traefik/enabled_test.yaml index 3a84d35e8e5..d8b39f10e35 100644 --- a/charts/library/common-test/tests/traefik/enabled_test.yaml +++ b/charts/library/common-test/tests/traefik/enabled_test.yaml @@ -38,6 +38,9 @@ tests: primary: true hosts: - host: chart-example.local + integrations: + traefik: + enabled: true asserts: - hasDocuments: count: 3 @@ -100,6 +103,7 @@ tests: primary: true integrations: traefik: + enabled: true chartMiddlewares: - name: some-chart-middleware hosts: @@ -146,6 +150,7 @@ tests: primary: true integrations: traefik: + enabled: true middlewares: - name: some-user-middleware hosts: diff --git a/charts/library/common/templates/class/_ingress.tpl b/charts/library/common/templates/class/_ingress.tpl index 2125528b26e..1b5969395f2 100644 --- a/charts/library/common/templates/class/_ingress.tpl +++ b/charts/library/common/templates/class/_ingress.tpl @@ -39,8 +39,10 @@ objectData: The object data to be used to render the Ingress. {{- end -}} {{- end -}} - {{/* When Stop All is set, force ingressClass "stopped" - to yeet ingress from the ingresscontroller */}} + {{/* + When Stop All is set, force ingressClass "stopped" + to yeet ingress from the ingressController + */}} {{- if (include "tc.v1.common.lib.util.stopAll" $rootCtx) -}} {{- $ingressClassName = "tc-stopped" -}} {{- end -}} diff --git a/charts/library/common/templates/lib/ingress/integrations/_traefik.tpl b/charts/library/common/templates/lib/ingress/integrations/_traefik.tpl index e71b4e42dd2..41ecb6fc564 100644 --- a/charts/library/common/templates/lib/ingress/integrations/_traefik.tpl +++ b/charts/library/common/templates/lib/ingress/integrations/_traefik.tpl @@ -9,13 +9,12 @@ {{- end -}} {{- $traefik := $objectData.integrations.traefik -}} - - {{- $enabled := true -}} - {{- if and $traefik (hasKey $traefik "enabled") (kindIs "bool" $traefik.enabled) -}} - {{- $enabled = $traefik.enabled -}} + {{- $enabled := "false" -}} + {{- if and (hasKey $traefik "enabled") (kindIs "bool" $traefik.enabled) -}} + {{- $enabled = $traefik.enabled | toString -}} {{- end -}} - {{- if $enabled -}} + {{- if eq $enabled "true" -}} {{- include "tc.v1.common.lib.ingress.integration.traefik.validate" (dict "objectData" $objectData) -}} {{- $namespace := include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Traefik Integration") -}} diff --git a/charts/library/common/templates/spawner/traefik/_middleware.tpl b/charts/library/common/templates/spawner/traefik/_middleware.tpl index af8669c30f5..e45a926817a 100644 --- a/charts/library/common/templates/spawner/traefik/_middleware.tpl +++ b/charts/library/common/templates/spawner/traefik/_middleware.tpl @@ -30,7 +30,7 @@ {{- $_ := set $ing.integrations "traefik" dict -}} {{- end -}} {{- $traefik := $ing.integrations.traefik -}} - {{- $enabledTraefikIntegration := "true" -}} + {{- $enabledTraefikIntegration := "false" -}} {{- if and (hasKey $traefik "enabled") (kindIs "bool" $traefik.enabled) -}} {{- $enabledTraefikIntegration = $traefik.enabled | toString -}} {{- end -}} diff --git a/cspell.config.yaml b/cspell.config.yaml index 49a3896e3ad..16460cecbbb 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -388,6 +388,7 @@ words: - whisparr - xstar - xsystems + - yeet - zabbix - zerotier - zwavejs diff --git a/website/src/content/docs/common/ingress/traefik.md b/website/src/content/docs/common/ingress/traefik.md index 37772262291..b11fbd0b9aa 100644 --- a/website/src/content/docs/common/ingress/traefik.md +++ b/website/src/content/docs/common/ingress/traefik.md @@ -29,9 +29,9 @@ Enables or Disables the traefik integration | ---------- | -------------------------------------------- | | Key | `ingress.$name.integrations.traefik.enabled` | | Type | `bool` | -| Required | ✅ | +| Required | ❌ | | Helm `tpl` | ❌ | -| Default | `true` | +| Default | `false` | Example