Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aspandey
Copy link
Contributor

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

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
Copy link
Member

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"]
Copy link
Member

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
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"backingstore": bs_label,
"pvbackingstore": bs_label,

wdyt? Can we change the label name to pvbackingstore ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants