1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 06:45:27 +01:00

feat: expose update strategy for workloads

This commit introduces a new `updateStrategy` field for
statefulset-based workloads (Prometheus, PrometheusAgent, Alertmanager
and ThanosRuler). While for now, there's a 1:1 mapping with StatefulSet
strategies, it paves the way to the introduction of custom strategies
which may be required to streamline operations in case of broken updates
(similar to the scenario explained in
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#forced-rollback).

Closes #5435

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier
2025-12-22 18:05:16 +01:00
parent ec1b4e5672
commit 19febac62b
38 changed files with 1519 additions and 14 deletions

View File

@@ -4877,6 +4877,31 @@ func testPrometheusCRDValidation(t *testing.T) {
},
},
},
{
name: "invalid-updateStrategy",
prometheusSpec: monitoringv1.PrometheusSpec{
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
Replicas: &replicas,
UpdateStrategy: &monitoringv1.StatefulSetUpdateStrategy{
Type: monitoringv1.StatefulSetUpdateStrategyType(""),
},
},
},
expectedError: true,
},
{
name: "invalid-ondelete-with-rollingupdate",
prometheusSpec: monitoringv1.PrometheusSpec{
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
Replicas: &replicas,
UpdateStrategy: &monitoringv1.StatefulSetUpdateStrategy{
Type: monitoringv1.OnDeleteStatefulSetStrategyType,
RollingUpdate: &monitoringv1.RollingUpdateStatefulSetStrategy{},
},
},
},
expectedError: true,
},
}
for _, test := range tests {