Skip to content

When CNI ADD success, return all interfaces #10382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DrAuYueng
Copy link

@DrAuYueng DrAuYueng commented May 9, 2025

Description

When CNI ADD success, return all interfaces created by the attachment, including any host-level interfaces.
Related references:https://github.com/containernetworking/cni/blob/main/SPEC.md#add-success

Resolves #10351.

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

Include all interfaces in CNI result

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@DrAuYueng DrAuYueng requested a review from a team as a code owner May 9, 2025 11:11
@marvin-tigera marvin-tigera added this to the Calico v3.31.0 milestone May 9, 2025
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels May 9, 2025
Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

This LGTM, thanks!

@caseydavenport
Copy link
Member

/sem-approve

@caseydavenport caseydavenport added the docs-not-required Docs not required for this change label May 9, 2025
@marvin-tigera marvin-tigera removed the docs-pr-required Change is not yet documented label May 9, 2025
@caseydavenport
Copy link
Member

/sem-approve

@DrAuYueng
Copy link
Author

I passed the test locally by executing cd path/calico/cni-plugin && make ut GINKGO_ARGS="-v tests", but CI failed. It's a bit strange. What information am I missing?

@DrAuYueng DrAuYueng force-pushed the cni-result-enhancement branch from 903b3c4 to 795ffcd Compare May 13, 2025 07:27
@DrAuYueng
Copy link
Author

DrAuYueng commented May 13, 2025

I think I know the reason. The key issue is cni version. The comparison is as follows:
0.3.1

2025-05-13 03:32:59.577 [INFO][12126] cni-plugin/plugin.go 414: Got result from IPAM plugin ContainerID="ff2b6b7e0b" IPAM result=&types040.Result{CNIVersion:"0.3.1", Interfaces:[]*types040.Interface(nil), IPs:[]*types040.IPConfig{(*types040.IPConfig)(0xc0001b4180)}, Routes:[]*types.Route(nil), DNS:types.DNS{Nameservers:[]string(nil), Domain:"", Search:[]string(nil), Options:[]string(nil)}}

0.2.0

2025-05-12 18:26:10.000 [INFO][11240] cni-plugin/plugin.go 414: Got result from IPAM plugin ContainerID="338cac2331" IPAM result=&types020.Result{CNIVersion:"0.2.0", IP4:(*types020.IPConfig)(0xc00007eae0), IP6:(*types020.IPConfig)(nil), DNS:types.DNS{Nameservers:[]string(nil), Domain:"", Search:[]string(nil), Options:[]string(nil)}}

The default version is 0.3.1, and the result is normal, but CI uses 0.2.0, which does not support interfaces.

@DrAuYueng
Copy link
Author

I added version checking in the test cases, the spec for versions lower than 0.3.0 will be skipped.

@DrAuYueng
Copy link
Author

@caseydavenport Need to re-trigger CI, thanks.

@caseydavenport
Copy link
Member

/sem-approve

@caseydavenport
Copy link
Member

Looks like you need to run make fix-changed to clean up import ordering.

@DrAuYueng DrAuYueng force-pushed the cni-result-enhancement branch 2 times, most recently from 5deaa5e to 11f6017 Compare May 14, 2025 03:10
Signed-off-by: DrAuYueng <[email protected]>
@DrAuYueng DrAuYueng force-pushed the cni-result-enhancement branch from 11f6017 to 7609a70 Compare May 14, 2025 03:21
@DrAuYueng
Copy link
Author

I run make check-dirty and make test-cni-versions in my local environment, and the results look good.
I rebased the master branch and squashed the relevant commits.
@caseydavenport Please take a look. Thanks.

@caseydavenport
Copy link
Member

/sem-approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-required Change has user-facing impact (no matter how small)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CNI ADD operation should return interfaces created inside the container
3 participants