-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Noobaa/Backingstore : Need facility to change labels #1489
base: master
Are you sure you want to change the base?
Conversation
We need to allow to modify the matchLabel of topologySpreadConstraints for noobaa's backingstore pods. https://issues.redhat.com/browse/DFBUGS-277 Signed-off-by: Ashish Pandey <aspandey@redhat.com>
@@ -2,4 +2,6 @@ apiVersion: noobaa.io/v1alpha1 | |||
kind: BackingStore | |||
metadata: | |||
name: default | |||
labels: | |||
backingstore: noobaa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid setting a default label for the BackingStore. Instead, users should have the flexibility to add the label as needed.
@@ -1169,6 +1169,12 @@ func (r *Reconciler) needUpdate(pod *corev1.Pod) bool { | |||
} | |||
} | |||
|
|||
var pod_label = pod.Labels["backingstore"] | |||
var bs_label = r.BackingStore.Labels["backingstore"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and we can check here if label is provided in backingstore then we will update the label in pv-pods.
var pod_label = pod.Labels["backingstore"] | ||
var bs_label = r.BackingStore.Labels["backingstore"] | ||
if pod_label != bs_label { | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should log a warn msg here if the label is updated
@@ -1329,7 +1337,7 @@ func (r *Reconciler) updatePodTemplate() error { | |||
NodeTaintsPolicy: &honor, | |||
LabelSelector: &metav1.LabelSelector{ | |||
MatchLabels: map[string]string{ | |||
"backingstore": "noobaa", | |||
"backingstore": bs_label, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"backingstore": bs_label, | |
"pvbackingstore": bs_label, |
wdyt? Can we change the label name to pvbackingstore
?
We need to allow to modify the matchLabel of
topologySpreadConstraints for noobaa's backingstore pods.
https://issues.redhat.com/browse/DFBUGS-277
Testing -
1 - Create a backing store.
2 - Check the label for backingstore and also the pod
kubectl get backingstore my-backingstore -o yaml
kubectl describe pod my-backingstore-noobaa-pod-c2348d65
3 -
Change the label of a backingstore object like this -
kubectl label backingstore my-backingstore backingstore=noobaa-new --overwrite
This will trigger the reconciliation and the pod will be reinitialize and now have a "backingstore=noobaa-new" as label