Skip to content

Commit

Permalink
Clear the affinity on Noobaa if it was set previously to handle upgrades
Browse files Browse the repository at this point in the history
We are adding affinity to Noobaa if not in noobaa-standalone mode or
if placement is specified. But we are not clearing the affinity if
the affinity was set previously. This is breaking upgrade.

Signed-off-by: Malay Kumar Parida <[email protected]>
  • Loading branch information
malayparida2000 authored and openshift-cherrypick-robot committed Oct 15, 2024
1 parent 281a035 commit 78d39b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/storagecluster/noobaa_system_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ func (r *StorageClusterReconciler) setNooBaaDesiredState(nb *nbv1.NooBaa, sc *oc
placement := getPlacement(sc, component)

nb.Spec.Tolerations = placement.Tolerations
// if we are "noobaa-standalone" and placement is not set - don't set affinity

if !r.IsNoobaaStandalone || ok {
// Add affinity if not in noobaa-standalone mode or if placement is specified
nb.Spec.Affinity = &corev1.Affinity{NodeAffinity: placement.NodeAffinity}
} else if nb.Spec.Affinity != nil {
// Clear the affinity if it was set previously to handle upgrades
nb.Spec.Affinity = nil
}

nb.Spec.DBVolumeResources = &corev1.VolumeResourceRequirements{
Limits: dBVolumeResources.Limits,
Requests: dBVolumeResources.Requests,
Expand Down

0 comments on commit 78d39b7

Please sign in to comment.