Skip to content

Commit

Permalink
Remove duplicate placements due to specifying with all & specific key
Browse files Browse the repository at this point in the history
Rook creates some rook-ceph daemon's placement by merging the "all" and
specific key placements. The OCS operator specifies the default OCS
tolerations and node affinity in both the "all" key and the specific key
leading to duplicated placements. To avoid this, skip specifying the
default OCS tolerations and node affinity with the specific key.

Signed-off-by: Malay Kumar Parida <[email protected]>
  • Loading branch information
malayparida2000 authored and openshift-cherrypick-robot committed Jan 29, 2025
1 parent efb257c commit a448739
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions controllers/defaults/placements.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,12 @@ var (
},

"osd": {
Tolerations: []corev1.Toleration{
getOcsToleration(),
},
TopologySpreadConstraints: []corev1.TopologySpreadConstraint{
getTopologySpreadConstraintsSpec(1, []string{osdLabelSelector}),
},
},

"osd-prepare": {
Tolerations: []corev1.Toleration{
getOcsToleration(),
},
TopologySpreadConstraints: []corev1.TopologySpreadConstraint{
getTopologySpreadConstraintsSpec(1, []string{osdLabelSelector, osdPrepareLabelSelector}),
},
Expand Down
5 changes: 4 additions & 1 deletion controllers/storagecluster/placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func getPlacement(sc *ocsv1.StorageCluster, component string) rookCephv1.Placeme
// StorageCluster has no label selector, set the default node
// affinity.
if placement.NodeAffinity == nil && sc.Spec.LabelSelector == nil {
placement.NodeAffinity = defaults.DefaultNodeAffinity
// Don't add node affinity again for these rook-ceph daemons as it is already added via the "all" key
if component != "mgr" && component != "mon" && component != "osd" && component != "osd-prepare" {
placement.NodeAffinity = defaults.DefaultNodeAffinity
}
}

// If the StorageCluster specifies a label selector, append it to the
Expand Down

0 comments on commit a448739

Please sign in to comment.