Skip to content

Commit

Permalink
chore(Gateway API): ♻️ remove template from values
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweaver87 authored Jan 13, 2025
1 parent 1210294 commit 0b1d149
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion traefik/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Kubernetes: `>=1.22.0-0`
| providers.kubernetesGateway.nativeLBByDefault | bool | `false` | Defines whether to use Native Kubernetes load-balancing mode by default. |
| providers.kubernetesGateway.statusAddress.hostname | string | `""` | This Hostname will get copied to the Gateway status.addresses. |
| providers.kubernetesGateway.statusAddress.ip | string | `""` | This IP will get copied to the Gateway status.addresses, and currently only supports one IP value (IPv4 or IPv6). |
| providers.kubernetesGateway.statusAddress.service | object | `{"name":"{{ (include \"traefik.fullname\" .) }}","namespace":"{{ include \"traefik.namespace\" . }}"}` | The Kubernetes service to copy status addresses from. When using third parties tools like External-DNS, this option can be used to copy the service loadbalancer.status (containing the service's endpoints IPs) to the gateways. Default to Service of this Chart. |
| providers.kubernetesGateway.statusAddress.service | object | `{"enabled":true,"name":"","namespace":""}` | The Kubernetes service to copy status addresses from. When using third parties tools like External-DNS, this option can be used to copy the service loadbalancer.status (containing the service's endpoints IPs) to the gateways. Default to Service of this Chart. |
| providers.kubernetesIngress.allowEmptyServices | bool | `true` | Allows to return 503 when there is no endpoints available |
| providers.kubernetesIngress.allowExternalNameServices | bool | `false` | Allows to reference ExternalName services in Ingress |
| providers.kubernetesIngress.enabled | bool | `true` | Load Kubernetes Ingress provider |
Expand Down
6 changes: 3 additions & 3 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,9 @@
{{- with .hostname }}
- "--providers.kubernetesgateway.statusaddress.hostname={{ . }}"
{{- end }}
{{- with .service }}
- "--providers.kubernetesgateway.statusaddress.service.name={{ tpl .name $ }}"
- "--providers.kubernetesgateway.statusaddress.service.namespace={{ tpl .namespace $ }}"
{{- if (and .service.enabled $.Values.service.enabled) }}
- "--providers.kubernetesgateway.statusaddress.service.name={{ .service.name | default (include "traefik.fullname" $) }}"
- "--providers.kubernetesgateway.statusaddress.service.namespace={{ .service.namespace | default (include "traefik.namespace" $) }}"
{{- end }}
{{- end }}
{{- if .nativeLBByDefault }}
Expand Down
17 changes: 16 additions & 1 deletion traefik/tests/traefik-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ tests:
- contains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik"
- it: should use overrided namespace when specified
- it: should use override namespace when specified
set:
namespaceOverride: foo
asserts:
Expand Down Expand Up @@ -129,6 +129,21 @@ tests:
- notContains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesgateway.statusaddress.service.namespace=NAMESPACE"
- it: should not set default statusAddress when disabled
set:
providers:
kubernetesGateway:
enabled: true
statusAddress:
service:
enabled: false
asserts:
- notContains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesgateway.statusaddress.service.name=RELEASE-NAME-traefik"
- notContains:
path: spec.template.spec.containers[0].args
content: "--providers.kubernetesgateway.statusaddress.service.namespace=NAMESPACE"
- it: should be possible to set statusAddress fields
set:
providers:
Expand Down
3 changes: 3 additions & 0 deletions traefik/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,9 @@
},
"service": {
"properties": {
"enabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
Expand Down
5 changes: 3 additions & 2 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ providers: # @schema additionalProperties: false
hostname: ""
# -- The Kubernetes service to copy status addresses from. When using third parties tools like External-DNS, this option can be used to copy the service loadbalancer.status (containing the service's endpoints IPs) to the gateways. Default to Service of this Chart.
service:
name: "{{ .Values.service.enabled | ternary (include \"traefik.fullname\" .) nil }}"
namespace: "{{ .Values.service.enabled | ternary (include \"traefik.namespace\" .) nil }}"
enabled: true
name: ""
namespace: ""

file:
# -- Create a file provider
Expand Down

0 comments on commit 0b1d149

Please sign in to comment.