You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✨Support multi-networking for NSX-VPC and vsphere-network providers (#3530)
* Support multi-networking for NSX-VPC and vsphere-network providers
This PR enhances Node network management to support multi-networking for the
NSX-VPC and vsphere-network providers, while preserving existing behavior for
backward compatibility.
Current Behavior
CAPV manages Node network lifecycle based on the configured network provider:
* vsphere-network (VDS): Uses the single default Network in the Supervisor Namespace.
* NSX (NSX-T Tier-1): Automatically creates a VirtualNetwork for the Node network.
* NSX-VPC (NSX-T VPC): Automatically creates a SubnetSet for the Node network.
What's New
NSX-VPC:
* Primary network: Users can now specify an existing SubnetSet as the Kubernetes
primary network (used for load balancing, service discovery, Pod traffic,
management traffic, etc.).
* Secondary networks: Users can configure additional SubnetSets or Subnets to
handle specialized traffic (e.g., dedicated Pod networking, NFS access).
vsphere-network:
* Primary network: Continues to use the default Network in the Supervisor Namespace
(no change).
* Secondary networks: Users can now specify additional Networks from the Supervisor
Namespace as secondary networks.
Compatibility
If users do not specify custom networking configurations, the default Node network
behavior remains unchanged.
* Fixup api-lint
* Address review comments
* Fix github lint
* Fix second review
// NSXVPC defines the configuration when the network provider is NSX-VPC.
129
+
// +kubebuilder:validation:XValidation:rule="has(self.createSubnetSet) == has(oldSelf.createSubnetSet) && self.createSubnetSet == oldSelf.createSubnetSet",message="createSubnetSet value cannot be changed after creation"
130
+
// +kubebuilder:validation:MinProperties=1
131
+
typeNSXVPCstruct {
132
+
// createSubnetSet is a flag to indicate whether to create a SubnetSet or not as the primary network. If not set, the default is true.
// IsDefined returns true if the NSXVPC is defined.
138
+
func (r*NSXVPC) IsDefined() bool {
139
+
return!reflect.DeepEqual(r, &NSXVPC{})
140
+
}
141
+
142
+
// Network defines the network configuration for the cluster with different network providers.
143
+
// +kubebuilder:validation:XValidation:rule="has(self.nsxVPC) == has(oldSelf.nsxVPC)",message="field 'nsxVPC' cannot be added or removed after creation"
144
+
// +kubebuilder:validation:MinProperties=1
145
+
typeNetworkstruct {
146
+
// nsxVPC defines the configuration when the network provider is NSX-VPC.
147
+
// +optional
148
+
NSXVPCNSXVPC`json:"nsxVPC,omitempty,omitzero"`
149
+
}
150
+
151
+
// IsDefined returns true if the Network is defined.
152
+
func (r*Network) IsDefined() bool {
153
+
return!reflect.DeepEqual(r, &Network{})
154
+
}
155
+
126
156
// VSphereClusterSpec defines the desired state of VSphereCluster.
157
+
// +kubebuilder:validation:XValidation:rule="has(self.network) == has(oldSelf.network)",message="field 'network' cannot be added or removed after creation"
@@ -35,6 +38,7 @@ type VSphereMachineVolume struct {
35
38
}
36
39
37
40
// VSphereMachineSpec defines the desired state of VSphereMachine.
41
+
// +kubebuilder:validation:XValidation:rule="has(self.network) == has(oldSelf.network)",message="field 'network' cannot be added or removed after creation"
38
42
typeVSphereMachineSpecstruct {
39
43
// ProviderID is the virtual machine's BIOS UUID formatted as
// VSphereMachineNetworkSpec defines the network configuration of a VSphereMachine.
105
+
// +kubebuilder:validation:XValidation:rule="has(self.interfaces) == has(oldSelf.interfaces)",message="field 'interfaces' cannot be added or removed after creation"
106
+
// +kubebuilder:validation:MinProperties=1
107
+
typeVSphereMachineNetworkSpecstruct {
108
+
// interfaces is the list of network interfaces attached to this VSphereMachine.
// InterfacesSpec defines all the network interfaces of a VSphereMachine from Kubernetes perspective.
120
+
// +kubebuilder:validation:XValidation:rule="has(self.primary) == has(oldSelf.primary)",message="field 'primary' cannot be added or removed after creation"
121
+
// +kubebuilder:validation:MinProperties=1
122
+
typeInterfacesSpecstruct {
123
+
// primary is the primary network interface.
124
+
//
125
+
// It is used to connect the Kubernetes primary network for Load balancer,
126
+
// Service discovery, Pod traffic and management traffic etc.
127
+
// Leave it unset if you don't want to customize the primary network and interface.
128
+
// Customization is only supported with network provider NSX-VPC.
129
+
// It should be set only when VSphereCluster spec.network.nsxVPC.createSubnetSet is set to false.
0 commit comments