feat(common): Improve traefik service integration (#40293)

**Description**

This PR improves the traefik service integration by:

- Adds ability to generate
[ServersTransport](https://doc.traefik.io/traefik/reference/routing-configuration/kubernetes/crd/http/serverstransport/)
resources
- Adds docs regarding the traefik service integration to the website

⚒️ Fixes  # NA

**⚙️ 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
- [X] 📜 Documentation Changes

**🧪 How Has This Been Tested?**

What I have tested:

- ServersTransport generation
- `traefik.ingress.kubernetes.io/service.serversscheme` and
`traefik.ingress.kubernetes.io/service.serverstransport` service
annotations generation
- Traefik:
- talks over HTTPS when
`traefik.ingress.kubernetes.io/service.serversscheme: "https"` is set on
the service
   - skips TLS verification when `insecureSkipVerify: true`
- Successfully verifies TLS when `serverName`, `rootCAs` and
`insecureSkipVerify` are set appropriately
   
**📃 Notes:**

1. Previously service docs were missing any kind of documentation
regarding available integrations. This PR only adds docs about the
traefik integration. Other integrations such as metallb, and cillium
remain undocumented as they are not relevant to this PR.

2. To keep this PR small, I have only added the most commonly used
[ServersTransport configuration
options](https://doc.traefik.io/traefik/reference/routing-configuration/kubernetes/crd/http/serverstransport/#configuration-options).
However, this can easily be extended with more options in the future.

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [X] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [X] 📄 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: astro-stan <36302090+astro-stan@users.noreply.github.com>
This commit is contained in:
astro-stan
2025-10-05 22:52:52 +02:00
committed by GitHub
parent d1d1219e4e
commit 9ff148b37a
15 changed files with 891 additions and 13 deletions
@@ -481,6 +481,53 @@ service:
---
#### `integrations`
Define the integrations for this service
| | |
| ---------- | ---------------------------- |
| Key | `service.$name.integrations` |
| Type | `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `{}` |
Example
```yaml
service:
service-name:
integrations: {}
```
---
##### `integrations.traefik`
Define the traefik integration for this service
See more details in [Traefik Integration](/common/service/integrations/traefik)
| | |
| ---------- | ------------------------------------ |
| Key | `service.$name.integrations.traefik` |
| Type | `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `{}` |
Example
```yaml
service:
service-name:
integrations:
traefik: {}
```
---
## Full Examples
Full examples can be found under each service type
@@ -0,0 +1,363 @@
---
title: Traefik Integration
---
:::note
- Examples under each key are only to be used as a placement guide
- See the [Full Examples](/common/service/integrations/traefik#full-examples)
section for complete examples.
:::
## Appears in
- `.Values.service.$name.integration.traefik`
:::tip
- Replace references to `$name` with the actual name you want to use.
:::
---
## `enabled`
Enables or Disables the traefik integration
| | |
| ---------- | -------------------------------------------- |
| Key | `service.$name.integrations.traefik.enabled` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `false` |
Example
```yaml
service:
service-name:
integrations:
traefik:
enabled: true
```
---
## `forceTLS`
Force TLS when talking to the backend service
:::note
Adds the `traefik.ingress.kubernetes.io/service.serversscheme: "https"` annotation.
It does that both with this set OR when there is a service with only https ports
:::
| | |
| ---------- | --------------------------------------------- |
| Key | `service.$name.integrations.traefik.forceTLS` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `false` |
Example
```yaml
service:
service-name:
integrations:
traefik:
forceTLS: true
```
---
## `insecureSkipVerify`
Skip TLS verification when taling to an HTTPS backend service
:::note
Allows talking to HTTPS backend services which use self-signed certs.
Alternatively you can set a [server name](/common/service/integrations/traefik#servername)
and [root CAs](/common/service/integrations/traefik#rootcas) to use when performing
TLS validation.
:::
| | |
| ---------- | ------------------------------------------------------- |
| Key | `service.$name.integrations.traefik.insecureSkipVerify` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `false` |
Example
```yaml
service:
service-name:
integrations:
traefik:
insecureSkipVerify: false
```
---
## `serverName`
Set the hostname to use when talking to a backend service
| | |
| ---------- | ----------------------------------------------- |
| Key | `service.$name.integrations.traefik.serverName` |
| Type | `string` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | "" |
Example
```yaml
service:
service-name:
integrations:
traefik:
serverName: "my.service.com"
```
---
## `rootCAs`
List of kubernetes secrets (in the same namespace) containing certificate
authorities to use when performing TLS verification of the backend service.
:::note
The secrets must contain a key called `ca.crt`, `tls.crt` or `tls.ca` with the
value being the certificate authority. For more information refer to the
[official documentation](https://doc.traefik.io/traefik/reference/routing-configuration/kubernetes/crd/http/serverstransport/#serverstransport-rootcas)
and [this fixture](https://github.com/traefik/traefik/blob/6df82676aaf8186215086a1d9e934170fb5db13f/pkg/provider/kubernetes/crd/fixtures/with_servers_transport.yml).
:::
| | |
| ---------- | ----------------------------------------------- |
| Key | `service.$name.integrations.traefik.rootCAs` |
| Type | `list` of `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `[]` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs: []
```
---
### `rootCAs.secretRef`
Define the secretRef
| | |
| ---------- | ------------------------------------------------------------- |
| Key | `service.$name.integrations.traefik.rootCAs[].secretRef` |
| Type | `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `{}` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- secretRef: {}
```
---
#### `rootCAs.secretRef.name`
Define the secret name
:::note
This will be automatically expanded to `fullname-secret-name`.
You can opt out of this by setting [`expandObjectName`](/common/service/integrations/traefik#rootcassecretrefexpandobjectname)
to `false`
:::
| | |
| ---------- | ------------------------------------------------------------------ |
| Key | `service.$name.integrations.traefik.rootCAs[].secretRef.name` |
| Type | `string` |
| Required | ✅ |
| Helm `tpl` | ✅ |
| Default | `""` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- secretRef:
name: secret-name
```
---
#### `rootCAs.secretRef.expandObjectName`
Whether to expand (adding the fullname as prefix) the secret name
| | |
| ---------- | ------------------------------------------------------------------------------ |
| Key | `service.$name.integrations.traefik.rootCAs[].secretRef.expandObjectName` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- secretRef:
name: secret-name
expandObjectName: false
```
---
### `rootCAs.configMapRef`
Define the configMapRef
| | |
| ---------- | ---------------------------------------------------------------- |
| Key | `service.$name.integrations.traefik.rootCAs[].configMapRef` |
| Type | `map` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `{}` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- configMapRef: {}
```
---
#### `rootCAs.configMapRef.name`
Define the configmap name
:::note
This will be automatically expanded to `fullname-configmap-name`.
You can opt out of this by setting [`expandObjectName`](/common/service/integrations/traefik#rootcasconfigmaprefexpandobjectname)
to `false`
:::
| | |
| ---------- | --------------------------------------------------------------------- |
| Key | `service.$name.integrations.traefik.rootCAs[].configMapRef.name` |
| Type | `string` |
| Required | ✅ |
| Helm `tpl` | ✅ |
| Default | `""` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- configMapRef:
name: configmap-name
```
---
#### `rootCAs.configMapRef.expandObjectName`
Whether to expand (adding the fullname as prefix) the configmap name
| | |
| ---------- | --------------------------------------------------------------------------------- |
| Key | `service.$name.integrations.traefik.rootCAs[].configMapRef.expandObjectName` |
| Type | `bool` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `true` |
Example
```yaml
service:
service-name:
integrations:
traefik:
rootCAs:
- configMapRef:
name: configmap-name
expandObjectName: false
```
---
## Full Examples
```yaml
service:
service-name:
integrations:
traefik:
enabled: true
forceTLS: true
insecureSkipVerify: false
serverName: "my.service.com"
rootCAs:
- configMapRef:
name: configmap-name
expandObjectName: false
- secretRef:
name: secret-name
expandObjectName: true
```