From 537c1e62c582186e54cd2b5b5f904f8a6f4a5c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Fri, 22 Nov 2024 18:16:59 +0100 Subject: [PATCH] rm-disable-compression: use pflag's MarkDeprecated One small downside of using MarkDeprecated is that pflag doesn't use our logr.Logger, so it is printed as pain text rather than the format specified in --logging-format. --- pkg/agent/config.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pkg/agent/config.go b/pkg/agent/config.go index f4bd471c..c2157155 100644 --- a/pkg/agent/config.go +++ b/pkg/agent/config.go @@ -167,10 +167,6 @@ type AgentCmdFlags struct { // Prometheus (--enable-metrics) enables the Prometheus metrics server. Prometheus bool - - // DisableCompression (--disable-compression) is deprecated and no longer - // has an effect. - DisableCompression bool } func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) { @@ -297,13 +293,15 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) { "Enables Prometheus metrics server on the agent (port: 8081).", ) + var dummy bool c.PersistentFlags().BoolVar( - &cfg.DisableCompression, + &dummy, "disable-compression", false, "Deprecated. No longer has an effect.", ) - c.PersistentFlags().MarkHidden("disable-compression") + c.PersistentFlags().MarkDeprecated("disable-compression", "no longer has an effect") + } type AuthMode string @@ -585,13 +583,6 @@ func ValidateAndCombineConfig(log logr.Logger, cfg Config, flags AgentCmdFlags) } } - // Validation of --disable-compression. - { - if flags.DisableCompression { - log.Info("The flag --disable-compression has been deprecated an no longer has any effect.") - } - } - // Validation of the config fields exclude_annotation_keys_regex and // exclude_label_keys_regex. {