Skip to content

fix(cni): forward DEL to host-device delegated plugin#244

Merged
privateip merged 1 commit into
mainfrom
fix/issue-238
Jul 17, 2026
Merged

fix(cni): forward DEL to host-device delegated plugin#244
privateip merged 1 commit into
mainfrom
fix/issue-238

Conversation

@privateip

Copy link
Copy Markdown
Contributor

Problem

cmdDel never forwards the DEL command to the host-device delegated plugin, even though ADD invokes it. The CNI spec §4 (Plugin Delegation) requires:

Main plugin must forward CHECK, DEL, and GC to delegated plugins.

Currently internal/cni/ops_del.go deallocates IPAM and returns without calling hostDevice("DEL", ...).

Impact

If host-device maintains any state (reference counting, device tracking, future extensions), it will leak on pod deletion. Even if the current host-device binary is a no-op on DEL, this is a latent spec violation that any contributor extending host-device would inherit.

Fix

Add hostDevice("DEL", args, pluginConf) to cmdDel in internal/cni/ops_del.go, after IPAM deallocation and before the final result print. The error is intentionally ignored per CNI spec — DEL must be idempotent and return success even if resources are already gone.

Only applies to veth mode; tap mode has no host-device delegation.

Verification

  • task ci passes: lint (0 issues), build, unit tests, e2e tests
  • Matches ADD path: hostDevice("ADD", ...) in buildVethResult() now has a symmetric DEL

Closes #238

Generated with Qwen Code (1-shotted by Qwen-Coder)

cmdAdd invokes host-device via delegation but cmdDel never forwarded the
DEL command back, violating CNI spec §4 (Plugin Delegation). This could
cause state leaks if host-device tracks references or devices.

Error is intentionally ignored per spec — DEL must be idempotent and
succeed even if resources are already gone. Only applies to veth mode;
tap mode has no host-device delegation.

fixes #238
@privateip
privateip requested a review from a team as a code owner July 17, 2026 16:26
@privateip
privateip requested a review from slindseysr July 17, 2026 16:26
@privateip
privateip merged commit ee18729 into main Jul 17, 2026
8 checks passed
@privateip
privateip deleted the fix/issue-238 branch July 17, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cni): forward DEL to host-device delegated plugin

2 participants