KubernetesGateway provider out of experimental

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
Romain 2024-06-24 10:36:03 +02:00 committed by GitHub
parent 6d8407893d
commit 983940ae60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 53 additions and 8 deletions

View file

@ -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
}

View file

@ -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)
})