Repository: cloudnative-pg/cloudnative-pg

Issue:
[Test]: improve robustness of Operator Unavailable E2Es on Openshift
### Is there an existing issue already for this bug?

- [x] I have searched for an existing issue, and could not find anything. I believe this is a new bug.

### I have read the troubleshooting guide

- [x] I have read the troubleshooting guide and I think this is a new bug.

### I am running a supported version of CloudNativePG

- [x] I have read the troubleshooting guide and I think this is a new bug.

### Contact Details

_No response_

### Version

trunk (main)

### What version of Kubernetes are you using?

1.34

### What is your Kubernetes environment?

Other

### How did you install the operator?

OLM

### What happened?

In `test operator_unavailable_test.go`, we delete both the primary and the operator concurrently, and then we assert that once a new operator pod comes back, it is able to perform a "pending" failover.

The way we check for the operator to be back should be improved, because it can fail in OpenShift if there are other unrelated pods inside the `openshift-operators` namespace.

### Cluster resource

```shell

```

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Discussion:

Solution patch:
diff --git a/api/v1/cluster_funcs.go b/api/v1/cluster_funcs.go
index 2f29f956..cd1570de 100644
--- a/api/v1/cluster_funcs.go
+++ b/api/v1/cluster_funcs.go
@@ -1149,12 +1149,9 @@ func (cluster *Cluster) UsesSecret(secret string) bool {
 		return true
 	}
 
-	if cluster.Status.PoolerIntegrations != nil {
-		for _, pgBouncerSecretName := range cluster.Status.PoolerIntegrations.PgBouncerIntegration.Secrets {
-			if pgBouncerSecretName == secret {
-				return true
-			}
-		}
+	if cluster.Status.PoolerIntegrations != nil &&
+		slices.Contains(cluster.Status.PoolerIntegrations.PgBouncerIntegration.Secrets, secret) {
+		return true
 	}
 
 	// watch the secrets defined in external clusters
@@ -1198,15 +1195,14 @@ func (cluster *Cluster) GetEnableSuperuserAccess() bool {
 
 // LogTimestampsWithMessage prints useful information about timestamps in stdout
 func (cluster *Cluster) LogTimestampsWithMessage(ctx context.Context, logMessage string) {
-	contextLogger := log.FromContext(ctx)
-
 	currentTimestamp := pgTime.GetCurrentTimestamp()
-	keysAndValues := []interface{}{
+
+	contextLogger := log.FromContext(ctx).WithValues(
 		"phase", cluster.Status.Phase,
 		"currentTimestamp", currentTimestamp,
 		"targetPrimaryTimestamp", cluster.Status.TargetPrimaryTimestamp,
 		"currentPrimaryTimestamp", cluster.Status.CurrentPrimaryTimestamp,
-	}
+	)
 
 	var errs []string
 
@@ -1215,11 +1211,7 @@ func (cluster *Cluster) LogTimestampsWithMessage(ctx context.Context, logMessage
 		currentTimestamp,
 		cluster.Status.TargetPrimaryTimestamp,
 	); err == nil {
-		keysAndValues = append(
-			keysAndValues,
-			"msPassedSinceTargetPrimaryTimestamp",
-			diff.Milliseconds(),
-		)
+		contextLogger = contextLogger.WithValues("msPassedSinceTargetPrimaryTimestamp", diff.Milliseconds())
 	} else {
 		errs = append(errs, err.Error())
 	}
@@ -1229,9 +1221,7 @@ func (cluster *Cluster) LogTimestampsWithMessage(ctx context.Context, logMessage
 		currentTimestamp,
 		cluster.Status.CurrentPrimaryTimestamp,
 	); err == nil {
-		keysAndValues = append(
-			keysAndValues,
-			"msPassedSinceCurrentPrimaryTimestamp",
+		contextLogger = contextLogger.WithValues("msPassedSinceCurrentPrimaryTimestamp",
 			currentPrimaryDifference.Milliseconds(),
 		)
 	} else {
@@ -1246,8 +1236,7 @@ func (cluster *Cluster) LogTimestampsWithMessage(ctx context.Context, logMessage
 		cluster.Status.CurrentPrimaryTimestamp,
 		cluster.Status.TargetPrimaryTimestamp,
 	); err == nil {
-		keysAndValues = append(
-			keysAndValues,
+		contextLogger = contextLogger.WithValues(
 			"msDifferenceBetweenCurrentAndTargetPrimary",
 			currentPrimaryTargetDifference.Milliseconds(),
 		)
@@ -1256,10 +1245,10 @@ func (cluster *Cluster) LogTimestampsWithMessage(ctx context.Context, logMessage
 	}
 
 	if len(errs) > 0 {
-		keysAndValues = append(keysAndValues, "timestampParsingErrors", errs)
+		contextLogger = contextLogger.WithValues("timestampParsingErrors", errs)
 	}
 
-	contextLogger.Info(logMessage, keysAndValues...)
+	contextLogger.Info(logMessage)
 }
 
 // SetInheritedDataAndOwnership sets the cluster as owner of the passed object and then
diff --git a/config/crd/bases/postgresql.cnpg.io_clusters.yaml b/config/crd/bases/postgresql.cnpg.io_clusters.yaml
index 0da1379d..35928c2e 100644
--- a/config/crd/bases/postgresql.cnpg.io_clusters.yaml
+++ b/config/crd/bases/postgresql.cnpg.io_clusters.yaml
@@ -3855,7 +3855,7 @@ spec:
                         action:
                           default: replace
                           description: |-
-                            Action to perform based on the regex matching.
+                            action to perform based on the regex matching.
 
                             `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
                             `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
@@ -3887,41 +3887,41 @@ spec:
                           type: string
                         modulus:
                           description: |-
-                            Modulus to take of the hash of the source label values.
+                            modulus to take of the hash of the source label values.
 
                             Only applicable when the action is `HashMod`.
                           format: int64
                           type: integer
                         regex:
-                          description: Regular expression against which the extracted
-                            value is matched.
+                          description: regex defines the regular expression against
+                            which the extracted value is matched.
                           type: string
                         replacement:
                           description: |-
-                            Replacement value against which a Replace action is performed if the
+                            replacement value against which a Replace action is performed if the
                             regular expression matches.
 
                             Regex capture groups are available.
                           type: string
                         separator:
-                          description: Separator is the string between concatenated
+                          description: separator defines the string between concatenated
                             SourceLabels.
                           type: string
                         sourceLabels:
                           description: |-
-                            The source labels select values from existing labels. Their content is
+                            sourceLabels defines the source labels select values from existing labels. Their content is
                             concatenated using the configured Separator and matched against the
                             configured regular expression.
                           items:
                             description: |-
-                              LabelName is a valid Prometheus label name which may only contain ASCII
-                              letters, numbers, as well as underscores.
-                            pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
+                              LabelName is a valid Prometheus label name.
+                              For Prometheus 3.x, a label name is valid if it contains UTF-8 characters.
+                              For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.
                             type: string
                           type: array
                         targetLabel:
                           description: |-
-                            Label to which the resulting string is written in a replacement.
+                            targetLabel defines the label to which the resulting string is written in a replacement.
 
                             It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
                             `KeepEqual` and `DropEqual` actions.
@@ -3946,7 +3946,7 @@ spec:
                         action:
                           default: replace
                           description: |-
-                            Action to perform based on the regex matching.
+                            action to perform based on the regex matching.
 
                             `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
                             `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
@@ -3978,41 +3978,41 @@ spec:
                           type: string
                         modulus:
                           description: |-
-                            Modulus to take of the hash of the source label values.
+                            modulus to take of the hash of the source label values.
 
                             Only applicable when the action is `HashMod`.
                           format: int64
                           type: integer
                         regex:
-                          description: Regular expression against which the extracted
-                            value is matched.
+                          description: regex defines the regular expression against
+                            which the extracted value is matched.
                           type: string
                         replacement:
                           description: |-
-                            Replacement value against which a Replace action is performed if the
+                            replacement value against which a Replace action is performed if the
                             regular expression matches.
 
                             Regex capture groups are available.
                           type: string
                         separator:
-                          description: Separator is the string between concatenated
+                          description: separator defines the string between concatenated
                             SourceLabels.
                           type: string
                         sourceLabels:
                           description: |-
-                            The source labels select values from existing labels. Their content is
+                            sourceLabels defines the source labels select values from existing labels. Their content is
                             concatenated using the configured Separator and matched against the
                             configured regular expression.
                           items:
                             description: |-
-                              LabelName is a valid Prometheus label name which may only contain ASCII
-                              letters, numbers, as well as underscores.
-                            pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
+                              LabelName is a valid Prometheus label name.
+                              For Prometheus 3.x, a label name is valid if it contains UTF-8 characters.
+                              For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.
                             type: string
                           type: array
                         targetLabel:
                           description: |-
-                            Label to which the resulting string is written in a replacement.
+                            targetLabel defines the label to which the resulting string is written in a replacement.
 
                             It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
                             `KeepEqual` and `DropEqual` actions.
diff --git a/config/crd/bases/postgresql.cnpg.io_poolers.yaml b/config/crd/bases/postgresql.cnpg.io_poolers.yaml
index 61460156..bf5ff1b5 100644
--- a/config/crd/bases/postgresql.cnpg.io_poolers.yaml
+++ b/config/crd/bases/postgresql.cnpg.io_poolers.yaml
@@ -139,7 +139,7 @@ spec:
                         action:
                           default: replace
                           description: |-
-                            Action to perform based on the regex matching.
+                            action to perform based on the regex matching.
 
                             `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
                             `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
@@ -171,41 +171,41 @@ spec:
                           type: string
                         modulus:
                           description: |-
-                            Modulus to take of the hash of the source label values.
+                            modulus to take of the hash of the source label values.
 
                             Only applicable when the action is `HashMod`.
                           format: int64
                           type: integer
                         regex:
-                          description: Regular expression against which the extracted
-                            value is matched.
+                          description: regex defines the regular expression against
+                            which the extracted value is matched.
                           type: string
                         replacement:
                           description: |-
-                            Replacement value against which a Replace action is performed if the
+                            replacement value against which a Replace action is performed if the
                             regular expression matches.
 
                             Regex capture groups are available.
                           type: string
                         separator:
-                          description: Separator is the string between concatenated
+                          description: separator defines the string between concatenated
                             SourceLabels.
                           type: string
                         sourceLabels:
                           description: |-
-                            The source labels select values from existing labels. Their content is
+                            sourceLabels defines the source labels select values from existing labels. Their content is
                             concatenated using the configured Separator and matched against the
                             configured regular expression.
                           items:
                             description: |-
-                              LabelName is a valid Prometheus label name which may only contain ASCII
-                              letters, numbers, as well as underscores.
-                            pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
+                              LabelName is a valid Prometheus label name.
+                              For Prometheus 3.x, a label name is valid if it contains UTF-8 characters.
+                              For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.
                             type: string
                           type: array
                         targetLabel:
                           description: |-
-                            Label to which the resulting string is written in a replacement.
+                            targetLabel defines the label to which the resulting string is written in a replacement.
 
                             It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
                             `KeepEqual` and `DropEqual` actions.
@@ -227,7 +227,7 @@ spec:
                         action:
                           default: replace
                           description: |-
-                            Action to perform based on the regex matching.
+                            action to perform based on the regex matching.
 
                             `Uppercase` and `Lowercase` actions require Prometheus >= v2.36.0.
                             `DropEqual` and `KeepEqual` actions require Prometheus >= v2.41.0.
@@ -259,41 +259,41 @@ spec:
                           type: string
                         modulus:
                           description: |-
-                            Modulus to take of the hash of the source label values.
+                            modulus to take of the hash of the source label values.
 
                             Only applicable when the action is `HashMod`.
                           format: int64
                           type: integer
                         regex:
-                          description: Regular expression against which the extracted
-                            value is matched.
+                          description: regex defines the regular expression against
+                            which the extracted value is matched.
                           type: string
                         replacement:
                           description: |-
-                            Replacement value against which a Replace action is performed if the
+                            replacement value against which a Replace action is performed if the
                             regular expression matches.
 
                             Regex capture groups are available.
                           type: string
                         separator:
-                          description: Separator is the string between concatenated
+                          description: separator defines the string between concatenated
                             SourceLabels.
                           type: string
                         sourceLabels:
                           description: |-
-                            The source labels select values from existing labels. Their content is
+                            sourceLabels defines the source labels select values from existing labels. Their content is
                             concatenated using the configured Separator and matched against the
                             configured regular expression.
                           items:
                             description: |-
-                              LabelName is a valid Prometheus label name which may only contain ASCII
-                              letters, numbers, as well as underscores.
-                            pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
+                              LabelName is a valid Prometheus label name.
+                              For Prometheus 3.x, a label name is valid if it contains UTF-8 characters.
+                              For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.
                             type: string
                           type: array
                         targetLabel:
                           description: |-
-                            Label to which the resulting string is written in a replacement.
+                            targetLabel defines the label to which the resulting string is written in a replacement.
 
                             It is mandatory for `Replace`, `HashMod`, `Lowercase`, `Uppercase`,
                             `KeepEqual` and `DropEqual` actions.
diff --git a/go.mod b/go.mod
index 5b261039..66d82723 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
 	github.com/mitchellh/go-ps v1.0.0
 	github.com/onsi/ginkgo/v2 v2.26.0
 	github.com/onsi/gomega v1.38.2
-	github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.85.0
+	github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.86.1
 	github.com/prometheus/client_golang v1.23.2
 	github.com/robfig/cron v1.2.0
 	github.com/sethvargo/go-password v0.3.1
@@ -111,15 +111,15 @@ require (
 	github.com/x448/float16 v0.8.4 // indirect
 	github.com/xlab/treeprint v1.2.0 // indirect
 	go.uber.org/automaxprocs v1.6.0 // indirect
-	go.yaml.in/yaml/v2 v2.4.2 // indirect
+	go.yaml.in/yaml/v2 v2.4.3 // indirect
 	go.yaml.in/yaml/v3 v3.0.4 // indirect
-	golang.org/x/crypto v0.41.0 // indirect
+	golang.org/x/crypto v0.42.0 // indirect
 	golang.org/x/mod v0.27.0 // indirect
-	golang.org/x/net v0.43.0 // indirect
+	golang.org/x/net v0.44.0 // indirect
 	golang.org/x/oauth2 v0.30.0 // indirect
-	golang.org/x/sync v0.16.0 // indirect
+	golang.org/x/sync v0.17.0 // indirect
 	golang.org/x/sys v0.37.0 // indirect
-	golang.org/x/text v0.28.0 // indirect
+	golang.org/x/text v0.29.0 // indirect
 	golang.org/x/time v0.12.0 // indirect
 	golang.org/x/tools v0.36.0 // indirect
 	gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
diff --git a/go.sum b/go.sum
index 54897dec..2c3956a3 100644
--- a/go.sum
+++ b/go.sum
@@ -193,8 +193,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
 github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
-github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.85.0 h1:oY+F5FZFmCjCyzkHWPjVQpzvnvEB/0FP+iyzDUUlqFc=
-github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.85.0/go.mod h1:VB7wtBmDT6W2RJHzsvPZlBId+EnmeQA0d33fFTXvraM=
+github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.86.1 h1:j/GvU9UxlK5nuUKOWYOY0LRqcfHZl1ffTOa46+00Cys=
+github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.86.1/go.mod h1:nPk0OteXBkbT0CRCa2oZQL1jRLW6RJ2fuIijHypeJdk=
 github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
 github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
 github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
@@ -265,15 +265,15 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
 go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
 go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
 go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
-go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
-go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
+go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
+go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
 go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
 go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
-golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
+golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
+golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
@@ -282,15 +282,15 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
-golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
+golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
+golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
 golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
 golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
-golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
+golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
+golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -302,8 +302,8 @@ golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
 golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
-golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
+golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
+golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
 golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
 golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
diff --git a/internal/controller/backup_controller.go b/internal/controller/backup_controller.go
index f0d6c186..5ad58093 100644
--- a/internal/controller/backup_controller.go
+++ b/internal/controller/backup_controller.go
@@ -339,6 +339,13 @@ func (r *BackupReconciler) checkPrerequisites(
 		err := resourcestatus.FlagBackupAsFailed(ctx, r.Client, &backup, &cluster, errors.New(message))
 		return &ctrl.Result{}, err
 	}
+
+	if hibernation := cluster.Annotations[utils.HibernationAnnotationName]; hibernation ==
+		string(utils.HibernationAnnotationValueOn) {
+		const message = "cannot backup a hibernated cluster"
+		return flagMissingPrerequisite(message, "ClusterIsHibernated")
+	}
+
 	if backup.Spec.Method == apiv1.BackupMethodPlugin {
 		if len(cluster.Spec.Plugins) == 0 {
 			const message = "cannot proceed with the backup as the cluster has no plugin configured"



Test patch:
diff --git a/pkg/specs/podmonitor_test.go b/pkg/specs/podmonitor_test.go
index f6ddbe15..5018b3ed 100644
--- a/pkg/specs/podmonitor_test.go
+++ b/pkg/specs/podmonitor_test.go
@@ -158,18 +158,20 @@ var _ = Describe("PodMonitor test", func() {
 		expectedEndpoint := monitoringv1.PodMetricsEndpoint{
 			Port:   &metricsPort,
 			Scheme: "https",
-			TLSConfig: &monitoringv1.SafeTLSConfig{
-				CA: monitoringv1.SecretOrConfigMap{
-					Secret: &corev1.SecretKeySelector{
-						LocalObjectReference: corev1.LocalObjectReference{
-							Name: "test-ca",
+			HTTPConfig: monitoringv1.HTTPConfig{
+				TLSConfig: &monitoringv1.SafeTLSConfig{
+					CA: monitoringv1.SecretOrConfigMap{
+						Secret: &corev1.SecretKeySelector{
+							LocalObjectReference: corev1.LocalObjectReference{
+								Name: "test-ca",
+							},
+							Key: certs.CACertKey,
 						},
-						Key: certs.CACertKey,
 					},
+					Cert:               monitoringv1.SecretOrConfigMap{},
+					ServerName:         ptr.To(cluster.GetServiceReadWriteName()),
+					InsecureSkipVerify: ptr.To(true),
 				},
-				Cert:               monitoringv1.SecretOrConfigMap{},
-				ServerName:         ptr.To(cluster.GetServiceReadWriteName()),
-				InsecureSkipVerify: ptr.To(true),
 			},
 		}
 
diff --git a/tests/e2e/operator_unavailable_test.go b/tests/e2e/operator_unavailable_test.go
index 4b3b635c..ce09ed85 100644
--- a/tests/e2e/operator_unavailable_test.go
+++ b/tests/e2e/operator_unavailable_test.go
@@ -42,7 +42,7 @@ import (
 )
 
 // Set of tests in which we test the concurrent disruption of both the primary
-// and the operator podutils, asserting that the latter is able to perform a pending
+// and the operator pods, asserting that the latter is able to perform a pending
 // failover once a new operator pod comes back available.
 var _ = Describe("Operator unavailable", Serial, Label(tests.LabelDisruptive, tests.LabelOperator), func() {
 	const (
@@ -166,10 +166,8 @@ var _ = Describe("Operator unavailable", Serial, Label(tests.LabelDisruptive, te
 
 			By("deleting primary and operator pod", func() {
 				// Get operator pod name
-				podList := &corev1.PodList{}
-				err := env.Client.List(env.Ctx, podList, ctrlclient.InNamespace(operatorNamespace))
+				operatorPodName, err = operator.GetPodName(env.Ctx, env.Client)
 				Expect(err).ToNot(HaveOccurred())
-				operatorPodName = podList.Items[0].Name
 
 				// Force-delete the operator and the primary
 				quickDelete := &ctrlclient.DeleteOptions{
@@ -202,17 +200,15 @@ var _ = Describe("Operator unavailable", Serial, Label(tests.LabelDisruptive, te
 			})
 
 			By("verifying a new operator pod is now back", func() {
-				timeout := 120
+				timeout := 240
 				Eventually(func(g Gomega) {
-					podList := &corev1.PodList{}
-					err := env.Client.List(env.Ctx, podList, ctrlclient.InNamespace(operatorNamespace))
+					operatorPod, err := operator.GetPod(env.Ctx, env.Client)
 					g.Expect(err).ToNot(HaveOccurred())
-					g.Expect(podList.Items).To(HaveLen(1))
-					g.Expect(podList.Items[0].Name).NotTo(BeEquivalentTo(operatorPodName))
+					g.Expect(operatorPod.Name).NotTo(BeEquivalentTo(operatorPodName))
+					g.Expect(operator.IsReady(env.Ctx, env.Client, true)).To(BeTrue())
+					g.Expect(operator.PodRestarted(operatorPod)).To(BeFalse(),
+						"operator pod should not have any container restarts")
 				}, timeout).Should(Succeed())
-				Eventually(func() (bool, error) {
-					return operator.IsReady(env.Ctx, env.Client, true)
-				}, timeout).Should(BeTrue())
 			})
 
 			// Expect a new primary to be elected and promoted