Skip to content

Commit 79e3fb0

Browse files
committed
Noobaa/Backingstore : Need facility to change labels
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 <[email protected]>
1 parent 94c0b93 commit 79e3fb0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pkg/backingstore/reconciler.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,13 @@ func (r *Reconciler) needUpdate(pod *corev1.Pod) bool {
11691169
}
11701170
}
11711171

1172+
var pod_label = pod.Labels["backingstore"]
1173+
var bs_label = r.BackingStore.Labels["backingstore"]
1174+
if (bs_label != "") && (pod_label != bs_label) {
1175+
r.Logger.Warnf("Backingstore lable has been modified to (%v) and it is different from pod lable: (%v)", bs_label, pod_label)
1176+
return true
1177+
}
1178+
11721179
for _, name := range []string{"NOOBAA_LOG_LEVEL", "NOOBAA_LOG_COLOR"} {
11731180
configMapValue := r.CoreAppConfig.Data[name]
11741181
noobaaLogEnvVar := util.GetEnvVariable(&c.Env, name)
@@ -1305,10 +1312,15 @@ func (r *Reconciler) updatePodTemplate() error {
13051312
r.PodAgentTemplate.Spec.ImagePullSecrets =
13061313
[]corev1.LocalObjectReference{*r.NooBaa.Spec.ImagePullSecret}
13071314
}
1315+
1316+
var bs_label := r.BackingStore.Labels["backingstore"]
1317+
if bs_label == "" {
1318+
bs_label = "noobaa"
1319+
}
13081320
r.PodAgentTemplate.Labels = map[string]string{
13091321
"app": "noobaa",
13101322
"pool": r.BackingStore.Name,
1311-
"backingstore": "noobaa",
1323+
"backingstore": bs_label,
13121324
}
13131325
if r.NooBaa.Spec.Tolerations != nil {
13141326
r.PodAgentTemplate.Spec.Tolerations = r.NooBaa.Spec.Tolerations
@@ -1329,7 +1341,7 @@ func (r *Reconciler) updatePodTemplate() error {
13291341
NodeTaintsPolicy: &honor,
13301342
LabelSelector: &metav1.LabelSelector{
13311343
MatchLabels: map[string]string{
1332-
"backingstore": "noobaa",
1344+
"backingstore": bs_label,
13331345
},
13341346
},
13351347
}

0 commit comments

Comments
 (0)