Skip to content

Add AntreaNodeConfig CRD#7812

Open
luolanzone wants to merge 1 commit intoantrea-io:mainfrom
luolanzone:add-antreanodeconfig-crd
Open

Add AntreaNodeConfig CRD#7812
luolanzone wants to merge 1 commit intoantrea-io:mainfrom
luolanzone:add-antreanodeconfig-crd

Conversation

@luolanzone
Copy link
Contributor

@luolanzone luolanzone commented Mar 2, 2026

Introduce a new cluster-scoped CRD, AntreaNodeConfig, that allows
users to define Antrea agent configuration on a per-Node basis using
a nodeSelector.

The CRD currently supports secondaryNetwork configuration only.
Additional Agent configuration fields may be added in the future.

The spec fields are:

  • nodeSelector: selects Nodes to which the config applies; if
    multiple AntreaNodeConfigs match a Node, the one with the earliest
    creation timestamp (or lowest name if equal) wins.
  • secondaryNetwork.ovsBridges[]: list of OVS bridges (max 1) for
    secondary networks, each with:
    • bridgeName: name of the OVS bridge (optional, default to br1,
      immutalbe after setting)
    • physicalInterfaces[]: physical NICs to attach, each with:
      • name: interface name (required)
      • allowedVLANs[]: VLAN IDs or ranges (e.g. "100", "200-300");
        defaults to all VLANs if unset
    • enableMulticastSnooping: forward multicast only to interested
      ports instead of flooding; defaults to false

Changes include:

  • New Go types and deepcopy functions in pkg/apis/crd/v1alpha1
  • CRD OpenAPI manifest in build/charts/antrea/crds
  • Role permission update in build/charts/antrea/templates/agent/clusterrole.yaml
  • Auto-generated clientset, lister, and informer code for v1alpha1

Copilot AI review requested due to automatic review settings March 2, 2026 02:06
@luolanzone luolanzone force-pushed the add-antreanodeconfig-crd branch from 1bbb49a to 9b97e03 Compare March 2, 2026 02:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new cluster-scoped CRD AntreaNodeConfig that allows users to define per-Node Antrea agent configuration using a nodeSelector. The CRD currently supports secondaryNetwork configuration (OVS bridges with physical uplinks and VLAN filters). It includes the full Go API types, deepcopy functions, and auto-generated clientset/lister/informer code, along with the Kubernetes CRD manifest and RBAC updates.

