feat(common): BREAKING CHANGE change traefik middleware logic (#31498)

**Description**
This PR changes how ingress handles traefik integration middlewares


Should finally complete: #28999

Fixes: #28999

Also Fixes: #28996 
Due to removing fixed middlewares completely

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [x] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 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
- [ ] 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._

---------

Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <s.kois@outlook.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Kjeld Schouten
2025-02-01 23:33:59 +01:00
committed by GitHub
co-authored by Stavros Kois Stavros Kois
parent a759873bf5
commit 5ef1dd6055
6 changed files with 111 additions and 481 deletions
@@ -29,8 +29,8 @@ Enables or Disables the traefik integration
| ---------- | -------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.enabled` |
| Type | `bool` |
| Required | ✅ |
| Helm `tpl` | ❌ |
| Required | ✅ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
@@ -53,36 +53,12 @@ Define the entrypoints for this traefik integration
| ---------- | ------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.entrypoints` |
| Type | `list` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `["websecure"]` |
---
## `enableFixedMiddlewares`
Enable or disable the [fixedMiddlewares](/common/global#traefikfixedmiddlewares)
| | |
| ---------- | ------------------------------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.enableFixedMiddlewares` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
enableFixedMiddlewares: true
```
---
## `forceTLS`
Force TLS on this ingress
@@ -99,8 +75,8 @@ It does that both with this set OR when [entrypoints](/common/ingress/traefik#en
| ---------- | --------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.forceTLS` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
@@ -115,134 +91,16 @@ ingress:
---
## `allowCors`
Allow CORS on this ingress
:::note
Relaxes some security settings to allow CORS requests.
Specifically, it uses [these middlewares](/common/global#traefikallowcorsmiddlewares)
instead of the [fixedMiddlewares](/common/global#traefikfixedmiddlewares)
:::
| | |
| ---------- | ---------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.allowCors` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `false` |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
allowCors: true
```
---
## `fixedMiddlewares`
Override the fixed middlewares for this traefik integration
| | |
| ---------- | ------------------------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.fixedMiddlewares` |
| Type | `list` of `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | See default [here](/common/global#traefikfixedmiddlewares) |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
fixedMiddlewares:
- name: chain-basic
namespace: ""
```
---
### `fixedMiddlewares[].name`
The name of the middleware
| | |
| ---------- | ------------------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.fixedMiddlewares[].name` |
| Type | `string` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `""` |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
fixedMiddlewares:
- name: chain-basic
namespace: ""
```
---
### `fixedMiddlewares[].namespace`
The namespace of the middleware
:::tip
If not defined, helm will do a lookup and try to find the namespace of the middleware.
If more than one namespaces are found, it will throw an error.
:::
| | |
| ---------- | ----------------------------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.fixedMiddlewares[].namespace` |
| Type | `string` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `""` |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
fixedMiddlewares:
- name: chain-basic
namespace: ""
```
---
## `middlewares`
Override the middlewares for this traefik integration
The middlewares for this traefik integration
| | |
| ---------- | ------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.middlewares` |
| Type | `list` of `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `[]` |
Example
@@ -267,8 +125,8 @@ The name of the middleware
| ---------- | ------------------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.middlewares[].name` |
| Type | `string` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `""` |
Example
@@ -291,8 +149,7 @@ The namespace of the middleware
:::tip
If not defined, helm will do a lookup and try to find the namespace of the middleware.
If more than one namespaces are found, it will throw an error.
If not defined, the current namespace will be used.
:::
@@ -300,8 +157,8 @@ If more than one namespaces are found, it will throw an error.
| ---------- | ------------------------------------------------------------ |
| Key | `ingress.$name.integrations.traefik.middlewares[].namespace` |
| Type | `string` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `""` |
Example
@@ -318,6 +175,32 @@ ingress:
---
### `middlewares[].expandObjectName`
Whether to expand the middleware name
| | |
| ---------- | ------------------------------------------------------------------- |
| Key | `ingress.$name.integrations.traefik.middlewares[].expandObjectName` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
```yaml
ingress:
ingress-name:
integrations:
traefik:
middlewares:
- name: my-middleware
expandObjectName: false
```
---
## Full Examples
```yaml
@@ -328,13 +211,9 @@ ingress:
enabled: true
entrypoints:
- websecure
enableFixedMiddlewares: true
forceTLS: true
allowCors: false
fixedMiddlewares:
- name: chain-basic
namespace: ""
middlewares:
- name: my-middleware
namespace: ""
expandObjectName: false
```