Fix nodePlugin affinity not propagating from OperatorConfig to DaemonSet#388
Fix nodePlugin affinity not propagating from OperatorConfig to DaemonSet#388
Conversation
545388d to
c5cc325
Compare
Rook creates Driver CRs with a non-nil but empty Affinity struct. The merge logic only checked if Affinity == nil, so the affinity from OperatorConfig.driverSpecDefaults was never applied. Add isAffinityEmpty() helper to check for nil or effectively empty affinity structs, allowing the merge to properly fill in defaults. Signed-off-by: ksc98 <kylechang96@gmail.com>
c5cc325 to
611400f
Compare
|
@ksc98 can we please fix this in Rook to keep it nil if it does not need to be set? |
I can definitely raise a PR there instead. Thanks for taking a look! |
|
Hi @Madhu-1, just wanted to let you know that the issue I'm describing was actually fixed in this PR (#346), which unfortunately landed just one week after the v0.4.1 (current) release!
So all set here, nothing needed besides my waiting for the next release :P |
Describe what this PR does
When using the ceph-csi-operator with Rook, node affinity configured in the OperatorConfig's
driverSpecDefaults.nodePlugin.affinityis ignored.The CSI nodeplugin DaemonSet runs on all nodes regardless of the configured affinity rules.
Root cause: Rook's operator creates Driver CRs with a non-nil but empty
Affinitystruct:The mergeDriverSpecs() function only checks if
dest.Affinity == nilbefore merging defaults from OperatorConfig. Since the Affinity pointer is an empty struct (never nil!), the merge never happens.Example Scenario
In my cluster, there are some nodes that won't ever run pods that need Ceph PVCs. If we don't run a DaemonSet on these nodes, we can free up some requests, which is especially beneficial for smaller nodes.
Is there anything that requires special attention
Do you have any questions?
Is the change backward compatible?
Are there concerns around backward compatibility?
Provide any external context for the change, if any.
For example:
Related issues
Mention any github issues relevant to this PR. Adding below line
will help to auto close the issue once the PR is merged.
Fixes: #issue_number
Future concerns
List items that are not part of the PR and do not impact it's
functionality, but are work items that can be taken up subsequently.
Checklist:
guidelines in the developer
guide.
Request
notes
updated with breaking and/or notable changes for the next major release.