Skip to content

Commit

Permalink
rm-disable-compression: use pflag's MarkDeprecated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maelvls committed Nov 22, 2024
1 parent 695b95c commit 537c1e6
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions pkg/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
{
Expand Down

0 comments on commit 537c1e6

Please sign in to comment.