diff --git a/Documentation/platform/operator.md b/Documentation/platform/operator.md index 8bad06ebc..e503fff78 100644 --- a/Documentation/platform/operator.md +++ b/Documentation/platform/operator.md @@ -52,7 +52,7 @@ Usage of ./operator: -disable-unmanaged-prometheus-configuration Disable support for unmanaged Prometheus configuration when all resource selectors are nil. As stated in the API documentation, unmanaged Prometheus configuration is a deprecated feature which can be avoided with '.spec.additionalScrapeConfigs' or the ScrapeConfig CRD. Default: false. -enable-config-reloader-probes - Enable liveness and readiness for the config-reloader container. Default: false + Enable liveness, readiness, and startup probes for the config-reloader container. Default: false -feature-gates value Feature gates are a set of key=value pairs that describe Prometheus-Operator features. Available feature gates: diff --git a/cmd/operator/main.go b/cmd/operator/main.go index 4547f4bcb..2eb970312 100644 --- a/cmd/operator/main.go +++ b/cmd/operator/main.go @@ -155,7 +155,7 @@ func parseFlags(fs *flag.FlagSet) { fs.Var(&cfg.ReloaderConfig.CPULimits, "config-reloader-cpu-limit", "Config Reloader CPU limits. Value \"0\" disables it and causes no limit to be configured.") fs.Var(&cfg.ReloaderConfig.MemoryRequests, "config-reloader-memory-request", "Config Reloader memory requests. Value \"0\" disables it and causes no request to be configured.") fs.Var(&cfg.ReloaderConfig.MemoryLimits, "config-reloader-memory-limit", "Config Reloader memory limits. Value \"0\" disables it and causes no limit to be configured.") - fs.BoolVar(&cfg.ReloaderConfig.EnableProbes, "enable-config-reloader-probes", false, "Enable liveness and readiness for the config-reloader container. Default: false") + fs.BoolVar(&cfg.ReloaderConfig.EnableProbes, "enable-config-reloader-probes", false, "Enable liveness, readiness, and startup probes for the config-reloader container. Default: false") fs.StringVar(&cfg.AlertmanagerDefaultBaseImage, "alertmanager-default-base-image", operator.DefaultAlertmanagerBaseImage, "Alertmanager default base image (path without tag/version)") fs.StringVar(&cfg.PrometheusDefaultBaseImage, "prometheus-default-base-image", operator.DefaultPrometheusBaseImage, "Prometheus default base image (path without tag/version)") diff --git a/pkg/operator/config_reloader.go b/pkg/operator/config_reloader.go index 43711f856..312660577 100644 --- a/pkg/operator/config_reloader.go +++ b/pkg/operator/config_reloader.go @@ -337,6 +337,7 @@ func (cr *ConfigReloader) addProbes(c v1.Container) v1.Container { c.LivenessProbe = &v1.Probe{ProbeHandler: handler} c.ReadinessProbe = &v1.Probe{ProbeHandler: handler} + c.StartupProbe = &v1.Probe{ProbeHandler: handler} return c } diff --git a/pkg/operator/config_reloader_test.go b/pkg/operator/config_reloader_test.go index 817c7ebb0..1c24fe687 100644 --- a/pkg/operator/config_reloader_test.go +++ b/pkg/operator/config_reloader_test.go @@ -60,6 +60,10 @@ func TestCreateConfigReloaderEnableProbes(t *testing.T) { if container.ReadinessProbe == nil { t.Errorf("expected ReadinessProbe but got none") } + + if container.StartupProbe == nil { + t.Errorf("expected StartupProbe but got none") + } } func TestCreateInitConfigReloaderEnableProbes(t *testing.T) { @@ -88,6 +92,10 @@ func TestCreateInitConfigReloaderEnableProbes(t *testing.T) { if container.ReadinessProbe != nil { t.Errorf("expected no ReadinessProbe but got %v", container.ReadinessProbe) } + + if container.StartupProbe != nil { + t.Errorf("expected no StartupProbe but got %v", container.StartupProbe) + } } func TestCreateInitConfigReloader(t *testing.T) { @@ -134,6 +142,10 @@ func TestCreateInitConfigReloader(t *testing.T) { if container.ReadinessProbe != nil { t.Errorf("expected no ReadinessProbe but got %v", container.ReadinessProbe) } + + if container.StartupProbe != nil { + t.Errorf("expected no StartupProbe but got %v", container.StartupProbe) + } } func TestCreateConfigReloader(t *testing.T) { @@ -217,6 +229,10 @@ func TestCreateConfigReloader(t *testing.T) { if container.ReadinessProbe != nil { t.Errorf("expected no ReadinessProbe but got %v", container.ReadinessProbe) } + + if container.StartupProbe != nil { + t.Errorf("expected no StartupProbe but got %v", container.StartupProbe) + } } func TestCreateConfigReloaderForDaemonSet(t *testing.T) {