Skip to content

Commit 447919a

Browse files
committed
feat: ✨ add missing consulCatalogEnterprise provider for Hub
1 parent 7ff165c commit 447919a

7 files changed

+230
-0
lines changed

traefik/VALUES.md

+27
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,33 @@ Kubernetes: `>=1.22.0-0`
8787
| hub.apimanagement.enabled | bool | `false` | Set to true in order to enable API Management. Requires a valid license token. |
8888
| 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 |
8989
| hub.experimental.aigateway | bool | `false` | Set to true in order to enable AI Gateway. Requires a valid license token. |
90+
| hub.providers.consulCatalogEnterprise.cache | bool | `false` | Use local agent caching for catalog reads. |
91+
| hub.providers.consulCatalogEnterprise.connectAware | bool | `false` | Enable Consul Connect support. |
92+
| hub.providers.consulCatalogEnterprise.connectByDefault | bool | `false` | Consider every service as Connect capable by default. |
93+
| hub.providers.consulCatalogEnterprise.constraints | string | `""` | Constraints is an expression that Traefik matches against the container's labels |
94+
| hub.providers.consulCatalogEnterprise.defaultRule | string | `"Host(`{{ normalize .Name }}`)"` | Default rule. |
95+
| hub.providers.consulCatalogEnterprise.enabled | bool | `false` | Enable Consul Catalog Enterprise backend with default settings. |
96+
| hub.providers.consulCatalogEnterprise.endpoint.address | string | `""` | The address of the Consul server |
97+
| hub.providers.consulCatalogEnterprise.endpoint.datacenter | string | `""` | Data center to use. If not provided, the default agent data center is used |
98+
| hub.providers.consulCatalogEnterprise.endpoint.endpointWaitTime | int | `0` | WaitTime limits how long a Watch will block. If not provided, the agent default |
99+
| hub.providers.consulCatalogEnterprise.endpoint.httpauth.password | string | `""` | Basic Auth password |
100+
| hub.providers.consulCatalogEnterprise.endpoint.httpauth.username | string | `""` | Basic Auth username |
101+
| hub.providers.consulCatalogEnterprise.endpoint.scheme | string | `""` | The URI scheme for the Consul server |
102+
| hub.providers.consulCatalogEnterprise.endpoint.tls.ca | string | `""` | TLS CA |
103+
| hub.providers.consulCatalogEnterprise.endpoint.tls.cert | string | `""` | TLS cert |
104+
| hub.providers.consulCatalogEnterprise.endpoint.tls.insecureSkipVerify | bool | `false` | TLS insecure skip verify |
105+
| hub.providers.consulCatalogEnterprise.endpoint.tls.key | string | `""` | TLS key |
106+
| hub.providers.consulCatalogEnterprise.endpoint.token | string | `""` | Token is used to provide a per-request ACL token which overrides the agent's |
107+
| hub.providers.consulCatalogEnterprise.exposedByDefault | bool | `true` | Expose containers by default. |
108+
| hub.providers.consulCatalogEnterprise.namespaces | string | `""` | Sets the namespaces used to discover services (Consul Enterprise only). |
109+
| hub.providers.consulCatalogEnterprise.partition | string | `""` | Sets the partition used to discover services (Consul Enterprise only). |
110+
| hub.providers.consulCatalogEnterprise.prefix | string | `"traefik"` | Prefix for consul service tags. |
111+
| hub.providers.consulCatalogEnterprise.refreshInterval | int | `15` | Interval for check Consul API. |
112+
| hub.providers.consulCatalogEnterprise.requireConsistent | bool | `false` | Forces the read to be fully consistent. |
113+
| hub.providers.consulCatalogEnterprise.serviceName | string | `"traefik"` | Name of the Traefik service in Consul Catalog (needs to be registered via the |
114+
| hub.providers.consulCatalogEnterprise.stale | bool | `false` | Use stale consistency for catalog reads. |
115+
| hub.providers.consulCatalogEnterprise.strictChecks | string | `"passing, warning"` | A list of service health statuses to allow taking traffic. |
116+
| hub.providers.consulCatalogEnterprise.watch | bool | `false` | Watch Consul API events. |
90117
| hub.redis.cluster | string | `nil` | Enable Redis Cluster. Default: true. |
91118
| hub.redis.database | string | `nil` | Database used to store information. Default: "0". |
92119
| hub.redis.endpoints | string | `""` | Endpoints of the Redis instances to connect to. Default: "". |

traefik/templates/_podtemplate.tpl

+3
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,9 @@
815815
{{- if and $.Values.tracing.otlp.enabled .tracing.additionalTraceHeaders.enabled }}
816816
{{- include "traefik.yaml2CommandLineArgs" (dict "path" "hub.tracing.additionalTraceHeaders.traceContext" "content" $.Values.hub.tracing.additionalTraceHeaders.traceContext) | nindent 10 }}
817817
{{- end }}
818+
{{- if .providers.consulCatalogEnterprise.enabled }}
819+
{{- include "traefik.yaml2CommandLineArgs" (dict "path" "hub.providers.consulCatalogEnterprise" "content" (omit $.Values.hub.providers.consulCatalogEnterprise "enabled")) | nindent 10 }}
820+
{{- end }}
818821
{{- end }}
819822
{{- end }}
820823
env:

traefik/templates/requirements.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@
6363
{{- if and (not $.Values.tracing.otlp.enabled) .Values.hub.tracing.additionalTraceHeaders.enabled }}
6464
{{ fail "ERROR: additionalTraceHeaders needs tracing.otlp to be enabled."}}
6565
{{- end }}
66+
67+
{{- if and (semverCompare "<v3.6.0" $hubVersion) .Values.hub.providers.consulCatalogEnterprise.enabled }}
68+
{{ fail "ERROR: consulCatalogEnterprise provider is a feature only available for traefik-hub >= v3.6.0."}}
69+
{{- end }}
6670
{{- end }}

traefik/tests/requirements-config_test.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,15 @@ tests:
180180
asserts:
181181
- failedTemplate:
182182
errorMessage: "ERROR: additionalTraceHeaders needs tracing.otlp to be enabled."
183+
- it: should fail when using consulCatalogEnterprise provider on hub < 3.6.0
184+
set:
185+
image:
186+
tag: v3.5.0
187+
hub:
188+
token: "xxx"
189+
providers:
190+
consulCatalogEnterprise:
191+
enabled: true
192+
asserts:
193+
- failedTemplate:
194+
errorMessage: "ERROR: consulCatalogEnterprise provider is a feature only available for traefik-hub >= v3.6.0."

traefik/tests/traefik-config_test.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -812,3 +812,21 @@ tests:
812812
- contains:
813813
path: spec.template.spec.containers[0].args
814814
content: "--hub.tracing.additionalTraceHeaders.traceContext.traceState=traceState"
815+
- it: should be possible to configure Traefik Hub consulCatalogEnterprise provider
816+
set:
817+
image:
818+
tag: v3.9.0
819+
tracing:
820+
otlp:
821+
enabled: true
822+
hub:
823+
token: "xxx"
824+
providers:
825+
consulCatalogEnterprise:
826+
enabled: true
827+
prefix: "traefikprefix"
828+
829+
asserts:
830+
- contains:
831+
path: spec.template.spec.containers[0].args
832+
content: "--hub.providers.consulCatalogEnterprise.prefix=traefikprefix"

traefik/values.schema.json

+106
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,112 @@
290290
},
291291
"type": "object"
292292
},
293+
"providers": {
294+
"properties": {
295+
"consulCatalogEnterprise": {
296+
"properties": {
297+
"cache": {
298+
"type": "boolean"
299+
},
300+
"connectAware": {
301+
"type": "boolean"
302+
},
303+
"connectByDefault": {
304+
"type": "boolean"
305+
},
306+
"constraints": {
307+
"type": "string"
308+
},
309+
"defaultRule": {
310+
"type": "string"
311+
},
312+
"enabled": {
313+
"type": "boolean"
314+
},
315+
"endpoint": {
316+
"properties": {
317+
"address": {
318+
"type": "string"
319+
},
320+
"datacenter": {
321+
"type": "string"
322+
},
323+
"endpointWaitTime": {
324+
"type": "integer"
325+
},
326+
"httpauth": {
327+
"properties": {
328+
"password": {
329+
"type": "string"
330+
},
331+
"username": {
332+
"type": "string"
333+
}
334+
},
335+
"type": "object"
336+
},
337+
"scheme": {
338+
"type": "string"
339+
},
340+
"tls": {
341+
"properties": {
342+
"ca": {
343+
"type": "string"
344+
},
345+
"cert": {
346+
"type": "string"
347+
},
348+
"insecureSkipVerify": {
349+
"type": "boolean"
350+
},
351+
"key": {
352+
"type": "string"
353+
}
354+
},
355+
"type": "object"
356+
},
357+
"token": {
358+
"type": "string"
359+
}
360+
},
361+
"type": "object"
362+
},
363+
"exposedByDefault": {
364+
"type": "boolean"
365+
},
366+
"namespaces": {
367+
"type": "string"
368+
},
369+
"partition": {
370+
"type": "string"
371+
},
372+
"prefix": {
373+
"type": "string"
374+
},
375+
"refreshInterval": {
376+
"type": "integer"
377+
},
378+
"requireConsistent": {
379+
"type": "boolean"
380+
},
381+
"serviceName": {
382+
"type": "string"
383+
},
384+
"stale": {
385+
"type": "boolean"
386+
},
387+
"strictChecks": {
388+
"type": "string"
389+
},
390+
"watch": {
391+
"type": "boolean"
392+
}
393+
},
394+
"type": "object"
395+
}
396+
},
397+
"type": "object"
398+
},
293399
"redis": {
294400
"properties": {
295401
"cluster": {

traefik/values.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,66 @@ hub:
979979
insecureSkipVerify: false
980980
# Enable export of errors logs to the platform. Default: true.
981981
sendlogs: # @schema type:[boolean, null]
982+
providers:
983+
consulCatalogEnterprise:
984+
# -- Enable Consul Catalog Enterprise backend with default settings.
985+
enabled: false
986+
# -- Use local agent caching for catalog reads.
987+
cache: false
988+
# -- Enable Consul Connect support.
989+
connectAware: false
990+
# -- Consider every service as Connect capable by default.
991+
connectByDefault: false
992+
# -- Constraints is an expression that Traefik matches against the container's labels
993+
constraints: ""
994+
# -- Default rule.
995+
defaultRule: "Host(`{{ normalize .Name }}`)"
996+
endpoint:
997+
# -- The address of the Consul server
998+
address: ""
999+
# -- Data center to use. If not provided, the default agent data center is used
1000+
datacenter: ""
1001+
# -- WaitTime limits how long a Watch will block. If not provided, the agent default
1002+
endpointWaitTime: 0
1003+
httpauth:
1004+
# -- Basic Auth password
1005+
password: ""
1006+
# -- Basic Auth username
1007+
username: ""
1008+
# -- The URI scheme for the Consul server
1009+
scheme: ""
1010+
tls:
1011+
# -- TLS CA
1012+
ca: ""
1013+
# -- TLS cert
1014+
cert: ""
1015+
# -- TLS insecure skip verify
1016+
insecureSkipVerify: false
1017+
# -- TLS key
1018+
key: ""
1019+
# -- Token is used to provide a per-request ACL token which overrides the agent's
1020+
token: ""
1021+
# -- Expose containers by default.
1022+
exposedByDefault: true
1023+
# -- Sets the namespaces used to discover services (Consul Enterprise only).
1024+
namespaces: ""
1025+
# -- Sets the partition used to discover services (Consul Enterprise only).
1026+
partition: ""
1027+
# -- Prefix for consul service tags.
1028+
prefix: "traefik"
1029+
# -- Interval for check Consul API.
1030+
refreshInterval: 15
1031+
# -- Forces the read to be fully consistent.
1032+
requireConsistent: false
1033+
# -- Name of the Traefik service in Consul Catalog (needs to be registered via the
1034+
serviceName: "traefik"
1035+
# -- Use stale consistency for catalog reads.
1036+
stale: false
1037+
# -- A list of service health statuses to allow taking traffic.
1038+
strictChecks: "passing, warning"
1039+
# -- Watch Consul API events.
1040+
watch: false
1041+
9821042
tracing:
9831043
# -- Tracing headers to duplicate.
9841044
# To configure the following, tracing.otlp.enabled needs to be set to true.

0 commit comments

Comments
 (0)