feat(common): enable middlewares when referenced on ingress and add chart+common middlewares (#31535)
**Description** Currently users have to enable the ingressMiddleware AND reference said middleware under their ingress. This adds additional work and is confusion when, for example, we include our own middleware. This PR checks if a disabled middleware, is referenced anywhere on an enabled ingress with traefik-integration enabled. It does so by excluding any external middlewares (with namespace explicitly defined) If it finds any that are not enabled, it will still enable/create them regardless. This PR also increases the places ingress-middleware can be referenced on the ingress: 1. common-middlewares (.Values.global.traefik.commonMiddlewares) Special bare-bones middlewares that are applied to all ingresses by default, unless very explicitly overridden 2. chart-middlewares ($ingress.integrations.traefik.chartMiddlewares) Special middlewares that are defined by the chart creator and should always be loaded regardless of user middlewares, for example: nextcloud 3. user-middlewares what we had already **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 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: 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:
co-authored by
Stavros Kois
Stavros Kois
parent
b63677e322
commit
5fd65bb3d5
@@ -217,6 +217,29 @@ global:
|
||||
|
||||
---
|
||||
|
||||
### `traefik.commonMiddlewares`
|
||||
|
||||
Define middlewares that will be applied to all ingresses
|
||||
|
||||
| | |
|
||||
| ---------- | ----------------------------------- |
|
||||
| Key | `global.traefik.commonMiddlewares` |
|
||||
| Type | `list` |
|
||||
| Required | ❌ |
|
||||
| Helm `tpl` | ❌ |
|
||||
| Default | `[{name: tc-basic-secure-headers}]` |
|
||||
|
||||
Example
|
||||
|
||||
```yaml
|
||||
global:
|
||||
traefik:
|
||||
commonMiddlewares:
|
||||
- name: tc-basic-secure-headers
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Full Examples
|
||||
|
||||
```yaml
|
||||
@@ -232,4 +255,6 @@ global:
|
||||
addServiceAnnotations: true
|
||||
traefik:
|
||||
addServiceAnnotations: true
|
||||
commonMiddlewares:
|
||||
- name: tc-basic-secure-headers
|
||||
```
|
||||
|
||||
@@ -201,6 +201,32 @@ ingress:
|
||||
|
||||
---
|
||||
|
||||
## `chartMiddlewares`
|
||||
|
||||
Same as [middlewares](#middlewares) but meant to be used by the chart developer
|
||||
to define some custom middleware specific to this ingress.
|
||||
|
||||
| | |
|
||||
| ---------- | ----------------------------------------------------- |
|
||||
| Key | `ingress.$name.integrations.traefik.chartMiddlewares` |
|
||||
| Type | `list` of `map` |
|
||||
| Required | ❌ |
|
||||
| Helm `tpl` | ❌ |
|
||||
| Default | `[]` |
|
||||
|
||||
Example
|
||||
|
||||
```yaml
|
||||
ingress:
|
||||
ingress-name:
|
||||
integrations:
|
||||
traefik:
|
||||
chartMiddlewares:
|
||||
- name: my-middleware
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Full Examples
|
||||
|
||||
```yaml
|
||||
@@ -216,4 +242,6 @@ ingress:
|
||||
- name: my-middleware
|
||||
namespace: ""
|
||||
expandObjectName: false
|
||||
chartMiddlewares:
|
||||
- name: my-middleware
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user