diff --git a/pkg/config/dynamic/http_config.go b/pkg/config/dynamic/http_config.go index 97b08f5d6e..4eb866ba1b 100644 --- a/pkg/config/dynamic/http_config.go +++ b/pkg/config/dynamic/http_config.go @@ -9,6 +9,7 @@ import ( traefiktls "github.com/traefik/traefik/v3/pkg/tls" "github.com/traefik/traefik/v3/pkg/types" "google.golang.org/grpc/codes" + "k8s.io/utils/ptr" ) const ( @@ -357,8 +358,7 @@ func (l *ServersLoadBalancer) Mergeable(loadBalancer *ServersLoadBalancer) bool // SetDefaults Default values for a ServersLoadBalancer. func (l *ServersLoadBalancer) SetDefaults() { - defaultPassHostHeader := DefaultPassHostHeader - l.PassHostHeader = &defaultPassHostHeader + l.PassHostHeader = ptr.To(DefaultPassHostHeader) l.Strategy = BalancerStrategyWRR l.ResponseForwarding = &ResponseForwarding{} @@ -415,8 +415,7 @@ type ServerHealthCheck struct { // SetDefaults Default values for a HealthCheck. func (h *ServerHealthCheck) SetDefaults() { - fr := true - h.FollowRedirects = &fr + h.FollowRedirects = ptr.To(true) h.Mode = "http" h.Interval = DefaultHealthCheckInterval h.Timeout = DefaultHealthCheckTimeout diff --git a/pkg/config/static/entrypoints.go b/pkg/config/static/entrypoints.go index f76ce08dcb..28e3096e19 100644 --- a/pkg/config/static/entrypoints.go +++ b/pkg/config/static/entrypoints.go @@ -9,6 +9,7 @@ import ( ptypes "github.com/traefik/paerser/types" otypes "github.com/traefik/traefik/v3/pkg/observability/types" "github.com/traefik/traefik/v3/pkg/types" + "k8s.io/utils/ptr" ) // EntryPoint holds the entry point configuration. @@ -76,8 +77,7 @@ type HTTPConfig struct { // SetDefaults sets the default values. func (c *HTTPConfig) SetDefaults() { - sanitizePath := true - c.SanitizePath = &sanitizePath + c.SanitizePath = ptr.To(true) c.MaxHeaderBytes = http.DefaultMaxHeaderBytes } @@ -200,9 +200,8 @@ type ObservabilityConfig struct { // SetDefaults sets the default values. func (o *ObservabilityConfig) SetDefaults() { - defaultValue := true - o.AccessLogs = &defaultValue - o.Metrics = &defaultValue - o.Tracing = &defaultValue + o.AccessLogs = ptr.To(true) + o.Metrics = ptr.To(true) + o.Tracing = ptr.To(true) o.TraceVerbosity = otypes.MinimalVerbosity }