Skip to content

Commit a6da987

Browse files
darkweaver87mloiseleur
authored andcommitted
feat(hub): ✨ support apiManagement openApi refresh interval
1 parent af45fa0 commit a6da987

7 files changed

Lines changed: 67 additions & 0 deletions

File tree

traefik/VALUES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ Kubernetes: `>=1.25.0-0`
145145
| hub.apimanagement.admission.secretName | string | `"hub-agent-cert"` | Certificate name of the WebHook admission server. Default: "hub-agent-cert". |
146146
| hub.apimanagement.admission.selfManagedCertificate | bool | `false` | By default, this chart handles directly the tls certificate required for the admission webhook. It's possible to disable this behavior and handle it outside of the chart. See EXAMPLES.md for more details. |
147147
| hub.apimanagement.enabled | bool | `false` | Set to true in order to enable API Management. Requires a valid license token. |
148+
| hub.apimanagement.openApi.refreshInterval | string | `""` | Interval to refresh the OpenAPI specification, as a Go duration. When empty, the provider default (`0`, disabled) applies. |
148149
| hub.apimanagement.openApi.validateRequestMethodAndPath | bool | `false` | When set to true, it will only accept paths and methods that are explicitly defined in its OpenAPI specification |
149150
| hub.enabled | bool | `true` when `hub.token` is set | Install Traefik Hub. Without `hub.token`, it runs in proxy mode: a drop-in Traefik Proxy, which requires Traefik Hub >= v3.21.0-ea. |
150151
| hub.hardened | bool | `false` | Use the hardened image variant. It appends `-hardened` to the tag and defaults the image to `registry.traefik.io/traefik-hub`. Requires `hub.enabled` and Traefik Hub >= v3.21.0-ea. |

traefik/templates/_podtemplate.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,9 @@
861861
{{- if .openApi.validateRequestMethodAndPath }}
862862
- "--hub.apiManagement.openApi.validateRequestMethodAndPath=true"
863863
{{- end }}
864+
{{- with .openApi.refreshInterval }}
865+
- "--hub.apiManagement.openApi.refreshInterval={{ . }}"
866+
{{- end }}
864867
{{- end }}
865868
{{- end }}
866869
{{- with .aigateway }}

traefik/templates/requirements.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@
214214
{{ fail "ERROR: hub.hardened is only available for Traefik Hub >= v3.21.0-ea, set image.tag accordingly." }}
215215
{{- end }}
216216

217+
{{- if and $.Values.hub.apimanagement.openApi.refreshInterval (semverCompare "<v3.21.0-0" $hubVersion) }}
218+
{{ fail "ERROR: hub.apimanagement.openApi.refreshInterval is only available for Traefik Hub >= v3.21.0." }}
219+
{{- end }}
220+
217221
{{- if semverCompare "<v3.20.0-ea.7" $hubVersion }}
218222
{{- range $childName, $childConfig := $.Values.hub.providers.multicluster.children }}
219223
{{- if or (($childConfig.serversTransport).forwardingTimeouts).readTimeout (($childConfig.serversTransport).forwardingTimeouts).writeTimeout }}

traefik/tests/hub-apigateway-config_test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,30 @@ tests:
139139
- contains:
140140
path: spec.template.spec.containers[0].args
141141
content: "--hub.apiManagement.openApi.validateRequestMethodAndPath=true"
142+
- it: should set the OpenAPI refresh interval
143+
set:
144+
image:
145+
registry: ghcr.io
146+
repository: traefik/traefik-hub
147+
tag: v3.21.0-ea.1
148+
hub:
149+
apimanagement:
150+
enabled: true
151+
openApi:
152+
refreshInterval: "5m"
153+
asserts:
154+
- contains:
155+
path: spec.template.spec.containers[0].args
156+
content: "--hub.apiManagement.openApi.refreshInterval=5m"
157+
- it: should not set the OpenAPI refresh interval by default
158+
set:
159+
hub:
160+
apimanagement:
161+
enabled: true
162+
asserts:
163+
- notContains:
164+
path: spec.template.spec.containers[0].args
165+
content: "--hub.apiManagement.openApi.refreshInterval="
142166
- it: api management and ai gateway should not be enabled by default
143167
asserts:
144168
- notContains:

traefik/tests/requirements-config_test.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,35 @@ tests:
866866
- "prod"
867867
asserts:
868868
- notFailedTemplate: {}
869+
- it: should fail when using apiManagement openApi refreshInterval on Traefik Hub < v3.21.0
870+
set:
871+
image:
872+
registry: "ghcr.io"
873+
repository: "traefik/traefik-hub"
874+
tag: v3.20.7
875+
hub:
876+
token: "xxx"
877+
apimanagement:
878+
enabled: true
879+
openApi:
880+
refreshInterval: "5m"
881+
asserts:
882+
- failedTemplate:
883+
errorMessage: "ERROR: hub.apimanagement.openApi.refreshInterval is only available for Traefik Hub >= v3.21.0."
884+
- it: should pass when using apiManagement openApi refreshInterval on Traefik Hub >= v3.21.0
885+
set:
886+
image:
887+
registry: "ghcr.io"
888+
repository: "traefik/traefik-hub"
889+
tag: v3.21.0-ea.1
890+
hub:
891+
token: "xxx"
892+
apimanagement:
893+
enabled: true
894+
openApi:
895+
refreshInterval: "5m"
896+
asserts:
897+
- notFailedTemplate: {}
869898
- it: should fail when using pluginRegistry sources with unused plugin
870899
set:
871900
image:

traefik/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,10 @@
769769
"openApi": {
770770
"type": "object",
771771
"properties": {
772+
"refreshInterval": {
773+
"description": "Interval to refresh the OpenAPI specification, as a Go duration. When empty, the provider default (`0`, disabled) applies.",
774+
"type": "string"
775+
},
772776
"validateRequestMethodAndPath": {
773777
"description": "When set to true, it will only accept paths and methods that are explicitly defined in its OpenAPI specification",
774778
"type": "boolean"

traefik/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,8 @@ hub: # @schema additionalProperties: false
13211321
openApi:
13221322
# -- When set to true, it will only accept paths and methods that are explicitly defined in its OpenAPI specification
13231323
validateRequestMethodAndPath: false
1324+
# -- Interval to refresh the OpenAPI specification, as a Go duration. When empty, the provider default (`0`, disabled) applies.
1325+
refreshInterval: ""
13241326

13251327
mcpgateway:
13261328
# -- Set to true in order to enable AI MCP Gateway. Requires a valid license token.

0 commit comments

Comments
 (0)