Skip to content

Commit 15f7a29

Browse files
authored
Merge pull request #1489 from aspandey/backingstore-labels
Noobaa/Backingstore : Need facility to change labels
2 parents 94c0b93 + 6d562a0 commit 15f7a29

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/backingstore/reconciler.go

Lines changed: 15 additions & 2 deletions
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,16 @@ func (r *Reconciler) updatePodTemplate() error {
13051312
r.PodAgentTemplate.Spec.ImagePullSecrets =
13061313
[]corev1.LocalObjectReference{*r.NooBaa.Spec.ImagePullSecret}
13071314
}
1315+
1316+
bs_label, ok := r.BackingStore.Labels["backingstore"]
1317+
if !ok || bs_label == "" {
1318+
bs_label = "noobaa"
1319+
}
1320+
13081321
r.PodAgentTemplate.Labels = map[string]string{
13091322
"app": "noobaa",
13101323
"pool": r.BackingStore.Name,
1311-
"backingstore": "noobaa",
1324+
"backingstore": bs_label,
13121325
}
13131326
if r.NooBaa.Spec.Tolerations != nil {
13141327
r.PodAgentTemplate.Spec.Tolerations = r.NooBaa.Spec.Tolerations
@@ -1329,7 +1342,7 @@ func (r *Reconciler) updatePodTemplate() error {
13291342
NodeTaintsPolicy: &honor,
13301343
LabelSelector: &metav1.LabelSelector{
13311344
MatchLabels: map[string]string{
1332-
"backingstore": "noobaa",
1345+
"backingstore": bs_label,
13331346
},
13341347
},
13351348
}

0 commit comments

Comments
 (0)