Skip to content

fix: remove attachment-specific checks from cmdStatus to match CNI spec#171

Merged
privateip merged 3 commits into
mainfrom
fix/cni-status
Jun 30, 2026
Merged

fix: remove attachment-specific checks from cmdStatus to match CNI spec#171
privateip merged 3 commits into
mainfrom
fix/cni-status

Conversation

@privateip

Copy link
Copy Markdown
Contributor

cmdStatus was checking VRF and host interface existence, but the CNI spec defines STATUS as answering "is this plugin ready to service ADD requests?" — not "does a prior ADD's state persist?". On a freshly started node before any ADD has run, no VRF or host interface exists, so cmdStatus always failed.

Remove the VRF and host-interface checks. STATUS now only verifies:

  1. Config is parseable (parseConf)
  2. API server is reachable (probeAPIServer)

fixes #164

@privateip privateip requested a review from a team as a code owner June 30, 2026 19:18
@privateip privateip requested a review from mksinghtx June 30, 2026 19:18
scotwells
scotwells previously approved these changes Jun 30, 2026
privateip added a commit that referenced this pull request Jun 30, 2026
The 'multiple annotations returns first' test expected a specific
container ID from findContainerID(), but the function iterates over
a Go map which has non-deterministic ordering. This caused the CI
Unit Tests job to fail intermittently with:

  gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222"

Update the test to accept either of the two possible container IDs.

Fixes CI failure in PR #171.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
privateip added a commit that referenced this pull request Jun 30, 2026
The 'multiple annotations returns first' test expected a specific
container ID from findContainerID(), but the function iterates over
a Go map which has non-deterministic ordering. This caused the CI
Unit Tests job to fail intermittently with:

  gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222"

Update the test to accept either of the two possible container IDs.

Fixes CI failure in PR #171.
scotwells
scotwells previously approved these changes Jun 30, 2026

@scotwells scotwells left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got merge conflicts on this one

cmdStatus was checking VRF and host interface existence, but the CNI spec
defines STATUS as answering "is this plugin ready to service ADD requests?"
— not "does a prior ADD's state persist?". On a freshly started node before
any ADD has run, no VRF or host interface exists, so cmdStatus always failed.

Remove the VRF and host-interface checks. STATUS now only verifies:
1. Config is parseable (parseConf)
2. API server is reachable (probeAPIServer)

fixes #164
The 'multiple annotations returns first' test expected a specific
container ID from findContainerID(), but the function iterates over
a Go map which has non-deterministic ordering. This caused the CI
Unit Tests job to fail intermittently with:

  gc_test.go:82: findContainerID() = "ccc333ddd444", want "aaa111bbb222"

Update the test to accept either of the two possible container IDs.

Fixes CI failure in PR #171.
The cmdStatus STATUS operation must succeed on a freshly started node
before any ADD has run, but the existing tests and implementation had
three bugs: probeAPIServer tests mocked the wrong variable, parseConf
rejected configs missing VPC/VPCAttachment, and a static fmt.Errorf
triggered a lint warning.

- Fix probeAPIServer tests to mock probeAPIServer instead of
  probeAPIServerFn, which is the variable actually called by cmdStatus
- Add parseStatusConf that validates only cniVersion, type, and
  interface_type (if present), skipping VPC/VPCAttachment since STATUS
  must succeed before any ADD has ever run
- Replace fmt.Errorf with errors.New for a static error string in a
  test to satisfy the perfsprint lint rule
@privateip privateip merged commit c3c62fd into main Jun 30, 2026
5 checks passed
@privateip privateip deleted the fix/cni-status branch June 30, 2026 23:45
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.

cmdStatus checks attachment-specific VRF/interface state — breaks STATUS semantics

2 participants