From 5d3af30dc8c62507db2bf598218453b190a4cbed Mon Sep 17 00:00:00 2001 From: lxiaopei Date: Mon, 7 Aug 2023 19:02:09 +0800 Subject: [PATCH] Add LBSubnetPath under VPC status For AVI integration, we need to set Avi Subnet Path under VPC CR Status. --- build/yaml/crd/nsx.vmware.com_vpcs.yaml | 60 ++++++---------------- pkg/apis/v1alpha1/vpc_types.go | 25 +++------ pkg/apis/v1alpha1/zz_generated.deepcopy.go | 33 ------------ 3 files changed, 23 insertions(+), 95 deletions(-) diff --git a/build/yaml/crd/nsx.vmware.com_vpcs.yaml b/build/yaml/crd/nsx.vmware.com_vpcs.yaml index 588034498..faf9b1847 100644 --- a/build/yaml/crd/nsx.vmware.com_vpcs.yaml +++ b/build/yaml/crd/nsx.vmware.com_vpcs.yaml @@ -1,3 +1,4 @@ + --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -38,48 +39,6 @@ spec: status: description: VPCStatus defines the observed state of VPC properties: - cidrsUsage: - properties: - privateCIDRsUsage: - properties: - allocated: - description: Allocated IPs in the IP Block (including IPs - used by other VPCs). - type: integer - total: - description: Total IP number in the IP Block. - type: integer - used: - description: Used IP for the VPC in the IP Block (IPs used - only in current VPC). - type: integer - required: - - allocated - - total - - used - type: object - publicCIDRsUsage: - properties: - allocated: - description: Allocated IPs in the IP Block (including IPs - used by other VPCs). - type: integer - total: - description: Total IP number in the IP Block. - type: integer - used: - description: Used IP for the VPC in the IP Block (IPs used - only in current VPC). - type: integer - required: - - allocated - - total - - used - type: object - required: - - privateCIDRsUsage - - publicCIDRsUsage - type: object conditions: items: description: Condition defines condition of custom resource. @@ -109,15 +68,22 @@ spec: type: object type: array defaultSNATIP: - description: Default SNAT IP for private Subnets + description: Default SNAT IP for private Subnets. + type: string + lbSubnetCIDR: + description: CIDR for the load balancer Subnet. + type: string + lbSubnetPath: + description: NSX PolicyPath for the load balancer Subnet. type: string nsxResourcePath: description: NSX VPC Policy API resource path. type: string required: - - cidrsUsage - conditions - defaultSNATIP + - lbSubnetCIDR + - lbSubnetPath - nsxResourcePath type: object type: object @@ -125,3 +91,9 @@ spec: storage: true subresources: status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/pkg/apis/v1alpha1/vpc_types.go b/pkg/apis/v1alpha1/vpc_types.go index 9191de85b..ffb6debbc 100644 --- a/pkg/apis/v1alpha1/vpc_types.go +++ b/pkg/apis/v1alpha1/vpc_types.go @@ -1,4 +1,4 @@ -/* Copyright � 2022 VMware, Inc. All Rights Reserved. +/* Copyright © 2022 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package v1alpha1 @@ -38,23 +38,12 @@ type VPCStatus struct { Conditions []Condition `json:"conditions"` // NSX VPC Policy API resource path. NSXResourcePath string `json:"nsxResourcePath"` - // Default SNAT IP for private Subnets - DefaultSNATIP string `json:"defaultSNATIP"` - CIDRsUsage VPCCIDRsUsageInfo `json:"cidrsUsage"` -} - -type VPCCIDRsUsageInfo struct { - PublicCIDRsUsage CIDRsUsageInfo `json:"publicCIDRsUsage"` - PrivateCIDRsUsage CIDRsUsageInfo `json:"privateCIDRsUsage"` -} - -type CIDRsUsageInfo struct { - // Allocated IPs in the IP Block (including IPs used by other VPCs). - Allocated int `json:"allocated"` - // Used IP for the VPC in the IP Block (IPs used only in current VPC). - Used int `json:"used"` - // Total IP number in the IP Block. - Total int `json:"total"` + // Default SNAT IP for private Subnets. + DefaultSNATIP string `json:"defaultSNATIP"` + // NSX PolicyPath for the load balancer Subnet. + LBSubnetPath string `json:"lbSubnetPath"` + // CIDR for the load balancer Subnet. + LBSubnetCIDR string `json:"lbSubnetCIDR"` } func init() { diff --git a/pkg/apis/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/v1alpha1/zz_generated.deepcopy.go index 92bf0e2c3..d4d05d20a 100644 --- a/pkg/apis/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/v1alpha1/zz_generated.deepcopy.go @@ -29,21 +29,6 @@ func (in *AdvancedConfig) DeepCopy() *AdvancedConfig { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CIDRsUsageInfo) DeepCopyInto(out *CIDRsUsageInfo) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRsUsageInfo. -func (in *CIDRsUsageInfo) DeepCopy() *CIDRsUsageInfo { - if in == nil { - return nil - } - out := new(CIDRsUsageInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Condition) DeepCopyInto(out *Condition) { *out = *in @@ -1064,23 +1049,6 @@ func (in *VPC) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VPCCIDRsUsageInfo) DeepCopyInto(out *VPCCIDRsUsageInfo) { - *out = *in - out.PublicCIDRsUsage = in.PublicCIDRsUsage - out.PrivateCIDRsUsage = in.PrivateCIDRsUsage -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCCIDRsUsageInfo. -func (in *VPCCIDRsUsageInfo) DeepCopy() *VPCCIDRsUsageInfo { - if in == nil { - return nil - } - out := new(VPCCIDRsUsageInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCList) DeepCopyInto(out *VPCList) { *out = *in @@ -1245,7 +1213,6 @@ func (in *VPCStatus) DeepCopyInto(out *VPCStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - out.CIDRsUsage = in.CIDRsUsage } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCStatus.