fix: hash NicNodePolicy DaemonSet names - #3027
Conversation
Greptile SummaryThe PR centralizes the existing deterministic hash helper and uses hashed NicNodePolicy identities for OFED, RDMA shared-device-plugin, and SR-IOV device-plugin DaemonSet names while preserving NicClusterPolicy names.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the scope of the prior review thread. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
NCP[NicClusterPolicy] --> Existing[Existing DaemonSet names]
NNP[NicNodePolicy name] --> Hash[Deterministic policy-name hash]
Hash --> OFED[OFED DaemonSet suffix]
Hash --> RDMA[RDMA DaemonSet suffix]
Hash --> SRIOV[SR-IOV DaemonSet suffix]
NNP --> Readable[Readable policy suffix]
Readable --> ConfigMaps[Policy-specific ConfigMaps]
Readable --> Selector[RDMA app selector]
Reviews (3): Last reviewed commit: "fix: hash NicNodePolicy DaemonSet names" | Re-trigger Greptile |
| return strings.TrimRight(name[:validation.DNS1123LabelMaxLength], "-.") | ||
| } | ||
| return name | ||
| return fmt.Sprintf("%s-%s", sriovDpDaemonSetBaseName, getStringHash(cr.GetName())) |
There was a problem hiding this comment.
32-bit policy-name hash collisions
The 32-bit FNV hash makes distinct policy names capable of resolving to the same DaemonSet name. Such policies then reconcile one Kubernetes object and overwrite its specification and ds-owner label, preventing both device-plugin configurations from being deployed reliably; use a collision-resistant policy identity instead.
Knowledge Base Used: NicClusterPolicy Reconcile Flow
There was a problem hiding this comment.
This intentionally reuses the existing OFED getStringHash mechanism, so the policy-name suffix has the same collision profile as current OFED DaemonSet naming. The amended change centralizes that existing helper and applies it consistently to both SR-IOV and RDMA shared device plugin DaemonSets. Replacing the algorithm itself would also rename existing OFED DaemonSets and needs separate migration semantics, so it is outside this targeted follow-up.
There was a problem hiding this comment.
Fair point — the collision risk here is no worse than what already exists for OFED DaemonSet names, and this PR's goal is consistency rather than algorithm improvement. Fixing the underlying hash is a separate concern that warrants its own migration story.
Shall I remember this as a rule: "do not flag getStringHash collision risk on SR-IOV or RDMA DaemonSet names — the algorithm intentionally matches the existing OFED naming scheme and changing it requires separate migration semantics"?
559d89d to
c661295
Compare
|
Expanded the change in amended commit
Verified with |
Use one deterministic policy-name hash suffix for NicNodePolicy-owned OFED, RDMA shared device plugin, and SR-IOV device plugin DaemonSets. This keeps their names bounded and consistent while preserving readable ownership, ConfigMap names, and RDMA selector labels. Signed-off-by: Alexander Maslennikov <amaslennikov@nvidia.com>
c661295 to
45bedbf
Compare
|
Unified all three naming paths in amended commit
Verified with |
|
/retest-nic_operator_helm |
Summary
mofed-<os>-<kernel-hash>-<policy-name-hash>-dsrdma-shared-dp-ds-<policy-name-hash>network-operator-sriov-device-plugin-<policy-name-hash>ds-ownervalues, policy-specific ConfigMap names, and the RDMAappselector used by SOS report discoveryThis is a follow-up to #3019 and replaces direct policy-name suffixes in NicNodePolicy-owned DaemonSet names.
Verification
CGO_ENABLED=0 go build ./...CGO_ENABLED=0 go test ./pkg/state/... -count=1CGO_ENABLED=0 make lintbash -n scripts/sosreport/generate-maps.sh scripts/sosreport/kubectl-netop_sosreport scripts/sosreport/test-sosreport.shnvidia.com/ofed-driver=rdma-shared-dp-dswith selectorapp=rdma-shared-dp__NAME_SUFFIX__