Skip to content

compute-domain: only prepare daemon claims from driver namespaces - #1650

Open
shivamerla wants to merge 1 commit into
kubernetes-sigs:mainfrom
shivamerla:fix/cd-daemon-claim-namespace
Open

shivamerla wants to merge 1 commit into
kubernetes-sigs:mainfrom
shivamerla:fix/cd-daemon-claim-namespace

Conversation

@shivamerla

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

The plugin now rejects daemon claims outside NAMESPACE and ADDITIONAL_NAMESPACES. The webhook rejects ComputeDomainDaemonConfig outside them. The chart passes the controller's ADDITIONAL_NAMESPACES to both.

Which issue(s) this PR is related to:

Fixes #1648

Special notes for your reviewer:

  • ADDITIONAL_NAMESPACES lists old driver namespaces from upgrades that may still run ComputeDomain daemons. Accepting them keeps those daemons working across an upgrade.

Does this PR introduce a user-facing change?

The ComputeDomain kubelet plugin and webhook now accept ComputeDomain daemon claims only in the driver namespace and the namespaces in the controller's ADDITIONAL_NAMESPACES.

Additional documentation (design docs, usage docs, etc.):


Checklist

  • make check test passes locally
  • make check-generate passes if api/ changed (CRDs, deepcopy, informers, listers, clientset)
  • make check-modules passes if go.mod / go.sum changed
  • Tests added or updated for the change
  • Helm chart (deployments/helm) updated if flags, RBAC, or defaults changed

The plugin now rejects daemon claims outside NAMESPACE and
ADDITIONAL_NAMESPACES. The webhook rejects ComputeDomainDaemonConfig
outside them. The chart passes the controller's ADDITIONAL_NAMESPACES
to both.
@kubernetes-prow kubernetes-prow Bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 22, 2026
@kubernetes-prow kubernetes-prow Bot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 22, 2026
@netlify

netlify Bot commented Nov 22, 2026

Copy link
Copy Markdown

👷 Deploy request for dra-driver-nvidia-gpu pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f54f67a

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 22, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shivamerla

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The kubelet plugin and webhook now restrict daemon claims and ComputeDomainDaemonConfig requests to the driver namespace and configured additional namespaces. Helm passes additional namespace settings to both components. The kubelet plugin returns a permanent error for a claim outside the allowed namespaces. The webhook rejects an out-of-allowlist request when its namespace allowlist is configured.

Fixed issue severity: <fixed_issue_severity>Low</fixed_issue_severity>

Merge Risk: Low · up to f54f6

The change restricts daemon claims to the driver namespace and the configured additional namespaces. Standard installs should see no change. Two edge cases remain: a disallowed claim can receive a retryable overlap error before the permanent namespace error, and an already-completed claim in a namespace removed from the allowlist keeps its cached success after a plugin restart. Both are low impact and can be addressed in a follow-up.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #1648 has one active direct link. Its coding requirements are: (1) kubelet plugin reads ADDITIONAL_NAMESPACES and rejects daemon claims outside NAMESPACE and that list with a permanent Prepare e… Provide readable diffs or file blobs for cmd/webhook/main.go, cmd/webhook/main_test.go, and the Helm templates (_helpers.tpl, kubeletplugin.yaml, webhook-deployment.yaml) at the reviewed head. Confirm that the webhook rejects ComputeDomainD…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: ComputeDomain daemon claims are prepared only when they come from driver namespaces. The raw summary shows the kubelet plugin now rejects daemon claims outside the con…
Description check Passed The description states that the kubelet plugin and webhook now reject daemon claims outside NAMESPACE and ADDITIONAL_NAMESPACES, that the chart passes the controller's ADDITIONAL_NAMESPACES to both, a…
Out of Scope Changes check Passed All changes map to the requirements of #1648. The device_state.go diff adds only the namespace guard, its helper, and the matching tests. The change summaries describe the remaining changes as the web…
Full details: Title check

Explanation

The title names the main change: ComputeDomain daemon claims are prepared only when they come from driver namespaces. The raw summary shows the kubelet plugin now rejects daemon claims outside the configured driver namespace and additional namespaces, which matches the title. The title does not mention the webhook or Helm chart changes, but it does not need to cover every detail.

Full details: Description check

Explanation

The description states that the kubelet plugin and webhook now reject daemon claims outside NAMESPACE and ADDITIONAL_NAMESPACES, that the chart passes the controller's ADDITIONAL_NAMESPACES to both, and that it fixes issue #1648. This relates directly to the changeset, which touches the plugin, webhook, tests, and Helm templates.

Full details: Out of Scope Changes check

Explanation

