antrea icon indicating copy to clipboard operation
antrea copied to clipboard

Support secondarynetwork update

Open wenqiq opened this issue 7 months ago • 13 comments

This PR introduces support for adding or deleting secondary network configurations for Pods by dynamically reconciling the k8s.v1.cni.cncf.io/networks annotation. Users can now add new secondary network configurations or remove existing ones during a Pod's lifecycle, and the changes will be applied without requiring Pod recreation.

Key Changes:

  • Annotation lifecycle support:
    • Adding the k8s.v1.cni.cncf.io/networks annotation to a Pod triggers creation of all specified secondary network interfaces
    • Deleting the annotation triggers removal of all associated secondary network interfaces
  • Unsupported operations:
    • ❌ Modifying existing network entries in the annotation (e.g., adding/removing individual interfaces from the array)
    • ❌ Changing interface parameters for existing network definitions

Implementation Details:

  • Controller Logic: Extended the existing network controller to handle annotation updates and invoke CNI plugins for interface lifecycle operations.
  • Cleanup Mechanism: Remove orphaned interfaces when annotations are deleted.

TestDone:

  • Added unit and e2e tests covering:
    • Full k8s.v1.cni.cncf.io/networks annotation addition → interface creation
    • Full k8s.v1.cni.cncf.io/networks annotation deletion → interface removal

Notes:

  • Pods must be in a running state for annotation changes to take effect
  • Interface deletions may cause brief connectivity interruptions
  • Interface-level modifications are not supported - only complete annotation addition/deletion

Resolves https://github.com/antrea-io/antrea/issues/7065

Depends on #7116

wenqiq avatar Apr 11 '25 10:04 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Apr 16 '25 14:04 wenqiq

Can one of the admins verify this patch?

antrea-bot avatar Apr 18 '25 13:04 antrea-bot

/test-sriov-secondary-network-e2e

wenqiq avatar Apr 22 '25 03:04 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Apr 23 '25 14:04 wenqiq

@wenqiq please update the description about what's kind of update events have been handled in this PR.

luolanzone avatar Apr 25 '25 01:04 luolanzone

@wenqiq please re-base to the latest codes in https://github.com/antrea-io/antrea/pull/7116

luolanzone avatar Jun 05 '25 09:06 luolanzone

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 10 '25 16:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 18 '25 07:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 18 '25 17:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 20 '25 02:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 20 '25 06:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 20 '25 06:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 20 '25 09:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 30 '25 15:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jun 30 '25 23:06 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jul 01 '25 00:07 wenqiq

/test-sriov-secondary-network-e2e

wenqiq avatar Jul 01 '25 07:07 wenqiq

@tnqn @luolanzone @antoninbas @jianjuns Addressed comments . Could you help take another look at this PR?

wenqiq avatar Jul 01 '25 07:07 wenqiq

@wenqiq please resolve code conflicts.

luolanzone avatar Jul 04 '25 08:07 luolanzone

/test-sriov-secondary-network-e2e

wenqiq avatar Jul 04 '25 17:07 wenqiq

@wenqiq please update the title to ensure it's precise. Probably "Support k8s.v1.cni.cncf.io/networks annotation removal or reset to blank to clean up Pod's secondary interfaces"

luolanzone avatar Jul 07 '25 06:07 luolanzone

/test-sriov-secondary-network-e2e

wenqiq avatar Jul 09 '25 03:07 wenqiq

/test-all

jianjuns avatar Jul 09 '25 19:07 jianjuns

@luolanzone @wenqiq : next time please trim the commit description to be <= 72 chars, and also update the commit message before merging.

The commit was merged with the following commit message:

  • Support secondarynetwork update

It does not match the change.

jianjuns avatar Jul 09 '25 22:07 jianjuns

@luolanzone @wenqiq : next time please trim the commit description to be <= 72 chars, and also update the commit message before merging.

Got it. Will pay attention to editing each commit message before pushing.

wenqiq avatar Jul 09 '25 23:07 wenqiq