Repository navigation
fix: preserve node-labeller labels with custom selectors - #676
Open
yansun1996 wants to merge 3 commits into
Open
yansun1996 wants to merge 3 commits into
yansun1996 wants to merge 3 commits into
Conversation
Signed-off-by: yansun1996 <Yan.Sun3@amd.com>
Signed-off-by: yansun1996 <Yan.Sun3@amd.com>
Signed-off-by: yansun1996 <Yan.Sun3@amd.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A GPU node selected by a custom DeviceConfig selector can lack both AMD NFD discovery labels. With driver management disabled, the operator currently schedules the node labeller and then deletes its valid GPU labels during cleanup.
Prevent this deletion in both single- and multi-DeviceConfig deployments:
feature.node.kubernetes.io/amd-gpuorfeature.node.kubernetes.io/amd-vgpu.nodeAssignments. Namespace and name identify a config; disabled/deleting configs retain responsibility for their own cleanup. If listing configs fails, preserve the candidate whose ownership could not be checked and return an error for retry.kmm.watch=false; cleanup failures keep that finalizer for retry.Fixes #665. The labeller dependency upgrade in ROCm/k8s-device-plugin#255 is a separate fix.
Validation:
make unit-test.make unit-testpassed on this ROCm branch, includinggo vet ./.... Full lint reports the existingcmd/prepareimage/main.go:61unuseduseSourceImagefield, which this PR does not modify. Lint restricted to changes frompublic/mainpasses.node-labellerchunk (make -C tests/e2e chunk-node-labeller). The file is now03_node_labeller_test.go, placing it after driver-install chunks and before slower feature suites. Build, unit-test, and other public checks passed at the previous head0c296b8f. The matching internal simulation run failed before reaching the labeller chunk, so the selector-transition assertions still require a fresh CI run.The e2e cases use synthetic unschedulable Node objects with the real deployed controller and API watches. They test operator cleanup, not GPU hardware discovery or the labeller binary.
NFD and selector behavior matrix
The deciding factor is whether the node actually has an AMD NFD discovery label, not who installed NFD.
Assumptions: the node labeller is enabled,
driver.enable=false(as reported in #665), and the node matches any custom selector constraints. An installed, working AMD NFD rule labels the GPU node; without the rule, the node has neitherfeature.node.kubernetes.io/amd-gpunorfeature.node.kubernetes.io/amd-vgpu.¹ If no nodes match the DeviceConfig's NFD selector, reconciliation stops before labeller handling. If some nodes still match, reconciliation proceeds and can clean stale labels from other nodes missing both AMD discovery labels, subject to the remaining selector constraints. With this PR, nodes matching another DeviceConfig’s selector are excluded from that cleanup.
Additional distinctions:
installdefaultNFDRulecontrols that separately.driver.enable=true, existing KMM readiness labels provide additional protection against cleanup.The failing combination is a custom selector plus missing AMD NFD labels. Both the custom config itself and any coexisting NFD-based config must preserve that node's labels.
Coexisting DeviceConfigs
Why retain automatic cleanup?
Removing the NFD-based cleanup block while keeping explicit disable/delete cleanup is a possible alternative, but changes stale-label behavior when a node stops being selected. The current labeller removes old keys before writing startup-generated labels; it ignores node Update/Delete events and has no shutdown cleanup. Its refresh logic does not replace lifecycle cleanup. This PR retains that behavior while preventing deletion of custom-selected or other-config-selected nodes. Ownership reads use the controller cache; the Node resource-version precondition protects concurrent Node changes, but does not make Node and DeviceConfig changes a single atomic transaction.
Review clarifications
nilfor an ineligible node exits only theRetryOnConflictcallback; the outer node loop continues. The new ordered two-node regressions verify this directly, including failure and conflict cases.Cross-validation: six deliberately broken variants were rejected by regression tests (whole-loop early exit, namespace-filtered watch, locking explicit cleanup, unlocking automatic cleanup, ignoring other-config ownership, and collection DELETE). These checks used temporary Go overlays; no broken variant was committed.