From cd2f1107475b86163c941112e78a134d4a0afcfe Mon Sep 17 00:00:00 2001 From: Chai Bot Date: Wed, 8 Jul 2026 11:07:54 +0000 Subject: [PATCH] Revert "MON-3697: use maximumStartupDurationSeconds instead of container patch" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts the changes from PR #2251. With maximumStartupDurationSeconds=3600, prometheus-operator sets PeriodSeconds=60s (instead of the previous 15s), which significantly slows down Prometheus pod restarts — especially in e2e tests where restarts are numerous. Additionally, UWM (User Workload Monitoring) Prometheus still uses the container patch approach, so reverting makes the two consistent. Co-Authored-By: Claude Opus 4.6 --- assets/prometheus-k8s/prometheus.yaml | 1 - jsonnet/components/prometheus.libsonnet | 4 ---- pkg/manifests/manifests.go | 9 ++++++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/assets/prometheus-k8s/prometheus.yaml b/assets/prometheus-k8s/prometheus.yaml index 8122de7e1c..f56fd96bc6 100644 --- a/assets/prometheus-k8s/prometheus.yaml +++ b/assets/prometheus-k8s/prometheus.yaml @@ -163,7 +163,6 @@ spec: externalURL: https://prometheus-k8s.openshift-monitoring.svc:9091 image: "" listenLocal: true - maximumStartupDurationSeconds: 3600 nodeSelector: kubernetes.io/os: linux podMetadata: diff --git a/jsonnet/components/prometheus.libsonnet b/jsonnet/components/prometheus.libsonnet index f7f93115a6..6050902471 100644 --- a/jsonnet/components/prometheus.libsonnet +++ b/jsonnet/components/prometheus.libsonnet @@ -415,10 +415,6 @@ function(params) value: '15ms', }, ], - // Increase the startup probe timeout to 1h from 15m to avoid restart - // failures when the WAL replay takes a long time. - // See https://issues.redhat.com/browse/OCPBUGS-4168 for details. - maximumStartupDurationSeconds: 3600, // Explicitly set the shards value to 1 to support VPA use cases. shards: 1, containers: [ diff --git a/pkg/manifests/manifests.go b/pkg/manifests/manifests.go index 9600be31c8..f1beb07b25 100644 --- a/pkg/manifests/manifests.go +++ b/pkg/manifests/manifests.go @@ -1519,6 +1519,12 @@ func (f *Factory) PrometheusK8s(grpcTLS *v1.Secret, telemetrySecret *v1.Secret) for i, container := range p.Spec.Containers { switch container.Name { case "prometheus": + // Increase the startup probe timeout to 1h from 15m to avoid restart failures when the WAL replay + // takes a long time. See https://issues.redhat.com/browse/OCPBUGS-4168 for details. + p.Spec.Containers[i].StartupProbe = &v1.Probe{ + PeriodSeconds: 15, + FailureThreshold: 240, + } // Inject the proxy env vars into the Prometheus container // Mainly intended for all configs that support proxyConfig.proxyFromEnvironment f.injectProxyVariables(&p.Spec.Containers[i]) @@ -1856,9 +1862,6 @@ func (f *Factory) PrometheusUserWorkload(grpcTLS *v1.Secret) (*monv1.Prometheus, case "prometheus": // Increase the startup probe timeout to 1h from 15m to avoid restart failures when the WAL replay // takes a long time. See https://issues.redhat.com/browse/OCPBUGS-4168 for details. - // TODO (JoaoBraveCoding): Once prometheus-operator adds CRD support to configure startupProbe directly - // we should use that instead of using strategic merge patch - // See https://github.com/prometheus-operator/prometheus-operator/issues/4730 p.Spec.Containers[i].StartupProbe = &v1.Probe{ PeriodSeconds: 15, FailureThreshold: 240,