From 983940ae60ddf1187eac85b3890d2085d802858a Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 24 Jun 2024 10:36:03 +0200 Subject: [PATCH] KubernetesGateway provider out of experimental Co-authored-by: Kevin Pollet --- docs/content/migration/v3.md | 26 +++++++++++++++++++ .../reference/static-configuration/cli-ref.md | 2 +- .../reference/static-configuration/env-ref.md | 2 +- pkg/cli/deprecation.go | 11 ++++++-- pkg/cli/deprecation_test.go | 17 +++++++++--- pkg/config/static/experimental.go | 3 ++- 6 files changed, 53 insertions(+), 8 deletions(-) diff --git a/docs/content/migration/v3.md b/docs/content/migration/v3.md index 00277395f..4529a89a4 100644 --- a/docs/content/migration/v3.md +++ b/docs/content/migration/v3.md @@ -25,3 +25,29 @@ the `endpoints` right has to be removed and the following `endpointslices` right - watch ... ``` + +#### Gateway API: KubernetesGateway Provider + +In v3.1, the KubernetesGateway Provider is no longer an experimental feature. +It can be enabled without the associated `experimental.kubernetesgateway` option, which is now deprecated. + +??? example "An example of the experimental `kubernetesgateway` option" + + ```yaml tab="File (YAML)" + experimental: + kubernetesgateway: true + ``` + + ```toml tab="File (TOML)" + [experimental] + kubernetesgateway=true + ``` + + ```bash tab="CLI" + --experimental.kubernetesgateway=true + ``` + +##### Remediation + +The `kubernetesgateway` option should be removed from the experimental section of the static configuration. +To configure `kubernetesgateway`, please check out the [KubernetesGateway Provider documentation](../providers/kubernetes-gateway.md). diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index 136f8dc8e..951bf43ed 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -211,7 +211,7 @@ WriteTimeout is the maximum duration before timing out writes of the response. I Timeout defines how long to wait on an idle session before releasing the related resources. (Default: ```3```) `--experimental.kubernetesgateway`: -Allow the Kubernetes gateway api provider usage. (Default: ```false```) +(Deprecated) Allow the Kubernetes gateway api provider usage. (Default: ```false```) `--experimental.localplugins.`: Local plugins configuration. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index 12636602c..5f3327d82 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -211,7 +211,7 @@ WriteTimeout is the maximum duration before timing out writes of the response. I Timeout defines how long to wait on an idle session before releasing the related resources. (Default: ```3```) `TRAEFIK_EXPERIMENTAL_KUBERNETESGATEWAY`: -Allow the Kubernetes gateway api provider usage. (Default: ```false```) +(Deprecated) Allow the Kubernetes gateway api provider usage. (Default: ```false```) `TRAEFIK_EXPERIMENTAL_LOCALPLUGINS_`: Local plugins configuration. (Default: ```false```) diff --git a/pkg/cli/deprecation.go b/pkg/cli/deprecation.go index 01fd64791..8cf52f7c6 100644 --- a/pkg/cli/deprecation.go +++ b/pkg/cli/deprecation.go @@ -458,7 +458,8 @@ func (h *http) deprecationNotice(logger zerolog.Logger) bool { } type experimental struct { - HTTP3 *bool `json:"http3,omitempty" toml:"http3,omitempty" yaml:"http3,omitempty"` + HTTP3 *bool `json:"http3,omitempty" toml:"http3,omitempty" yaml:"http3,omitempty"` + KubernetesGateway *bool `json:"kubernetesGateway,omitempty" toml:"kubernetesGateway,omitempty" yaml:"kubernetesGateway,omitempty"` } func (e *experimental) deprecationNotice(logger zerolog.Logger) bool { @@ -469,11 +470,17 @@ func (e *experimental) deprecationNotice(logger zerolog.Logger) bool { if e.HTTP3 != nil { logger.Error().Msg("HTTP3 is not an experimental feature in v3 and the associated enablement has been removed." + "Please remove its usage from the static configuration for Traefik to start." + - "For more information please read the migration guide: https://doc.traefik.io/traefik/v3.0/migration/v2-to-v3/#http3-experimental-configuration") + "For more information please read the migration guide: https://doc.traefik.io/traefik/v3.0/migration/v2-to-v3-details/#http3") return true } + if e.KubernetesGateway != nil { + logger.Error().Msg("KubernetesGateway provider is not an experimental feature starting with v3.1." + + "Please remove its usage from the static configuration." + + "For more information please read the migration guide: https://doc.traefik.io/traefik/v3.0/migration/v3/#gateway-api-kubernetesgateway-provider") + } + return false } diff --git a/pkg/cli/deprecation_test.go b/pkg/cli/deprecation_test.go index b33987024..556046b85 100644 --- a/pkg/cli/deprecation_test.go +++ b/pkg/cli/deprecation_test.go @@ -17,8 +17,9 @@ func ptr[T any](t T) *T { func TestDeprecationNotice(t *testing.T) { tests := []struct { - desc string - config configuration + desc string + config configuration + wantCompatible bool }{ { desc: "Docker provider swarmMode option is incompatible", @@ -196,6 +197,15 @@ func TestDeprecationNotice(t *testing.T) { }, }, }, + { + desc: "Experimental KubernetesGateway enablement configuration is compatible", + config: configuration{ + Experimental: &experimental{ + KubernetesGateway: ptr(true), + }, + }, + wantCompatible: true, + }, { desc: "Tracing SpanNameLimit option is incompatible", config: configuration{ @@ -278,7 +288,8 @@ func TestDeprecationNotice(t *testing.T) { }) logger := log.With().Logger().Hook(testHook) - assert.True(t, test.config.deprecationNotice(logger)) + + assert.Equal(t, !test.wantCompatible, test.config.deprecationNotice(logger)) assert.True(t, gotLog) assert.Equal(t, zerolog.ErrorLevel, gotLevel) }) diff --git a/pkg/config/static/experimental.go b/pkg/config/static/experimental.go index 7428f6a08..ecd18424d 100644 --- a/pkg/config/static/experimental.go +++ b/pkg/config/static/experimental.go @@ -7,5 +7,6 @@ type Experimental struct { Plugins map[string]plugins.Descriptor `description:"Plugins configuration." json:"plugins,omitempty" toml:"plugins,omitempty" yaml:"plugins,omitempty" export:"true"` LocalPlugins map[string]plugins.LocalDescriptor `description:"Local plugins configuration." json:"localPlugins,omitempty" toml:"localPlugins,omitempty" yaml:"localPlugins,omitempty" export:"true"` - KubernetesGateway bool `description:"Allow the Kubernetes gateway api provider usage." json:"kubernetesGateway,omitempty" toml:"kubernetesGateway,omitempty" yaml:"kubernetesGateway,omitempty" export:"true"` + // Deprecated: KubernetesGateway provider is not an experimental feature starting with v3.1. Please remove its usage from the static configuration. + KubernetesGateway bool `description:"(Deprecated) Allow the Kubernetes gateway api provider usage." json:"kubernetesGateway,omitempty" toml:"kubernetesGateway,omitempty" yaml:"kubernetesGateway,omitempty" export:"true"` }