All changes map to the requirements of #1648. The device_state.go diff adds only the namespace guard, its helper, and the matching tests. The change summaries describe the remaining changes as the webhook namespace options and validation, the webhook tests, the plugin flag, and the Helm wiring for the same two variables. No change in the summaries touches unrelated behavior. The release note matches the plugin and webhook behavior. The alternatives in the issue (ResourceQuota, separate admission policy) are not implemented, which is correct because they are not requested scope.

The webhook and Helm conclusions rely on summaries, because the webhook diff could not be read. This limits the check, but no unrelated change is shown.

Full details: Linked Issues check

Explanation

Issue #1648 has one active direct link. Its coding requirements are: (1) kubelet plugin reads ADDITIONAL_NAMESPACES and rejects daemon claims outside NAMESPACE and that list with a permanent Prepare error; (2) webhook rejects ComputeDomainDaemonConfig outside those namespaces; (3) Helm passes the controller's ADDITIONAL_NAMESPACES to the plugin and the webhook.

Requirement (1) is verified in source. The diff of cmd/compute-domain-kubelet-plugin/device_state.go adds assertDaemonClaimNamespace. It allows a non-empty namespace equal to s.config.flags.namespace or to a trimmed entry of s.config.flags.additionalNamespaces. applyComputeDomainDaemonConfig calls it and wraps the error in permanentError. The flag source is the --additional-namespaces flag and ADDITIONAL_NAMESPACES env var, per the change summary of cmd/compute-domain-kubelet-plugin/main.go.

Requirements (2) and (3) rest on the change summaries only. The diff for cmd/webhook/main.go could not be read: the changed blobs are missing from the checkout. The webhook behavior (allowlist from NAMESPACE and ADDITIONAL_NAMESPACES, rejection with a validation message), the _helpers.tpl additionalNamespaces helper, kubeletplugin.yaml, and webhook-deployment.yaml are therefore unverified in source. The webhook test additions are also unverified.

The chart and webhook code paths are not confirmed. Issue text and the PR description state no behavior change for standard installs; this was not checked against the controller code.

Resolution

Provide readable diffs or file blobs for cmd/webhook/main.go, cmd/webhook/main_test.go, and the Helm templates (_helpers.tpl, kubeletplugin.yaml, webhook-deployment.yaml) at the reviewed head. Confirm that the webhook rejects ComputeDomainDaemonConfig when the request namespace is not in NAMESPACE plus ADDITIONAL_NAMESPACES, and that the chart sets both variables on the webhook and the kubelet plugin.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 2

cmd/compute-domain-kubelet-plugin/device_state.go: 2

782-783: Minor · Functional Correctness · Quick win

Check daemon namespaces before the overlap check in Prepare.

Prepare runs validateNoOverlappingPreparedDevices (device_state.go:226) before applyPreparePlan reaches the namespace guard in applyComputeDomainDaemonConfig (device_state.go:782). The overlap error is not permanent, so the driver retries it. A claim outside NAMESPACE and ADDITIONAL_NAMESPACES that requests a daemon device held by a completed non-admin claim can get a retryable error first. It gets the required permanent namespace error only after the overlapping checkpoint entry clears. If that entry does not clear, the claim does not get the permanent error.

Run the daemon namespace check in preflight, before the overlap check. Keep the overlap error retryable for allowed claims. Add a regression test that calls Prepare, not only applyComputeDomainDaemonConfig. The exact placement depends on how daemon configs are identified in buildPreparePlan, so this is stated as required behavior rather than a patch.


782-782: Minor · Functional Correctness · Low value

Apply the namespace allowlist to completed daemon claims after a plugin restart.

Prepare returns cached devices for a PrepareCompleted claim before buildPreparePlan runs the daemon namespace check. A same-boot restart keeps that checkpoint. If a completed daemon claim's namespace is removed from ADDITIONAL_NAMESPACES, Prepare still returns success for that claim, so the new restriction does not apply to it.

The impact is limited. The claim was admitted while its namespace was allowed. The cached response returns devices that were already prepared, and it grants no new devices or access.

Choose and document how completed claims in disallowed namespaces are handled, either a permanent error or retention until Unprepare. Keep cached success for claims in allowed namespaces. Add a restart regression test that covers a completed daemon claim whose namespace is no longer allowed.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 44cf296 and f54f67a.

Files selected for processing: 8

  • cmd/compute-domain-kubelet-plugin/device_state.go
  • cmd/compute-domain-kubelet-plugin/device_state_test.go
  • cmd/compute-domain-kubelet-plugin/main.go
  • cmd/webhook/main.go
  • cmd/webhook/main_test.go
  • deployments/helm/dra-driver-nvidia-gpu/templates/_helpers.tpl
  • deployments/helm/dra-driver-nvidia-gpu/templates/kubeletplugin.yaml
  • deployments/helm/dra-driver-nvidia-gpu/templates/webhook-deployment.yaml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Feature]: ComputeDomain: only accept daemon claims from the driver namespaces

1 participant