Changes:

  • New Go API types (AntreaNodeConfig, AntreaNodeConfigSpec, NodeSecondaryNetworkConfig, OVSBridgeConfigWithUplinks, PhysicalInterfaceConfig) in pkg/apis/crd/v1alpha1, plus their deepcopy implementations and scheme registration
  • Auto-generated clientset, lister, and informer code in pkg/client/ for the new v1alpha1 type
  • CRD OpenAPI manifest (build/charts/antrea/crds/antreanodeconfig.yaml), agent ClusterRole RBAC update, and regenerated bundled YAML files

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pkg/apis/crd/v1alpha1/types.go Defines AntreaNodeConfig Go API types
pkg/apis/crd/v1alpha1/register.go Registers new types in the scheme
pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go Auto-generated DeepCopy functions for new types
pkg/client/clientset/versioned/typed/crd/v1alpha1/antreanodeconfig.go Generated typed client for AntreaNodeConfig
pkg/client/clientset/versioned/typed/crd/v1alpha1/crd_client.go Adds AntreaNodeConfigsGetter to CRD client interface
pkg/client/clientset/versioned/typed/crd/v1alpha1/generated_expansion.go Adds AntreaNodeConfigExpansion interface
pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_antreanodeconfig.go Fake client for testing
pkg/client/clientset/versioned/typed/crd/v1alpha1/fake/fake_crd_client.go Wires fake client to AntreaNodeConfigs
pkg/client/informers/externalversions/crd/v1alpha1/antreanodeconfig.go Generated informer for AntreaNodeConfig
pkg/client/informers/externalversions/crd/v1alpha1/interface.go Adds AntreaNodeConfigInformer to the informer interface
pkg/client/informers/externalversions/generic.go Registers AntreaNodeConfigs in the generic informer switch
pkg/client/listers/crd/v1alpha1/antreanodeconfig.go Generated lister for AntreaNodeConfig
pkg/client/listers/crd/v1alpha1/expansion_generated.go Adds AntreaNodeConfigListerExpansion interface
build/charts/antrea/crds/antreanodeconfig.yaml CRD OpenAPI manifest for AntreaNodeConfig
build/charts/antrea/templates/agent/clusterrole.yaml Grants agent read access to antreanodeconfigs
build/yamls/antrea*.yml Regenerated bundled deployment YAMLs including new CRD and RBAC

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luolanzone luolanzone force-pushed the add-antreanodeconfig-crd branch 2 times, most recently from 6aff22e to b69ed9e Compare March 2, 2026 02:31
type AntreaNodeConfigSpec struct {
// NodeSelector selects Nodes to which this AntreaNodeConfig applies. If multiple
// AntreaNodeConfigs select the same Node, only the one with the highest priority
// (the one created earliest: oldest creationTimestamp wins) will be applied.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jianjuns @antoninbas For AntreaNodeConfig, I plan to let the oldest CR win if multiple CRs applies to a Node. Which means for any AntreaNodeConfig, there should be only one valid config CR per Node and any new CR after that would be ignored. Let me know if you have any thought about this. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked CiliumNodeConfig, it seems they are using overridden way:

If multiple overrides apply to the same node, they will be ordered by name with later Overrides overwriting any conflicting keys.

I am not sure if "ordered by name" is a good way. Probably we can order AntreaNodeConfig by creationstamp and later Overrides overwriting any conflicting keys?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can be consistent with what we have for BGPPolicy? Do we do anything specific there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For secondary network, we will create the secondary bridge and corresponding client for Pods. Rethinking about it, It's probably better to be consistent as BGPPolicy to use the one with the earliest creation time. Which would be stable for Pod's underlay network without recreating a new bridge and client.

@luolanzone luolanzone force-pushed the add-antreanodeconfig-crd branch 4 times, most recently from 23839dc to 19151a4 Compare March 9, 2026 03:31
Introduce a new cluster-scoped CRD, AntreaNodeConfig, that allows
users to define Antrea agent configuration on a per-Node basis using
a nodeSelector.

The CRD currently supports secondaryNetwork configuration only.
Additional Agent configuration fields may be added in the future.

The spec fields are:
- nodeSelector: selects Nodes to which the config applies; if
  multiple AntreaNodeConfigs match a Node, the one with the earliest
  creation timestamp (or lowest name if equal) wins.
- secondaryNetwork.ovsBridges[]: list of OVS bridges (max 1) for
  secondary networks, each with:
  - bridgeName: name of the OVS bridge (optional, default to br1,
    immutalbe after setting)
  - physicalInterfaces[]: physical NICs to attach, each with:
    - name: interface name (required)
    - allowedVLANs[]: VLAN IDs or ranges (e.g. "100", "200-300");
      defaults to all VLANs if unset
  - enableMulticastSnooping: forward multicast only to interested
    ports instead of flooding; defaults to false

Changes include:
- New Go types and deepcopy functions in pkg/apis/crd/v1alpha1
- CRD OpenAPI manifest in build/charts/antrea/crds
- Role permission update in build/charts/antrea/templates/agent/clusterrole.yaml
- Auto-generated clientset, lister, and informer code for v1alpha1

Signed-off-by: Lan Luo <lan.luo@broadcom.com>
@luolanzone luolanzone force-pushed the add-antreanodeconfig-crd branch from 19151a4 to 6b35662 Compare March 12, 2026 03:44
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.

4 participants