From 201f855292db2ffc526e701ca5ce497b57004442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BUISSON?= Date: Wed, 29 Jan 2025 08:43:10 +0100 Subject: [PATCH] feat: :sparkles: add missing microcks provider for Hub --- traefik/VALUES.md | 12 +++++ traefik/templates/_podtemplate.tpl | 3 ++ traefik/templates/requirements.yaml | 4 ++ traefik/tests/requirements-config_test.yaml | 12 +++++ traefik/tests/traefik-config_test.yaml | 17 +++++++ traefik/values.schema.json | 56 +++++++++++++++++++++ traefik/values.yaml | 28 +++++++++++ 7 files changed, 132 insertions(+) diff --git a/traefik/VALUES.md b/traefik/VALUES.md index 70a9fc1ac..19bfd2739 100644 --- a/traefik/VALUES.md +++ b/traefik/VALUES.md @@ -87,6 +87,18 @@ Kubernetes: `>=1.22.0-0` | hub.apimanagement.enabled | bool | `false` | Set to true in order to enable API Management. Requires a valid license token. | | 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 | | hub.experimental.aigateway | bool | `false` | Set to true in order to enable AI Gateway. Requires a valid license token. | +| hub.providers.microcks.auth.clientId | string | `""` | Microcks API client ID. | +| hub.providers.microcks.auth.clientSecret | string | `""` | Microcks API client secret. | +| hub.providers.microcks.auth.endpoint | string | `""` | Microcks API endpoint. | +| hub.providers.microcks.auth.token | string | `""` | Microcks API token. | +| hub.providers.microcks.enabled | bool | `false` | Enable Microcks provider. | +| hub.providers.microcks.endpoint | string | `""` | Microcks API endpoint. | +| hub.providers.microcks.pollInterval | int | `30` | Polling interval for Microcks API. | +| hub.providers.microcks.pollTimeout | int | `5` | Polling timeout for Microcks API. | +| hub.providers.microcks.tls.ca | string | `""` | TLS CA | +| hub.providers.microcks.tls.cert | string | `""` | TLS cert | +| hub.providers.microcks.tls.insecureSkipVerify | bool | `false` | TLS insecure skip verify | +| hub.providers.microcks.tls.key | string | `""` | TLS key | | hub.redis.cluster | string | `nil` | Enable Redis Cluster. Default: true. | | hub.redis.database | string | `nil` | Database used to store information. Default: "0". | | hub.redis.endpoints | string | `""` | Endpoints of the Redis instances to connect to. Default: "". | diff --git a/traefik/templates/_podtemplate.tpl b/traefik/templates/_podtemplate.tpl index 19bdc651c..acff5b33a 100644 --- a/traefik/templates/_podtemplate.tpl +++ b/traefik/templates/_podtemplate.tpl @@ -815,6 +815,9 @@ {{- if and $.Values.tracing.otlp.enabled .tracing.additionalTraceHeaders.enabled }} {{- include "traefik.yaml2CommandLineArgs" (dict "path" "hub.tracing.additionalTraceHeaders.traceContext" "content" $.Values.hub.tracing.additionalTraceHeaders.traceContext) | nindent 10 }} {{- end }} + {{- if .providers.microcks.enabled }} + {{- include "traefik.yaml2CommandLineArgs" (dict "path" "hub.providers.microcks" "content" (omit $.Values.hub.providers.microcks "enabled")) | nindent 10 }} + {{- end }} {{- end }} {{- end }} env: diff --git a/traefik/templates/requirements.yaml b/traefik/templates/requirements.yaml index 85bd8acb9..0250e7f03 100644 --- a/traefik/templates/requirements.yaml +++ b/traefik/templates/requirements.yaml @@ -63,4 +63,8 @@ {{- if and (not $.Values.tracing.otlp.enabled) .Values.hub.tracing.additionalTraceHeaders.enabled }} {{ fail "ERROR: additionalTraceHeaders needs tracing.otlp to be enabled."}} {{- end }} + + {{- if and (semverCompare "= v3.7.0."}} + {{- end }} {{- end }} diff --git a/traefik/tests/requirements-config_test.yaml b/traefik/tests/requirements-config_test.yaml index bf69f51de..ddb2e99ef 100644 --- a/traefik/tests/requirements-config_test.yaml +++ b/traefik/tests/requirements-config_test.yaml @@ -180,3 +180,15 @@ tests: asserts: - failedTemplate: errorMessage: "ERROR: additionalTraceHeaders needs tracing.otlp to be enabled." + - it: should fail when using consulCatalogEnterprise provider on hub < 3.6.0 + set: + image: + tag: v3.6.0 + hub: + token: "xxx" + providers: + microcks: + enabled: true + asserts: + - failedTemplate: + errorMessage: "ERROR: microcks provider is a feature only available for traefik-hub >= v3.7.0." diff --git a/traefik/tests/traefik-config_test.yaml b/traefik/tests/traefik-config_test.yaml index 3660da8e4..b727635a2 100644 --- a/traefik/tests/traefik-config_test.yaml +++ b/traefik/tests/traefik-config_test.yaml @@ -812,3 +812,20 @@ tests: - contains: path: spec.template.spec.containers[0].args content: "--hub.tracing.additionalTraceHeaders.traceContext.traceState=traceState" + - it: should be possible to configure Traefik Hub microcks provider + set: + image: + tag: v3.7.0 + tracing: + otlp: + enabled: true + hub: + token: "xxx" + providers: + microcks: + enabled: true + endpoint: "http://microcks.svc" + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: "--hub.providers.microcks.endpoint=http://microcks.svc" diff --git a/traefik/values.schema.json b/traefik/values.schema.json index 8ecab1c8c..cac8cf831 100644 --- a/traefik/values.schema.json +++ b/traefik/values.schema.json @@ -290,6 +290,62 @@ }, "type": "object" }, + "providers": { + "properties": { + "microcks": { + "properties": { + "auth": { + "properties": { + "clientId": { + "type": "string" + }, + "clientSecret": { + "type": "string" + }, + "endpoint": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "endpoint": { + "type": "string" + }, + "pollInterval": { + "type": "integer" + }, + "pollTimeout": { + "type": "integer" + }, + "tls": { + "properties": { + "ca": { + "type": "string" + }, + "cert": { + "type": "string" + }, + "insecureSkipVerify": { + "type": "boolean" + }, + "key": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, "redis": { "properties": { "cluster": { diff --git a/traefik/values.yaml b/traefik/values.yaml index 4f9392437..2d8ac738c 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -948,6 +948,34 @@ hub: experimental: # -- Set to true in order to enable AI Gateway. Requires a valid license token. aigateway: false + providers: + microcks: + # -- Enable Microcks provider. + enabled: false + auth: + # -- Microcks API client ID. + clientId: "" + # -- Microcks API client secret. + clientSecret: "" + # -- Microcks API endpoint. + endpoint: "" + # -- Microcks API token. + token: "" + # -- Microcks API endpoint. + endpoint: "" + # -- Polling interval for Microcks API. + pollInterval: 30 + # -- Polling timeout for Microcks API. + pollTimeout: 5 + tls: + # -- TLS CA + ca: "" + # -- TLS cert + cert: "" + # -- TLS insecure skip verify + insecureSkipVerify: false + # -- TLS key + key: "" redis: # -- Enable Redis Cluster. Default: true. cluster: # @schema type:[boolean, null]