From b932958e120e34e9a4c60f2496b70ba82874a65a Mon Sep 17 00:00:00 2001 From: Bmagic Date: Tue, 26 Nov 2024 15:50:06 +0100 Subject: [PATCH] feat(Traefik Proxy): add `abortOnPluginFailure` field --- traefik/VALUES.md | 1 + traefik/templates/_podtemplate.tpl | 3 +++ traefik/tests/deployment-config_test.yaml | 8 ++++++++ traefik/values.schema.json | 3 +++ traefik/values.yaml | 2 ++ 5 files changed, 17 insertions(+) diff --git a/traefik/VALUES.md b/traefik/VALUES.md index 5b1b0990e..7063dd419 100644 --- a/traefik/VALUES.md +++ b/traefik/VALUES.md @@ -62,6 +62,7 @@ Kubernetes: `>=1.22.0-0` | deployment.terminationGracePeriodSeconds | int | `60` | Amount of time (in seconds) before Kubernetes will send the SIGKILL signal if Traefik does not shut down | | env | list | See _values.yaml_ | Additional Environment variables to be passed to Traefik's binary | | envFrom | list | `[]` | Environment variables to be passed to Traefik's binary from configMaps or secrets | +| experimental.abortOnPluginFailure | bool | `false` | Defines whether all plugins must be loaded successfully for Traefik to start | | experimental.kubernetesGateway.enabled | bool | `false` | Enable traefik experimental GatewayClass CRD | | experimental.plugins | object | `{}` | Enable traefik experimental plugins | | 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. | diff --git a/traefik/templates/_podtemplate.tpl b/traefik/templates/_podtemplate.tpl index 786a8b0d0..9e47d74f3 100644 --- a/traefik/templates/_podtemplate.tpl +++ b/traefik/templates/_podtemplate.tpl @@ -448,6 +448,9 @@ - "--experimental.plugins.{{ $pluginName }}.moduleName={{ $plugin.moduleName }}" - "--experimental.plugins.{{ $pluginName }}.version={{ $plugin.version }}" {{- end }} + {{- if and (semverCompare ">=3.2.1-0" $version) (.Values.experimental.abortOnPluginFailure)}} + - "--experimental.abortonpluginfailure={{ .Values.experimental.abortOnPluginFailure }}" + {{- end }} {{- if .Values.providers.kubernetesCRD.enabled }} - "--providers.kubernetescrd" {{- if .Values.providers.kubernetesCRD.labelSelector }} diff --git a/traefik/tests/deployment-config_test.yaml b/traefik/tests/deployment-config_test.yaml index 84e72f968..47d98712d 100644 --- a/traefik/tests/deployment-config_test.yaml +++ b/traefik/tests/deployment-config_test.yaml @@ -201,6 +201,14 @@ tests: - --providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik - --entryPoints.websecure.http.tls=true - --log.level=INFO + - it: should have abortOnPluginFailure, when enabled + set: + experimental: + abortOnPluginFailure: true + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: "--experimental.abortonpluginfailure=true" - it: should have http redirections enabled, when enabled with redirectTo set: ports: diff --git a/traefik/values.schema.json b/traefik/values.schema.json index 41ca8e73f..3f62f424b 100644 --- a/traefik/values.schema.json +++ b/traefik/values.schema.json @@ -149,6 +149,9 @@ }, "experimental": { "properties": { + "abortOnPluginFailure": { + "type": "boolean" + }, "kubernetesGateway": { "properties": { "enabled": { diff --git a/traefik/values.yaml b/traefik/values.yaml index 16d345fb0..9b4379cfa 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -120,6 +120,8 @@ core: # @schema additionalProperties: false # Traefik experimental features experimental: + # -- Defines whether all plugins must be loaded successfully for Traefik to start + abortOnPluginFailure: false # -- Enable traefik experimental plugins plugins: {} # demo: