Skip to content

Commit

Permalink
OCPBUGS-17346: Avoid recreating some resources, created by prometheus…
Browse files Browse the repository at this point in the history
…-operator, during 4.13->4.14 upgrade

The option --labels was set to the prometheus-operator in openshift#1986
to make it add the label "app.kubernetes.io/part-of: openshift-monitoring" to resources it creates.

prometheus-operator adds the labels to some controllers matchLabels as well (to the prometheus statefulset e.g.)
which makes the prometheus-operator recreate the statefulset as matchLabels is an immutable field.

Recreating the statefulset leads to downtime as the prometheus-operator run the deletion in a foreground mode, check
prometheus-operator/prometheus-operator#3875 for the whys.

We consider that adding the ownership labels is not worth the downtime, and we'll be thinking of a way to avoid it.

Of course, this will lead to the recreation of these resources if openshift#1986
is alredy deployed.
  • Loading branch information
machine424 committed Aug 7, 2023
1 parent cacb22c commit 00f26b1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 10 deletions.
1 change: 0 additions & 1 deletion assets/prometheus-operator-user-workload/deployment.yaml
Expand Up @@ -40,7 +40,6 @@ spec:
- --config-reloader-cpu-request=1m
- --config-reloader-memory-request=10Mi
- --web.listen-address=127.0.0.1:8080
- --labels=app.kubernetes.io/part-of=openshift-monitoring
image: quay.io/prometheus-operator/prometheus-operator:v0.67.1
name: prometheus-operator
ports: []
Expand Down
1 change: 0 additions & 1 deletion assets/prometheus-operator/deployment.yaml
Expand Up @@ -41,7 +41,6 @@ spec:
- --config-reloader-cpu-request=1m
- --config-reloader-memory-request=10Mi
- --web.listen-address=127.0.0.1:8080
- --labels=app.kubernetes.io/part-of=openshift-monitoring
image: quay.io/prometheus-operator/prometheus-operator:v0.67.1
name: prometheus-operator
ports: []
Expand Down
Expand Up @@ -3,7 +3,6 @@ local tlsVolumeName = 'prometheus-operator-user-workload-tls';
local operator = import 'github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus/components/prometheus-operator.libsonnet';
local generateSecret = import '../utils/generate-secret.libsonnet';
local rbac = import '../utils/rbac.libsonnet';
local labelsAsString = (import '../utils/add-labels.libsonnet').labelsAsString;

function(params)
local po = operator(params);
Expand Down Expand Up @@ -97,7 +96,6 @@ function(params)
'--config-reloader-cpu-request=1m',
'--config-reloader-memory-request=10Mi',
'--web.listen-address=127.0.0.1:8080',
'--labels=' + labelsAsString(params.commonLabels),
],
ports: [],
resources: {
Expand Down
2 changes: 0 additions & 2 deletions jsonnet/components/prometheus-operator.libsonnet
Expand Up @@ -5,7 +5,6 @@ local operator = import 'github.com/prometheus-operator/kube-prometheus/jsonnet/
local conversionWebhook = import 'github.com/prometheus-operator/prometheus-operator/jsonnet/prometheus-operator/conversion.libsonnet';
local generateSecret = import '../utils/generate-secret.libsonnet';
local rbac = import '../utils/rbac.libsonnet';
local labelsAsString = (import '../utils/add-labels.libsonnet').labelsAsString;

function(params)
local po = operator(params);
Expand Down Expand Up @@ -75,7 +74,6 @@ function(params)
'--config-reloader-cpu-request=1m',
'--config-reloader-memory-request=10Mi',
'--web.listen-address=127.0.0.1:8080',
'--labels=' + labelsAsString(params.commonLabels),
],
ports: [],
resources: {
Expand Down
4 changes: 0 additions & 4 deletions jsonnet/utils/add-labels.libsonnet
Expand Up @@ -12,8 +12,4 @@
[k]: o[k] + if o[k].kind != 'ConfigMapList' then { metadata+: { labels+: labels { 'app.kubernetes.io/managed-by': managedBy(o[k]) } } } else {}
for k in std.objectFields(o)
},

labelsAsString(o)::
local parts = [k + '=' + o[k] for k in std.objectFields(o)];
std.join(',', parts),
}

0 comments on commit 00f26b1

Please sign in to comment.