Skip to content

Commit 3eac57b

Browse files
committed
feat: support multiple subnets via primarySubnet field
feat: support multiple subnets via primarySubnet field Handling IP exhaustion test: include tests for primarySubnet Use GetNetworkSubnetByParam, add primarySubnet in ValidateUpdate and test cases
1 parent a6f9102 commit 3eac57b

22 files changed

Lines changed: 951 additions & 78 deletions

api/v1beta1/openstackcluster_types.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ type OpenStackClusterSpec struct {
5454

5555
// Subnets specifies existing subnets to use if not ManagedSubnets are
5656
// specified. All subnets must be in the network specified by Network.
57-
// There can be zero, one, or two subnets. If no subnets are specified,
58-
// all subnets in Network will be used. If 2 subnets are specified, one
59-
// must be IPv4 and the other IPv6.
60-
// +kubebuilder:validation:MaxItems=2
57+
// If no subnets are specified, all subnets in Network will be used.
58+
// Multiple subnets of the same IP version are supported when PrimarySubnet
59+
// is also set to identify which subnet should be used for services like
60+
// load balancer VIP allocation.
6161
// +listType=atomic
6262
// +optional
6363
Subnets []SubnetParam `json:"subnets,omitempty"`
6464

65+
// PrimarySubnet identifies the primary subnet for the cluster when multiple
66+
// subnets are specified in Subnets. It is used to determine the subnet for
67+
// load balancer VIP allocation and node member registration.
68+
// If not specified and multiple subnets exist, the first subnet in the
69+
// resolved Subnets list is used.
70+
// +optional
71+
PrimarySubnet *SubnetParam `json:"primarySubnet,omitempty"`
72+
6573
// NetworkMTU sets the maximum transmission unit (MTU) value to address fragmentation for the private network ID.
6674
// This value will be used only if the Cluster actuator creates the network.
6775
// If left empty, the network will have the default MTU defined in Openstack network service.

api/v1beta1/zz_generated.conversion.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/openstackcluster_types.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,22 @@ type OpenStackClusterSpec struct {
4343

4444
// subnets specifies existing subnets to use if not ManagedSubnets are
4545
// specified. All subnets must be in the network specified by Network.
46-
// There can be zero, one, or two subnets. If no subnets are specified,
47-
// all subnets in Network will be used. If 2 subnets are specified, one
48-
// must be IPv4 and the other IPv6.
49-
// +kubebuilder:validation:MaxItems=2
46+
// If no subnets are specified, all subnets in Network will be used.
47+
// Multiple subnets of the same IP version are supported when primarySubnet
48+
// is also set to identify which subnet should be used for services like
49+
// load balancer VIP allocation.
5050
// +listType=atomic
5151
// +optional
5252
Subnets []SubnetParam `json:"subnets,omitempty"`
5353

54+
// primarySubnet identifies the primary subnet for the cluster when multiple
55+
// subnets are specified in Subnets. It is used to determine the subnet for
56+
// load balancer VIP allocation and node member registration.
57+
// If not specified and multiple subnets exist, the first subnet in the
58+
// resolved Subnets list is used.
59+
// +optional
60+
PrimarySubnet *SubnetParam `json:"primarySubnet,omitempty"`
61+
5462
// managedRouter specifies attributes of the router. The values are used only
5563
// if the Cluster actuator creates the router.
5664
// +kubebuilder:validation:XValidation:rule="has(self.externalIPs)",message="managedRouter must not be empty if set"

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/models-schema/zz_generated.openapi.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)