From b41ada39cc558b106bf6001e955a1bcdabba5108 Mon Sep 17 00:00:00 2001 From: kmurudi Date: Mon, 15 Sep 2025 01:42:55 -0700 Subject: [PATCH] feat: add fields in pod network crd for prefix block mode for swiftv2 --- crd/multitenancy/api/v1alpha1/podnetwork.go | 15 +++++++++++++++ .../multitenancy.acn.azure.com_podnetworks.yaml | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/crd/multitenancy/api/v1alpha1/podnetwork.go b/crd/multitenancy/api/v1alpha1/podnetwork.go index 4f21ccbe07..2c41f84f49 100644 --- a/crd/multitenancy/api/v1alpha1/podnetwork.go +++ b/crd/multitenancy/api/v1alpha1/podnetwork.go @@ -45,6 +45,14 @@ const ( DeviceTypeInfiniBandNIC DeviceType = "acn.azure.com/infiniband-nic" ) +// +kubebuilder:validation:Enum=Single;PrefixBlock +type SubnetAllocationMode string + +const ( + Single SubnetAllocationMode = "Single" + PrefixBlock SubnetAllocationMode = "PrefixBlock" +) + // PodNetworkSpec defines the desired state of PodNetwork type PodNetworkSpec struct { // NetworkID is the identifier for the network, e.g. vnet guid or IB network ID @@ -62,6 +70,10 @@ type PodNetworkSpec struct { // Deprecated - Use NetworkID // +kubebuilder:validation:Optional VnetGUID string `json:"vnetGUID,omitempty"` + // subnet allocation mode + // +kubebuilder:validation:Optional + // +kubebuilder:default=Single + SubnetAllocationMode SubnetAllocationMode `json:"subnetAllocationMode,omitempty"` } // Status indicates the status of PN @@ -80,6 +92,9 @@ type PodNetworkStatus struct { // +kubebuilder:validation:Optional Status Status `json:"status,omitempty"` AddressPrefixes []string `json:"addressPrefixes,omitempty"` + // PrefixBlockAllocationSize indicates the size of IP block allocated to the subnet + // +kubebuilder:default=16 + PrefixBlockAllocationSize int `json:"prefixBlockAllocationSize,omitempty"` } func init() { diff --git a/crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworks.yaml b/crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworks.yaml index 90ed5b698f..edf33071a3 100644 --- a/crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworks.yaml +++ b/crd/multitenancy/manifests/multitenancy.acn.azure.com_podnetworks.yaml @@ -77,6 +77,13 @@ spec: description: NetworkID is the identifier for the network, e.g. vnet guid or IB network ID type: string + subnetAllocationMode: + default: Single + description: subnet allocation mode + enum: + - Single + - PrefixBlock + type: string subnetGUID: description: customer subnet guid type: string @@ -94,6 +101,11 @@ spec: items: type: string type: array + prefixBlockAllocationSize: + default: 16 + description: PrefixBlockAllocationSize indicates the size of IP block + allocated to the subnet + type: integer status: description: Status indicates the status of PN enum: