Skip to content

Commit

Permalink
fix(Kubernetes Ingress)!: 💥 ✨ enable publishedService by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur authored Oct 18, 2024
1 parent 59073ef commit f7a96da
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 32 deletions.
3 changes: 2 additions & 1 deletion traefik/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ Kubernetes: `>=1.22.0-0`
| providers.kubernetesIngress.ingressClass | string | `nil` | When ingressClass is set, only Ingresses containing an annotation with the same value are processed. Otherwise, Ingresses missing the annotation, having an empty value, or the value traefik are processed. |
| providers.kubernetesIngress.namespaces | list | `[]` | Array of namespaces to watch. If left empty, Traefik watches all namespaces. |
| providers.kubernetesIngress.nativeLBByDefault | bool | `false` | Defines whether to use Native Kubernetes load-balancing mode by default. |
| providers.kubernetesIngress.publishedService.enabled | bool | `false` | |
| providers.kubernetesIngress.publishedService.enabled | bool | `true` | Enable [publishedService](https://doc.traefik.io/traefik/providers/kubernetes-ingress/#publishedservice) |
| providers.kubernetesIngress.publishedService.pathOverride | string | `""` | Override path of Kubernetes Service used to copy status from. Format: namespace/servicename. Default to Service deployed with this Chart. |
| rbac | object | `{"aggregateTo":[],"enabled":true,"namespaced":false,"secretResourceNames":[]}` | Whether Role Based Access Control objects like roles and rolebindings should be created |
| readinessProbe.failureThreshold | int | `1` | The number of consecutive failures allowed before considering the probe as failed. |
| readinessProbe.initialDelaySeconds | int | `2` | The number of seconds to wait before starting the first probe. |
Expand Down
22 changes: 22 additions & 0 deletions traefik/tests/deployment-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,28 @@ tests:
asserts:
- failedTemplate:
errorPattern: "redirectTo"
- it: should set default values for args
asserts:
- equal:
path: spec.template.spec.containers[0].args
value:
- --global.checknewversion
- --global.sendanonymoususage
- --entryPoints.metrics.address=:9100/tcp
- --entryPoints.traefik.address=:9000/tcp
- --entryPoints.web.address=:8000/tcp
- --entryPoints.websecure.address=:8443/tcp
- --api.dashboard=true
- --ping=true
- --metrics.prometheus=true
- --metrics.prometheus.entrypoint=metrics
- --providers.kubernetescrd
- --providers.kubernetescrd.allowEmptyServices=true
- --providers.kubernetesingress
- --providers.kubernetesingress.allowEmptyServices=true
- --providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik
- --entryPoints.websecure.http.tls=true
- --log.level=INFO
- it: should have http redirections enabled, when enabled with redirectTo
set:
ports:
Expand Down
22 changes: 0 additions & 22 deletions traefik/tests/metrics-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,6 @@ capabilities:
majorVersion: 1
minorVersion: 16
tests:
- it: should set default values for args
asserts:
- equal:
path: spec.template.spec.containers[0].args
value:
- --global.checknewversion
- --global.sendanonymoususage
- --entryPoints.metrics.address=:9100/tcp
- --entryPoints.traefik.address=:9000/tcp
- --entryPoints.web.address=:8000/tcp
- --entryPoints.websecure.address=:8443/tcp
- --api.dashboard=true
- --ping=true
- --metrics.prometheus=true
- --metrics.prometheus.entrypoint=metrics
- --providers.kubernetescrd
- --providers.kubernetescrd.allowEmptyServices=true
- --providers.kubernetesingress
- --providers.kubernetesingress.allowEmptyServices=true
- --entryPoints.websecure.http.tls=true
- --log.level=INFO

- it: "should support to set prometheus: null"
set:
metrics:
Expand Down
10 changes: 5 additions & 5 deletions traefik/tests/traefik-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ tests:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetescrd"

- it: should have disable published Kubernetes service when default configuration
- it: should have enabled published Kubernetes service when default configuration
asserts:
- notContains:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik"
- it: should have enable published Kubernetes service when specified in configuration
- it: should be possible to disable published Kubernetes service when specified in configuration
set:
providers:
kubernetesIngress:
publishedService:
enabled: true
enabled: false
asserts:
- contains:
- notContains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik"
- it: should have a custom string in published Kubernetes service when specified in configuration
Expand Down
3 changes: 3 additions & 0 deletions traefik/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,9 @@
"properties": {
"enabled": {
"type": "boolean"
},
"pathOverride": {
"type": "string"
}
},
"type": "object"
Expand Down
9 changes: 5 additions & 4 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,11 @@ providers: # @schema additionalProperties: false
namespaces: []
# IP used for Kubernetes Ingress endpoints
publishedService:
enabled: false
# Published Kubernetes Service to copy status from. Format: namespace/servicename
# By default this Traefik service
# pathOverride: ""
# -- Enable [publishedService](https://doc.traefik.io/traefik/providers/kubernetes-ingress/#publishedservice)
enabled: true
# -- Override path of Kubernetes Service used to copy status from. Format: namespace/servicename.
# Default to Service deployed with this Chart.
pathOverride: ""
# -- Defines whether to use Native Kubernetes load-balancing mode by default.
nativeLBByDefault: false

Expand Down

0 comments on commit f7a96da

Please sign in to comment.