Skip to content

Commit 537c1e6

Browse files
committed
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.
1 parent 695b95c commit 537c1e6

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

pkg/agent/config.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ type AgentCmdFlags struct {
167167

168168
// Prometheus (--enable-metrics) enables the Prometheus metrics server.
169169
Prometheus bool
170-
171-
// DisableCompression (--disable-compression) is deprecated and no longer
172-
// has an effect.
173-
DisableCompression bool
174170
}
175171

176172
func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
@@ -297,13 +293,15 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) {
297293
"Enables Prometheus metrics server on the agent (port: 8081).",
298294
)
299295

296+
var dummy bool
300297
c.PersistentFlags().BoolVar(
301-
&cfg.DisableCompression,
298+
&dummy,
302299
"disable-compression",
303300
false,
304301
"Deprecated. No longer has an effect.",
305302
)
306-
c.PersistentFlags().MarkHidden("disable-compression")
303+
c.PersistentFlags().MarkDeprecated("disable-compression", "no longer has an effect")
304+
307305
}
308306

309307
type AuthMode string
@@ -585,13 +583,6 @@ func ValidateAndCombineConfig(log logr.Logger, cfg Config, flags AgentCmdFlags)
585583
}
586584
}
587585

588-
// Validation of --disable-compression.
589-
{
590-
if flags.DisableCompression {
591-
log.Info("The flag --disable-compression has been deprecated an no longer has any effect.")
592-
}
593-
}
594-
595586
// Validation of the config fields exclude_annotation_keys_regex and
596587
// exclude_label_keys_regex.
597588
{

0 commit comments

Comments
 (0)