diff --git a/cmd/adapter/adapter.go b/cmd/adapter/adapter.go index 96c94cd39..160c88f6b 100644 --- a/cmd/adapter/adapter.go +++ b/cmd/adapter/adapter.go @@ -239,7 +239,6 @@ func main() { cmd := &PrometheusAdapter{ PrometheusURL: "https://localhost", MetricsRelistInterval: 10 * time.Minute, - MetricsMaxAge: 20 * time.Minute, } cmd.Name = "prometheus-metrics-adapter" cmd.addFlags() @@ -248,6 +247,11 @@ func main() { klog.Fatalf("unable to parse flags: %v", err) } + // if --metrics-max-age is not set, make it equal to --metrics-relist-interval + if cmd.MetricsMaxAge == 0*time.Second { + cmd.MetricsMaxAge = cmd.MetricsRelistInterval + } + // make the prometheus client promClient, err := cmd.makePromClient() if err != nil {