Skip to content

Commit

Permalink
feat(Gateway API): ✨ add infrastructure in the values
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur authored Oct 11, 2024
1 parent 12fee7e commit 2b28f7b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions traefik/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Kubernetes: `>=1.22.0-0`
| extraObjects | list | `[]` | Extra objects to deploy (value evaluated as a template) In some cases, it can avoid the need for additional, extended or adhoc deployments. See #595 for more details and traefik/tests/values/extra.yaml for example. |
| gateway.annotations | object | `{}` | Additional gateway annotations (e.g. for cert-manager.io/issuer) |
| gateway.enabled | bool | `true` | When providers.kubernetesGateway.enabled, deploy a default gateway |
| gateway.infrastructure | object | `{}` | [Infrastructure](https://kubernetes.io/blog/2023/11/28/gateway-api-ga/#gateway-infrastructure-labels) |
| gateway.listeners | object | `{"web":{"hostname":"","namespacePolicy":null,"port":8000,"protocol":"HTTP"}}` | Define listeners |
| gateway.listeners.web.hostname | string | `""` | Optional hostname. See [Hostname](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.Hostname) |
| gateway.listeners.web.namespacePolicy | string | `nil` | Routes are restricted to namespace of the gateway [by default](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.FromNamespaces |
Expand Down
4 changes: 4 additions & 0 deletions traefik/templates/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ metadata:
{{- end }}
spec:
gatewayClassName: {{ default "traefik" .Values.gatewayClass.name }}
{{- with .Values.gateway.infrastructure }}
infrastructure:
{{ toYaml . | nindent 4 }}
{{- end }}
listeners:
{{- range $name, $config := .Values.gateway.listeners }}
- name: {{ $name }}
Expand Down
29 changes: 29 additions & 0 deletions traefik/tests/gateway-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,32 @@ tests:
asserts:
- failedTemplate:
errorMessage: "ERROR: port needs to be specified"
- it: should be possible to configure infrastructure level on the Gateway
set:
providers:
kubernetesGateway:
enabled: true
gateway:
infrastructure:
labels:
foo: bar
tip: top
annotations:
afoo: abar
parametersRef:
group: traefik.io
kind: TraefikProxy
name: custom-config
asserts:
- isSubset:
path: spec.infrastructure
content:
labels:
foo: bar
tip: top
annotations:
afoo: abar
parametersRef:
group: traefik.io
kind: TraefikProxy
name: custom-config
4 changes: 4 additions & 0 deletions traefik/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
"enabled": {
"type": "boolean"
},
"infrastructure": {
"properties": {},
"type": "object"
},
"listeners": {
"properties": {
"web": {
Expand Down
2 changes: 2 additions & 0 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ gateway:
namespace: ""
# -- Additional gateway annotations (e.g. for cert-manager.io/issuer)
annotations: {}
# -- [Infrastructure](https://kubernetes.io/blog/2023/11/28/gateway-api-ga/#gateway-infrastructure-labels)
infrastructure: {}
# -- Define listeners
listeners:
web:
Expand Down

0 comments on commit 2b28f7b

Please sign in to comment.