diff --git a/build/yaml/crd/nsx.vmware.com_ipaddressallocations.yaml b/build/yaml/crd/nsx.vmware.com_ipaddressallocations.yaml index 476fa42d6..45ce7a190 100644 --- a/build/yaml/crd/nsx.vmware.com_ipaddressallocations.yaml +++ b/build/yaml/crd/nsx.vmware.com_ipaddressallocations.yaml @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.11.0 + creationTimestamp: null name: ipaddressallocations.nsx.vmware.com spec: group: nsx.vmware.com @@ -29,19 +30,14 @@ spec: description: IPAddressAllocation is the Schema for the IP allocation API. properties: apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string metadata: type: object @@ -73,10 +69,10 @@ spec: description: Condition defines condition of custom resource. properties: lastTransitionTime: - description: |- - Last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. format: date-time type: string message: diff --git a/build/yaml/crd/nsx.vmware.com_ippools.yaml b/build/yaml/crd/nsx.vmware.com_ippools.yaml index e6cf505c4..3402a97f7 100644 --- a/build/yaml/crd/nsx.vmware.com_ippools.yaml +++ b/build/yaml/crd/nsx.vmware.com_ippools.yaml @@ -172,10 +172,12 @@ spec: type: object type: array type: - description: Type defines the type of this IPPool, Public or Private. + description: Type defines the type of this IPPool, Public, Private + or Project. enum: - Public - Private + - Project type: string type: object status: diff --git a/build/yaml/crd/nsx.vmware.com_networkinfos.yaml b/build/yaml/crd/nsx.vmware.com_networkinfos.yaml index c8aa22ab5..748c008b2 100644 --- a/build/yaml/crd/nsx.vmware.com_networkinfos.yaml +++ b/build/yaml/crd/nsx.vmware.com_networkinfos.yaml @@ -46,7 +46,7 @@ spec: name: description: VPC name. type: string - privateIPv4CIDRs: + privateIPs: description: Private CIDRs used for the VPC. items: type: string diff --git a/build/yaml/crd/nsx.vmware.com_subnets.yaml b/build/yaml/crd/nsx.vmware.com_subnets.yaml index 4b3af9df8..e09f99c19 100644 --- a/build/yaml/crd/nsx.vmware.com_subnets.yaml +++ b/build/yaml/crd/nsx.vmware.com_subnets.yaml @@ -56,11 +56,13 @@ spec: type: boolean type: object accessMode: + default: Private description: Access mode of Subnet, accessible only from within VPC or from outside VPC. enum: - Private - Public + - Project type: string advancedConfig: description: Subnet advanced configuration. diff --git a/build/yaml/crd/nsx.vmware.com_subnetsets.yaml b/build/yaml/crd/nsx.vmware.com_subnetsets.yaml index 912d1a93b..51a70afa9 100644 --- a/build/yaml/crd/nsx.vmware.com_subnetsets.yaml +++ b/build/yaml/crd/nsx.vmware.com_subnetsets.yaml @@ -56,11 +56,13 @@ spec: type: boolean type: object accessMode: + default: Private description: Access mode of Subnet, accessible only from within VPC or from outside VPC. enum: - Private - Public + - Project type: string advancedConfig: description: Subnet advanced configuration. diff --git a/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml b/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml index 23b96a849..eeef1994a 100644 --- a/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml +++ b/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml @@ -24,9 +24,9 @@ spec: jsonPath: .spec.externalIPv4Blocks name: ExternalIPv4Blocks type: string - - description: PrivateIPv4CIDRs assigned to the Namespace - jsonPath: .spec.privateIPv4CIDRs - name: PrivateIPv4CIDRs + - description: PrivateIPs assigned to the Namespace + jsonPath: .spec.privateIPs + name: PrivateIPs type: string name: v1alpha1 schema: @@ -53,47 +53,43 @@ spec: When a field is not set in a Namespace's VPCNetworkConfiguration, the Namespace will use the value in the default VPCNetworkConfiguration. properties: - defaultGatewayPath: - description: PolicyPath of Tier0 or Tier0 VRF gateway. - type: string - defaultIPv4SubnetSize: + defaultSubnetSize: default: 26 description: Default size of Subnet based upon estimated workload count. Defaults to 26. type: integer - defaultSubnetAccessMode: - description: DefaultSubnetAccessMode defines the access mode of the - default SubnetSet for PodVM and VM. Must be Public or Private. + lbServiceSize: enum: - - Public - - Private + - SMALL + - MEDIUM + - LARGE + - XLARGE type: string - edgeClusterPath: - description: Edge cluster path on which the networking elements will - be created. - type: string - externalIPv4Blocks: - description: NSX-T IPv4 Block paths used to allocate external Subnets. - items: - type: string - maxItems: 5 - minItems: 0 - type: array nsxtProject: description: NSX-T Project the Namespace associated with. type: string - privateIPv4CIDRs: - description: Private IPv4 CIDRs used to allocate Private Subnets. + podSubnetAccessMode: + description: PodSubnetAccessMode defines the access mode of the default + SubnetSet for PodVM. Must be Public or Private. + enum: + - Public + - Private + - Project + type: string + privateIPs: + description: Private IPs. items: type: string - maxItems: 5 - minItems: 0 type: array shortID: description: ShortID specifies Identifier to use when displaying VPC - context in logs. Less than or equal to 8 characters. + context in logs. Less than equal to 8 characters. maxLength: 8 type: string + vpcConnectivityProfile: + description: VPCConnectivityProfile ID. This profile has configuration + related to create VPC transit gateway attachment. + type: string type: object status: description: VPCNetworkConfigurationStatus defines the observed state diff --git a/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml b/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml index a548450cc..18433f78f 100644 --- a/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml +++ b/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml @@ -13,6 +13,6 @@ vpcs: - defaultSNATIP: 192.168.0.0 loadBalancerIPAddresses: 172.26.0.0/26 name: vpc-d110d5aa-006d-4b59-9caf-424a4fba932c--kube-system - privateIPv4CIDRs: + privateIPs: - 172.26.0.0/16 vpcPath: /orgs/default/projects/project-quality/vpcs/19a8a52e-beb0-4396-91ce-5821a15a43db \ No newline at end of file diff --git a/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml b/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml index c19703c2f..b6e4583c9 100644 --- a/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml +++ b/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml @@ -5,11 +5,11 @@ metadata: spec: defaultGatewayPath: /infra/tier-0s/t0 edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/2d9df59f-6dc6-4911-8865-21fadc23d4da - defaultIPv4SubnetSize: 26 + defaultSubnetSize: 26 nsxtProject: proj-1 externalIPv4Blocks: - block1 - privateIPv4CIDRs: + privateIPs: - 172.26.0.0/16 - 172.36.0.0/16 - defaultSubnetAccessMode: Private + podSubnetAccessMode: Private diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/networkinfo_types.go b/pkg/apis/nsx.vmware.com/v1alpha1/networkinfo_types.go index 4785fa7ec..5327cec21 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/networkinfo_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/networkinfo_types.go @@ -8,8 +8,8 @@ import ( ) // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:storageversion // NetworkInfo is used to report the network information for a namespace. // +kubebuilder:resource:path=networkinfos @@ -20,7 +20,7 @@ type NetworkInfo struct { VPCs []VPCState `json:"vpcs"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // NetworkInfoList contains a list of NetworkInfo. type NetworkInfoList struct { @@ -40,7 +40,7 @@ type VPCState struct { // LoadBalancerIPAddresses (AVI SE Subnet CIDR or NSX LB SNAT IPs). LoadBalancerIPAddresses string `json:"loadBalancerIPAddresses,omitempty"` // Private CIDRs used for the VPC. - PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` + PrivateIPs []string `json:"privateIPs,omitempty"` } func init() { diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go b/pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go index 47553cd10..82ecdb839 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go @@ -16,7 +16,8 @@ type SubnetSpec struct { // +kubebuilder:validation:Minimum:=16 IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"` // Access mode of Subnet, accessible only from within VPC or from outside VPC. - // +kubebuilder:validation:Enum=Private;Public + // +kubebuilder:default:=Private + // +kubebuilder:validation:Enum=Private;Public;Project AccessMode AccessMode `json:"accessMode,omitempty"` // Subnet CIDRS. // +kubebuilder:validation:MinItems=0 @@ -38,9 +39,9 @@ type SubnetStatus struct { } // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Subnet is the Schema for the subnets API. // +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet" @@ -54,7 +55,7 @@ type Subnet struct { Status SubnetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // SubnetList contains a list of Subnet. type SubnetList struct { diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go b/pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go index 3d8883355..275db8762 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go @@ -14,7 +14,8 @@ type SubnetSetSpec struct { // +kubebuilder:validation:Minimum:=16 IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"` // Access mode of Subnet, accessible only from within VPC or from outside VPC. - // +kubebuilder:validation:Enum=Private;Public + // +kubebuilder:default:=Private + // +kubebuilder:validation:Enum=Private;Public;Project AccessMode AccessMode `json:"accessMode,omitempty"` // Subnet advanced configuration. AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"` @@ -37,9 +38,9 @@ type SubnetSetStatus struct { } // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetSet is the Schema for the subnetsets API. // +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet" @@ -53,7 +54,7 @@ type SubnetSet struct { Status SubnetSetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // SubnetSetList contains a list of SubnetSet. type SubnetSetList struct { diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go b/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go index 9ba4babbc..05f4dac80 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go @@ -9,8 +9,13 @@ import ( ) const ( - AccessModePublic string = "Public" - AccessModePrivate string = "Private" + AccessModePublic string = "Public" + AccessModePrivate string = "Private" + AccessModeProject string = "Project" + LbServiceSizeSmall string = "SMALL" + LbServiceSizeMedium string = "MEDIUM" + LbServiceSizeLarge string = "LARGE" + LbServiceSizeXlarge string = "XLARGE" ) // VPCNetworkConfigurationSpec defines the desired state of VPCNetworkConfiguration. @@ -19,33 +24,32 @@ const ( // in a Namespace's VPCNetworkConfiguration, the Namespace will use the value // in the default VPCNetworkConfiguration. type VPCNetworkConfigurationSpec struct { - // PolicyPath of Tier0 or Tier0 VRF gateway. - DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"` - // Edge cluster path on which the networking elements will be created. - EdgeClusterPath string `json:"edgeClusterPath,omitempty"` // NSX-T Project the Namespace associated with. NSXTProject string `json:"nsxtProject,omitempty"` - // NSX-T IPv4 Block paths used to allocate external Subnets. - // +kubebuilder:validation:MinItems=0 - // +kubebuilder:validation:MaxItems=5 - ExternalIPv4Blocks []string `json:"externalIPv4Blocks,omitempty"` - // Private IPv4 CIDRs used to allocate Private Subnets. - // +kubebuilder:validation:MinItems=0 - // +kubebuilder:validation:MaxItems=5 - PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` - // Default size of Subnet based upon estimated workload count. - // Defaults to 26. - // +kubebuilder:default=26 - DefaultIPv4SubnetSize int `json:"defaultIPv4SubnetSize,omitempty"` - // DefaultSubnetAccessMode defines the access mode of the default SubnetSet for PodVM and VM. - // Must be Public or Private. - // +kubebuilder:validation:Enum=Public;Private - DefaultSubnetAccessMode string `json:"defaultSubnetAccessMode,omitempty"` + + // VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment. + VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"` + + // Private IPs. + PrivateIPs []string `json:"privateIPs,omitempty"` + // ShortID specifies Identifier to use when displaying VPC context in logs. - // Less than or equal to 8 characters. + // Less than equal to 8 characters. // +kubebuilder:validation:MaxLength=8 // +optional ShortID string `json:"shortID,omitempty"` + + // +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE + LbServiceSize string `json:"lbServiceSize,omitempty"` + + // Default size of Subnet based upon estimated workload count. + // Defaults to 26. + // +kubebuilder:default=26 + DefaultSubnetSize int `json:"defaultSubnetSize,omitempty"` + // PodSubnetAccessMode defines the access mode of the default SubnetSet for PodVM. + // Must be Public or Private. + // +kubebuilder:validation:Enum=Public;Private;Project + PodSubnetAccessMode string `json:"podSubnetAccessMode,omitempty"` } // VPCNetworkConfigurationStatus defines the observed state of VPCNetworkConfiguration @@ -64,15 +68,15 @@ type VPCInfo struct { // +genclient // +genclient:nonNamespaced -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCNetworkConfiguration is the Schema for the vpcnetworkconfigurations API. // +kubebuilder:resource:scope="Cluster" // +kubebuilder:printcolumn:name="NSXTProject",type=string,JSONPath=`.spec.nsxtProject`,description="NSXTProject the Namespace associated with" // +kubebuilder:printcolumn:name="ExternalIPv4Blocks",type=string,JSONPath=`.spec.externalIPv4Blocks`,description="ExternalIPv4Blocks assigned to the Namespace" -// +kubebuilder:printcolumn:name="PrivateIPv4CIDRs",type=string,JSONPath=`.spec.privateIPv4CIDRs`,description="PrivateIPv4CIDRs assigned to the Namespace" +// +kubebuilder:printcolumn:name="PrivateIPs",type=string,JSONPath=`.spec.privateIPs`,description="PrivateIPs assigned to the Namespace" type VPCNetworkConfiguration struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -81,7 +85,7 @@ type VPCNetworkConfiguration struct { Status VPCNetworkConfigurationStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // VPCNetworkConfigurationList contains a list of VPCNetworkConfiguration. type VPCNetworkConfigurationList struct { diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/nsx.vmware.com/v1alpha1/zz_generated.deepcopy.go index 5919f2d28..12361c174 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/zz_generated.deepcopy.go @@ -80,6 +80,102 @@ func (in *DNSClientConfig) DeepCopy() *DNSClientConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocation) DeepCopyInto(out *IPAddressAllocation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocation. +func (in *IPAddressAllocation) DeepCopy() *IPAddressAllocation { + if in == nil { + return nil + } + out := new(IPAddressAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressAllocation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationList) DeepCopyInto(out *IPAddressAllocationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPAddressAllocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationList. +func (in *IPAddressAllocationList) DeepCopy() *IPAddressAllocationList { + if in == nil { + return nil + } + out := new(IPAddressAllocationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressAllocationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationSpec) DeepCopyInto(out *IPAddressAllocationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationSpec. +func (in *IPAddressAllocationSpec) DeepCopy() *IPAddressAllocationSpec { + if in == nil { + return nil + } + out := new(IPAddressAllocationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationStatus) DeepCopyInto(out *IPAddressAllocationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationStatus. +func (in *IPAddressAllocationStatus) DeepCopy() *IPAddressAllocationStatus { + if in == nil { + return nil + } + out := new(IPAddressAllocationStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IPBlock) DeepCopyInto(out *IPBlock) { *out = *in @@ -1334,13 +1430,8 @@ func (in *VPCNetworkConfigurationList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCNetworkConfigurationSpec) DeepCopyInto(out *VPCNetworkConfigurationSpec) { *out = *in - if in.ExternalIPv4Blocks != nil { - in, out := &in.ExternalIPv4Blocks, &out.ExternalIPv4Blocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.PrivateIPv4CIDRs != nil { - in, out := &in.PrivateIPv4CIDRs, &out.PrivateIPv4CIDRs + if in.PrivateIPs != nil { + in, out := &in.PrivateIPs, &out.PrivateIPs *out = make([]string, len(*in)) copy(*out, *in) } @@ -1379,8 +1470,8 @@ func (in *VPCNetworkConfigurationStatus) DeepCopy() *VPCNetworkConfigurationStat // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCState) DeepCopyInto(out *VPCState) { *out = *in - if in.PrivateIPv4CIDRs != nil { - in, out := &in.PrivateIPv4CIDRs, &out.PrivateIPv4CIDRs + if in.PrivateIPs != nil { + in, out := &in.PrivateIPs, &out.PrivateIPs *out = make([]string, len(*in)) copy(*out, *in) } @@ -1395,92 +1486,3 @@ func (in *VPCState) DeepCopy() *VPCState { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocation) DeepCopyInto(out *IPAddressAllocation) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocation. -func (in *IPAddressAllocation) DeepCopy() *IPAddressAllocation { - if in == nil { - return nil - } - out := new(IPAddressAllocation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAddressAllocation) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationList) DeepCopyInto(out *IPAddressAllocationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IPAddressAllocation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationList. -func (in *IPAddressAllocationList) DeepCopy() *IPAddressAllocationList { - if in == nil { - return nil - } - out := new(IPAddressAllocationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAddressAllocationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationSpec) DeepCopyInto(out *IPAddressAllocationSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationSpec. -func (in *IPAddressAllocationSpec) DeepCopy() *IPAddressAllocationSpec { - if in == nil { - return nil - } - out := new(IPAddressAllocationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationStatus) DeepCopyInto(out *IPAddressAllocationStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationStatus. -func (in *IPAddressAllocationStatus) DeepCopy() *IPAddressAllocationStatus { - if in == nil { - return nil - } - out := new(IPAddressAllocationStatus) - in.DeepCopyInto(out) - return out -} \ No newline at end of file diff --git a/pkg/apis/nsx.vmware.com/v1alpha2/ippool_types.go b/pkg/apis/nsx.vmware.com/v1alpha2/ippool_types.go index 469dc43ef..a6d995d7c 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha2/ippool_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha2/ippool_types.go @@ -10,9 +10,9 @@ import ( ) // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPPool is the Schema for the ippools API. // +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,description="Type of IPPool" @@ -25,7 +25,7 @@ type IPPool struct { Status IPPoolStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // IPPoolList contains a list of IPPool. type IPPoolList struct { @@ -36,8 +36,8 @@ type IPPoolList struct { // IPPoolSpec defines the desired state of IPPool. type IPPoolSpec struct { - // Type defines the type of this IPPool, Public or Private. - // +kubebuilder:validation:Enum=Public;Private + // Type defines the type of this IPPool, Public, Private or Project. + // +kubebuilder:validation:Enum=Public;Private;Project // +optional Type string `json:"type,omitempty"` // Subnets defines set of subnets need to be allocated. diff --git a/pkg/apis/v1alpha1/networkinfo_types.go b/pkg/apis/v1alpha1/networkinfo_types.go index 4785fa7ec..5327cec21 100644 --- a/pkg/apis/v1alpha1/networkinfo_types.go +++ b/pkg/apis/v1alpha1/networkinfo_types.go @@ -8,8 +8,8 @@ import ( ) // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:storageversion // NetworkInfo is used to report the network information for a namespace. // +kubebuilder:resource:path=networkinfos @@ -20,7 +20,7 @@ type NetworkInfo struct { VPCs []VPCState `json:"vpcs"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // NetworkInfoList contains a list of NetworkInfo. type NetworkInfoList struct { @@ -40,7 +40,7 @@ type VPCState struct { // LoadBalancerIPAddresses (AVI SE Subnet CIDR or NSX LB SNAT IPs). LoadBalancerIPAddresses string `json:"loadBalancerIPAddresses,omitempty"` // Private CIDRs used for the VPC. - PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` + PrivateIPs []string `json:"privateIPs,omitempty"` } func init() { diff --git a/pkg/apis/v1alpha1/subnet_types.go b/pkg/apis/v1alpha1/subnet_types.go index 47553cd10..82ecdb839 100644 --- a/pkg/apis/v1alpha1/subnet_types.go +++ b/pkg/apis/v1alpha1/subnet_types.go @@ -16,7 +16,8 @@ type SubnetSpec struct { // +kubebuilder:validation:Minimum:=16 IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"` // Access mode of Subnet, accessible only from within VPC or from outside VPC. - // +kubebuilder:validation:Enum=Private;Public + // +kubebuilder:default:=Private + // +kubebuilder:validation:Enum=Private;Public;Project AccessMode AccessMode `json:"accessMode,omitempty"` // Subnet CIDRS. // +kubebuilder:validation:MinItems=0 @@ -38,9 +39,9 @@ type SubnetStatus struct { } // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Subnet is the Schema for the subnets API. // +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet" @@ -54,7 +55,7 @@ type Subnet struct { Status SubnetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // SubnetList contains a list of Subnet. type SubnetList struct { diff --git a/pkg/apis/v1alpha1/subnetset_types.go b/pkg/apis/v1alpha1/subnetset_types.go index 3d8883355..275db8762 100644 --- a/pkg/apis/v1alpha1/subnetset_types.go +++ b/pkg/apis/v1alpha1/subnetset_types.go @@ -14,7 +14,8 @@ type SubnetSetSpec struct { // +kubebuilder:validation:Minimum:=16 IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"` // Access mode of Subnet, accessible only from within VPC or from outside VPC. - // +kubebuilder:validation:Enum=Private;Public + // +kubebuilder:default:=Private + // +kubebuilder:validation:Enum=Private;Public;Project AccessMode AccessMode `json:"accessMode,omitempty"` // Subnet advanced configuration. AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"` @@ -37,9 +38,9 @@ type SubnetSetStatus struct { } // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetSet is the Schema for the subnetsets API. // +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet" @@ -53,7 +54,7 @@ type SubnetSet struct { Status SubnetSetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // SubnetSetList contains a list of SubnetSet. type SubnetSetList struct { diff --git a/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go b/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go index 9ba4babbc..05f4dac80 100644 --- a/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go +++ b/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go @@ -9,8 +9,13 @@ import ( ) const ( - AccessModePublic string = "Public" - AccessModePrivate string = "Private" + AccessModePublic string = "Public" + AccessModePrivate string = "Private" + AccessModeProject string = "Project" + LbServiceSizeSmall string = "SMALL" + LbServiceSizeMedium string = "MEDIUM" + LbServiceSizeLarge string = "LARGE" + LbServiceSizeXlarge string = "XLARGE" ) // VPCNetworkConfigurationSpec defines the desired state of VPCNetworkConfiguration. @@ -19,33 +24,32 @@ const ( // in a Namespace's VPCNetworkConfiguration, the Namespace will use the value // in the default VPCNetworkConfiguration. type VPCNetworkConfigurationSpec struct { - // PolicyPath of Tier0 or Tier0 VRF gateway. - DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"` - // Edge cluster path on which the networking elements will be created. - EdgeClusterPath string `json:"edgeClusterPath,omitempty"` // NSX-T Project the Namespace associated with. NSXTProject string `json:"nsxtProject,omitempty"` - // NSX-T IPv4 Block paths used to allocate external Subnets. - // +kubebuilder:validation:MinItems=0 - // +kubebuilder:validation:MaxItems=5 - ExternalIPv4Blocks []string `json:"externalIPv4Blocks,omitempty"` - // Private IPv4 CIDRs used to allocate Private Subnets. - // +kubebuilder:validation:MinItems=0 - // +kubebuilder:validation:MaxItems=5 - PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` - // Default size of Subnet based upon estimated workload count. - // Defaults to 26. - // +kubebuilder:default=26 - DefaultIPv4SubnetSize int `json:"defaultIPv4SubnetSize,omitempty"` - // DefaultSubnetAccessMode defines the access mode of the default SubnetSet for PodVM and VM. - // Must be Public or Private. - // +kubebuilder:validation:Enum=Public;Private - DefaultSubnetAccessMode string `json:"defaultSubnetAccessMode,omitempty"` + + // VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment. + VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"` + + // Private IPs. + PrivateIPs []string `json:"privateIPs,omitempty"` + // ShortID specifies Identifier to use when displaying VPC context in logs. - // Less than or equal to 8 characters. + // Less than equal to 8 characters. // +kubebuilder:validation:MaxLength=8 // +optional ShortID string `json:"shortID,omitempty"` + + // +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE + LbServiceSize string `json:"lbServiceSize,omitempty"` + + // Default size of Subnet based upon estimated workload count. + // Defaults to 26. + // +kubebuilder:default=26 + DefaultSubnetSize int `json:"defaultSubnetSize,omitempty"` + // PodSubnetAccessMode defines the access mode of the default SubnetSet for PodVM. + // Must be Public or Private. + // +kubebuilder:validation:Enum=Public;Private;Project + PodSubnetAccessMode string `json:"podSubnetAccessMode,omitempty"` } // VPCNetworkConfigurationStatus defines the observed state of VPCNetworkConfiguration @@ -64,15 +68,15 @@ type VPCInfo struct { // +genclient // +genclient:nonNamespaced -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCNetworkConfiguration is the Schema for the vpcnetworkconfigurations API. // +kubebuilder:resource:scope="Cluster" // +kubebuilder:printcolumn:name="NSXTProject",type=string,JSONPath=`.spec.nsxtProject`,description="NSXTProject the Namespace associated with" // +kubebuilder:printcolumn:name="ExternalIPv4Blocks",type=string,JSONPath=`.spec.externalIPv4Blocks`,description="ExternalIPv4Blocks assigned to the Namespace" -// +kubebuilder:printcolumn:name="PrivateIPv4CIDRs",type=string,JSONPath=`.spec.privateIPv4CIDRs`,description="PrivateIPv4CIDRs assigned to the Namespace" +// +kubebuilder:printcolumn:name="PrivateIPs",type=string,JSONPath=`.spec.privateIPs`,description="PrivateIPs assigned to the Namespace" type VPCNetworkConfiguration struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -81,7 +85,7 @@ type VPCNetworkConfiguration struct { Status VPCNetworkConfigurationStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // VPCNetworkConfigurationList contains a list of VPCNetworkConfiguration. type VPCNetworkConfigurationList struct { diff --git a/pkg/apis/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/v1alpha1/zz_generated.deepcopy.go index 5919f2d28..12361c174 100644 --- a/pkg/apis/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/v1alpha1/zz_generated.deepcopy.go @@ -80,6 +80,102 @@ func (in *DNSClientConfig) DeepCopy() *DNSClientConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocation) DeepCopyInto(out *IPAddressAllocation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocation. +func (in *IPAddressAllocation) DeepCopy() *IPAddressAllocation { + if in == nil { + return nil + } + out := new(IPAddressAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressAllocation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationList) DeepCopyInto(out *IPAddressAllocationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPAddressAllocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationList. +func (in *IPAddressAllocationList) DeepCopy() *IPAddressAllocationList { + if in == nil { + return nil + } + out := new(IPAddressAllocationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPAddressAllocationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationSpec) DeepCopyInto(out *IPAddressAllocationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationSpec. +func (in *IPAddressAllocationSpec) DeepCopy() *IPAddressAllocationSpec { + if in == nil { + return nil + } + out := new(IPAddressAllocationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAddressAllocationStatus) DeepCopyInto(out *IPAddressAllocationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationStatus. +func (in *IPAddressAllocationStatus) DeepCopy() *IPAddressAllocationStatus { + if in == nil { + return nil + } + out := new(IPAddressAllocationStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IPBlock) DeepCopyInto(out *IPBlock) { *out = *in @@ -1334,13 +1430,8 @@ func (in *VPCNetworkConfigurationList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCNetworkConfigurationSpec) DeepCopyInto(out *VPCNetworkConfigurationSpec) { *out = *in - if in.ExternalIPv4Blocks != nil { - in, out := &in.ExternalIPv4Blocks, &out.ExternalIPv4Blocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.PrivateIPv4CIDRs != nil { - in, out := &in.PrivateIPv4CIDRs, &out.PrivateIPv4CIDRs + if in.PrivateIPs != nil { + in, out := &in.PrivateIPs, &out.PrivateIPs *out = make([]string, len(*in)) copy(*out, *in) } @@ -1379,8 +1470,8 @@ func (in *VPCNetworkConfigurationStatus) DeepCopy() *VPCNetworkConfigurationStat // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCState) DeepCopyInto(out *VPCState) { *out = *in - if in.PrivateIPv4CIDRs != nil { - in, out := &in.PrivateIPv4CIDRs, &out.PrivateIPv4CIDRs + if in.PrivateIPs != nil { + in, out := &in.PrivateIPs, &out.PrivateIPs *out = make([]string, len(*in)) copy(*out, *in) } @@ -1395,92 +1486,3 @@ func (in *VPCState) DeepCopy() *VPCState { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocation) DeepCopyInto(out *IPAddressAllocation) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocation. -func (in *IPAddressAllocation) DeepCopy() *IPAddressAllocation { - if in == nil { - return nil - } - out := new(IPAddressAllocation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAddressAllocation) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationList) DeepCopyInto(out *IPAddressAllocationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IPAddressAllocation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationList. -func (in *IPAddressAllocationList) DeepCopy() *IPAddressAllocationList { - if in == nil { - return nil - } - out := new(IPAddressAllocationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPAddressAllocationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationSpec) DeepCopyInto(out *IPAddressAllocationSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationSpec. -func (in *IPAddressAllocationSpec) DeepCopy() *IPAddressAllocationSpec { - if in == nil { - return nil - } - out := new(IPAddressAllocationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPAddressAllocationStatus) DeepCopyInto(out *IPAddressAllocationStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressAllocationStatus. -func (in *IPAddressAllocationStatus) DeepCopy() *IPAddressAllocationStatus { - if in == nil { - return nil - } - out := new(IPAddressAllocationStatus) - in.DeepCopyInto(out) - return out -} \ No newline at end of file diff --git a/pkg/apis/v1alpha2/ippool_types.go b/pkg/apis/v1alpha2/ippool_types.go index 469dc43ef..a6d995d7c 100644 --- a/pkg/apis/v1alpha2/ippool_types.go +++ b/pkg/apis/v1alpha2/ippool_types.go @@ -10,9 +10,9 @@ import ( ) // +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPPool is the Schema for the ippools API. // +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,description="Type of IPPool" @@ -25,7 +25,7 @@ type IPPool struct { Status IPPoolStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true // IPPoolList contains a list of IPPool. type IPPoolList struct { @@ -36,8 +36,8 @@ type IPPoolList struct { // IPPoolSpec defines the desired state of IPPool. type IPPoolSpec struct { - // Type defines the type of this IPPool, Public or Private. - // +kubebuilder:validation:Enum=Public;Private + // Type defines the type of this IPPool, Public, Private or Project. + // +kubebuilder:validation:Enum=Public;Private;Project // +optional Type string `json:"type,omitempty"` // Subnets defines set of subnets need to be allocated. diff --git a/pkg/controllers/ippool/ippool_controller.go b/pkg/controllers/ippool/ippool_controller.go index 85e0c9722..632d0d3de 100644 --- a/pkg/controllers/ippool/ippool_controller.go +++ b/pkg/controllers/ippool/ippool_controller.go @@ -127,7 +127,7 @@ func (r *IPPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr } // TODO: As we do not have base controller in Go, we need to take care of NSX exceptions in each controller separately. - //I agree we should not do infinite retry for all errors, but it's ok to add error handling in a following patch + // I agree we should not do infinite retry for all errors, but it's ok to add error handling in a following patch // TODO: Since only the cloud provider creates it, we can take all the validation logic into consideration later. @@ -145,7 +145,7 @@ func (r *IPPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr updateFail(r, &ctx, obj, &err) return resultRequeue, err } - obj.Spec.Type = vpcNetworkConfig.DefaultSubnetAccessMode + obj.Spec.Type = vpcNetworkConfig.PodSubnetAccessMode } if obj.ObjectMeta.DeletionTimestamp.IsZero() { diff --git a/pkg/controllers/networkinfo/networkinfo_controller.go b/pkg/controllers/networkinfo/networkinfo_controller.go index 06e62de74..197860a99 100644 --- a/pkg/controllers/networkinfo/networkinfo_controller.go +++ b/pkg/controllers/networkinfo/networkinfo_controller.go @@ -86,7 +86,7 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) VPCPath: *createdVpc.Path, DefaultSNATIP: "", LoadBalancerIPAddresses: "", - PrivateIPv4CIDRs: nc.PrivateIPv4CIDRs, + PrivateIPs: nc.PrivateIPs, } log.Error(err, "update avi rule failed, would retry exponentially", "NetworkInfo", req.NamespacedName) updateFail(r, &ctx, obj, &err, r.Client, state) @@ -106,7 +106,7 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) VPCPath: *createdVpc.Path, DefaultSNATIP: "", LoadBalancerIPAddresses: "", - PrivateIPv4CIDRs: nc.PrivateIPv4CIDRs, + PrivateIPs: nc.PrivateIPs, } updateFail(r, &ctx, obj, &err, r.Client, state) return common.ResultRequeueAfter10sec, err @@ -125,7 +125,7 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) VPCPath: *createdVpc.Path, DefaultSNATIP: snatIP, LoadBalancerIPAddresses: "", - PrivateIPv4CIDRs: nc.PrivateIPv4CIDRs, + PrivateIPs: nc.PrivateIPs, } updateFail(r, &ctx, obj, &err, r.Client, state) return common.ResultRequeueAfter10sec, err @@ -137,7 +137,7 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) VPCPath: *createdVpc.Path, DefaultSNATIP: snatIP, LoadBalancerIPAddresses: cidr, - PrivateIPv4CIDRs: nc.PrivateIPv4CIDRs, + PrivateIPs: nc.PrivateIPs, } updateSuccess(r, &ctx, obj, r.Client, state, nc.Name, path) } else { diff --git a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go index e580dbf2a..e38826baa 100644 --- a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go +++ b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go @@ -52,15 +52,8 @@ func (h *VPCNetworkConfigurationHandler) Generic(_ context.Context, _ event.Gene func (h *VPCNetworkConfigurationHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { log.V(1).Info("start processing VPC network config update event") - oldNc := e.ObjectOld.(*v1alpha1.VPCNetworkConfiguration) newNc := e.ObjectNew.(*v1alpha1.VPCNetworkConfiguration) - if getListSize(oldNc.Spec.ExternalIPv4Blocks) == getListSize(newNc.Spec.ExternalIPv4Blocks) && - getListSize(oldNc.Spec.PrivateIPv4CIDRs) == getListSize(newNc.Spec.PrivateIPv4CIDRs) { - log.V(1).Info("only support updating external/private ipv4 cidr, no change") - return - } - // update network config info in store info, err := buildNetworkConfigInfo(*newNc) if err != nil { @@ -105,14 +98,6 @@ var VPCNetworkConfigurationPredicate = predicate.Funcs{ }, } -func getListSize(s []string) int { - if s == nil { - return 0 - } else { - return len(s) - } -} - func buildNetworkConfigInfo(vpcConfigCR v1alpha1.VPCNetworkConfiguration) (*commontypes.VPCNetworkConfigInfo, error) { org, project, err := nsxtProjectPathToId(vpcConfigCR.Spec.NSXTProject) if err != nil { @@ -121,17 +106,16 @@ func buildNetworkConfigInfo(vpcConfigCR v1alpha1.VPCNetworkConfiguration) (*comm } ninfo := &commontypes.VPCNetworkConfigInfo{ - IsDefault: isDefaultNetworkConfigCR(vpcConfigCR), - Org: org, - Name: vpcConfigCR.Name, - DefaultGatewayPath: vpcConfigCR.Spec.DefaultGatewayPath, - EdgeClusterPath: vpcConfigCR.Spec.EdgeClusterPath, - NsxtProject: project, - ExternalIPv4Blocks: vpcConfigCR.Spec.ExternalIPv4Blocks, - PrivateIPv4CIDRs: vpcConfigCR.Spec.PrivateIPv4CIDRs, - DefaultIPv4SubnetSize: vpcConfigCR.Spec.DefaultIPv4SubnetSize, - DefaultSubnetAccessMode: vpcConfigCR.Spec.DefaultSubnetAccessMode, - ShortID: vpcConfigCR.Spec.ShortID, + IsDefault: isDefaultNetworkConfigCR(vpcConfigCR), + Org: org, + Name: vpcConfigCR.Name, + VPCConnectivityProfile: vpcConfigCR.Spec.VPCConnectivityProfile, + LbServiceSize: vpcConfigCR.Spec.LbServiceSize, + NsxtProject: project, + PrivateIPs: vpcConfigCR.Spec.PrivateIPs, + DefaultSubnetSize: vpcConfigCR.Spec.DefaultSubnetSize, + PodSubnetAccessMode: vpcConfigCR.Spec.PodSubnetAccessMode, + ShortID: vpcConfigCR.Spec.ShortID, } return ninfo, nil } diff --git a/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go b/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go index 85a464933..f98a8ae4f 100644 --- a/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go +++ b/pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go @@ -73,22 +73,24 @@ func TestBuildNetworkConfigInfo(t *testing.T) { assert.NotNil(t, e) spec1 := v1alpha1.VPCNetworkConfigurationSpec{ - DefaultGatewayPath: "test-gw-path-1", - EdgeClusterPath: "test-edge-path-1", - ExternalIPv4Blocks: []string{"external-ipb-1", "external-ipb-2"}, - PrivateIPv4CIDRs: []string{"private-ipb-1", "private-ipb-2"}, - DefaultIPv4SubnetSize: 64, - DefaultSubnetAccessMode: "Public", - NSXTProject: "/orgs/default/projects/nsx_operator_e2e_test", + // DefaultGatewayPath: "test-gw-path-1", + // EdgeClusterPath: "test-edge-path-1", + // ExternalIPv4Blocks: []string{"external-ipb-1", "external-ipb-2"}, + PrivateIPs: []string{"private-ipb-1", "private-ipb-2"}, + DefaultSubnetSize: 64, + // VPCServiceProfile: "test-VpcServiceProfile", + VPCConnectivityProfile: "test-VPCConnectivityProfile", + PodSubnetAccessMode: "Public", + NSXTProject: "/orgs/default/projects/nsx_operator_e2e_test", } spec2 := v1alpha1.VPCNetworkConfigurationSpec{ - DefaultGatewayPath: "test-gw-path-2", - EdgeClusterPath: "test-edge-path-2", - ExternalIPv4Blocks: []string{"external-ipb-1", "external-ipb-2"}, - PrivateIPv4CIDRs: []string{"private-ipb-1", "private-ipb-2"}, - DefaultIPv4SubnetSize: 32, - DefaultSubnetAccessMode: "Private", - NSXTProject: "/orgs/anotherOrg/projects/anotherProject", + // DefaultGatewayPath: "test-gw-path-2", + // EdgeClusterPath: "test-edge-path-2", + // ExternalIPv4Blocks: []string{"external-ipb-1", "external-ipb-2"}, + PrivateIPs: []string{"private-ipb-1", "private-ipb-2"}, + DefaultSubnetSize: 32, + PodSubnetAccessMode: "Private", + NSXTProject: "/orgs/anotherOrg/projects/anotherProject", } testCRD1 := v1alpha1.VPCNetworkConfiguration{ Spec: spec1, @@ -110,30 +112,31 @@ func TestBuildNetworkConfigInfo(t *testing.T) { testCRD3.Name = "test-3" tests := []struct { - name string - nc v1alpha1.VPCNetworkConfiguration - gw string - edge string - org string - project string - subnetSize int - accessMode string - isDefault bool + name string + nc v1alpha1.VPCNetworkConfiguration + gw string + edge string + org string + project string + subnetSize int + accessMode string + isDefault bool + vpcConnectivityProfile string }{ - {"1", testCRD1, "test-gw-path-1", "test-edge-path-1", "default", "nsx_operator_e2e_test", 64, "Public", false}, - {"2", testCRD2, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private", false}, - {"3", testCRD3, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private", true}, + {"test-nsxtProjectPathToId", testCRD1, "test-gw-path-1", "test-edge-path-1", "default", "nsx_operator_e2e_test", 64, "Public", false, ""}, + {"with-VPCConnectivityProfile", testCRD2, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private", false, "test-VpcConnectivityProfile"}, + {"with-defaultNetworkConfig", testCRD3, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private", true, ""}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { nc, e := buildNetworkConfigInfo(tt.nc) assert.Nil(t, e) - assert.Equal(t, tt.gw, nc.DefaultGatewayPath) - assert.Equal(t, tt.edge, nc.EdgeClusterPath) + // assert.Equal(t, tt.gw, nc.DefaultGatewayPath) + // assert.Equal(t, tt.edge, nc.EdgeClusterPath) assert.Equal(t, tt.org, nc.Org) assert.Equal(t, tt.project, nc.NsxtProject) - assert.Equal(t, tt.subnetSize, nc.DefaultIPv4SubnetSize) - assert.Equal(t, tt.accessMode, nc.DefaultSubnetAccessMode) + assert.Equal(t, tt.subnetSize, nc.DefaultSubnetSize) + assert.Equal(t, tt.accessMode, nc.PodSubnetAccessMode) assert.Equal(t, tt.isDefault, nc.IsDefault) }) } diff --git a/pkg/controllers/subnet/subnet_controller.go b/pkg/controllers/subnet/subnet_controller.go index d2de63968..4a8a098c7 100644 --- a/pkg/controllers/subnet/subnet_controller.go +++ b/pkg/controllers/subnet/subnet_controller.go @@ -84,10 +84,10 @@ func (r *SubnetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr return ResultRequeue, err } if obj.Spec.AccessMode == "" { - obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultSubnetAccessMode) + obj.Spec.AccessMode = v1alpha1.AccessMode(v1alpha1.AccessModePrivate) } if obj.Spec.IPv4SubnetSize == 0 { - obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultIPv4SubnetSize + obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultSubnetSize } } tags := r.SubnetService.GenerateSubnetNSTags(obj, obj.Namespace) diff --git a/pkg/controllers/subnetset/subnetset_controller.go b/pkg/controllers/subnetset/subnetset_controller.go index b50fa42b6..d9fcb27e8 100644 --- a/pkg/controllers/subnetset/subnetset_controller.go +++ b/pkg/controllers/subnetset/subnetset_controller.go @@ -75,10 +75,10 @@ func (r *SubnetSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( return ResultRequeue, err } if obj.Spec.AccessMode == "" { - obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultSubnetAccessMode) + obj.Spec.AccessMode = v1alpha1.AccessMode(v1alpha1.AccessModePrivate) } if obj.Spec.IPv4SubnetSize == 0 { - obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultIPv4SubnetSize + obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultSubnetSize } } if err := r.Client.Update(ctx, obj); err != nil { diff --git a/pkg/nsx/services/common/types.go b/pkg/nsx/services/common/types.go index 08d671dff..68fbeaf4c 100644 --- a/pkg/nsx/services/common/types.go +++ b/pkg/nsx/services/common/types.go @@ -191,19 +191,19 @@ type VPCResourceInfo struct { ID string ParentID string PrivateIpv4Blocks []string - ExternalIPv4Blocks []string + ExternalIPv4Blocks []string // deprecated, existing field } type VPCNetworkConfigInfo struct { - IsDefault bool - Org string - Name string - DefaultGatewayPath string - EdgeClusterPath string - NsxtProject string - ExternalIPv4Blocks []string - PrivateIPv4CIDRs []string - DefaultIPv4SubnetSize int - DefaultSubnetAccessMode string - ShortID string + IsDefault bool + Org string + Name string + VPCConnectivityProfile string + LbServiceSize string + NsxtProject string + ExternalIPv4Blocks []string + PrivateIPs []string + DefaultSubnetSize int + PodSubnetAccessMode string + ShortID string } diff --git a/pkg/nsx/services/vpc/builder.go b/pkg/nsx/services/vpc/builder.go index 5189ac73e..592d7ac8e 100644 --- a/pkg/nsx/services/vpc/builder.go +++ b/pkg/nsx/services/vpc/builder.go @@ -50,9 +50,7 @@ func buildPrivateIpBlock(networkInfo *v1alpha1.NetworkInfo, nsObj *v1.Namespace, return block } -func buildNSXVPC(obj *v1alpha1.NetworkInfo, nsObj *v1.Namespace, nc common.VPCNetworkConfigInfo, cluster string, pathMap map[string]string, - nsxVPC *model.Vpc) (*model.Vpc, - error) { +func buildNSXVPC(obj *v1alpha1.NetworkInfo, nsObj *v1.Namespace, nc common.VPCNetworkConfigInfo, cluster string, pathMap map[string]string, nsxVPC *model.Vpc) (*model.Vpc, error) { vpc := &model.Vpc{} if nsxVPC != nil { // for upgrade case, only check public/private ip block size changing @@ -67,21 +65,17 @@ func buildNSXVPC(obj *v1alpha1.NetworkInfo, nsObj *v1.Namespace, nc common.VPCNe vpcName := util.GenerateDisplayName("", "vpc", obj.GetNamespace(), "", cluster) vpc.DisplayName = &vpcName vpc.Id = common.String(string(nsObj.GetUID())) - vpc.DefaultGatewayPath = &nc.DefaultGatewayPath vpc.IpAddressType = &DefaultVPCIPAddressType - siteInfos := []model.SiteInfo{ - { - EdgeClusterPaths: []string{nc.EdgeClusterPath}, - }, - } - vpc.SiteInfos = siteInfos vpc.LoadBalancerVpcEndpoint = &model.LoadBalancerVPCEndpoint{Enabled: &DefaultLoadBalancerVPCEndpointEnabled} vpc.Tags = util.BuildBasicTags(cluster, obj, nsObj.UID) } + vpc.VpcConnectivityProfile = &nc.VPCConnectivityProfile + + // set PrivateIps here will fai, with error:"Error occurred while allocating IPs for VPC Subnet." + // vpc.PrivateIps = nc.PrivateIPs // update private/public blocks - vpc.ExternalIpv4Blocks = nc.ExternalIPv4Blocks vpc.PrivateIpv4Blocks = util.GetMapValues(pathMap) if nc.ShortID != "" { vpc.ShortId = &nc.ShortID diff --git a/pkg/nsx/services/vpc/compare.go b/pkg/nsx/services/vpc/compare.go index f41ccb66c..78b08f1e8 100644 --- a/pkg/nsx/services/vpc/compare.go +++ b/pkg/nsx/services/vpc/compare.go @@ -13,7 +13,7 @@ func IsVPCChanged(nc common.VPCNetworkConfigInfo, vpc *model.Vpc) bool { return true } - if len(nc.PrivateIPv4CIDRs) != len(vpc.PrivateIpv4Blocks) { + if len(nc.PrivateIPs) != len(vpc.PrivateIpv4Blocks) { return true } diff --git a/pkg/nsx/services/vpc/vpc.go b/pkg/nsx/services/vpc/vpc.go index 415b92773..c41a7869c 100644 --- a/pkg/nsx/services/vpc/vpc.go +++ b/pkg/nsx/services/vpc/vpc.go @@ -139,7 +139,7 @@ func (s *VPCService) GetVPCNetworkConfigByNamespace(ns string) *common.VPCNetwor // TBD: for now, if network config info do not contains private cidr, we consider this is // incorrect configuration, and skip creating this VPC CR func (s *VPCService) ValidateNetworkConfig(nc common.VPCNetworkConfigInfo) bool { - return nc.PrivateIPv4CIDRs != nil && len(nc.PrivateIPv4CIDRs) != 0 + return nc.PrivateIPs != nil && len(nc.PrivateIPs) != 0 } // InitializeVPC sync NSX resources @@ -173,11 +173,11 @@ func InitializeVPC(service common.Service) (*VPCService, error) { VPCService.VPCNSNetworkConfigStore = VPCNsNetworkConfigStore{ VPCNSNetworkConfigMap: make(map[string]string), } - //initialize vpc store and ip blocks store + // initialize vpc store and ip blocks store go VPCService.InitializeResourceStore(&wg, fatalErrors, common.ResourceTypeVpc, nil, VPCService.VpcStore) go VPCService.InitializeResourceStore(&wg, fatalErrors, common.ResourceTypeIPBlock, nil, VPCService.IpblockStore) - //initalize avi rule related store + // initialize avi rule related store if enableAviAllowRule { VPCService.RuleStore = &AviRuleStore{ResourceStore: common.ResourceStore{ Indexer: cache.NewIndexer(keyFuncAVI, nil), @@ -306,8 +306,8 @@ func (s *VPCService) CreateOrUpdatePrivateIPBlock(obj *v1alpha1.NetworkInfo, nsO error) { // if network config contains PrivateIPV4CIDRs section, create private ip block for each cidr path := map[string]string{} - if nc.PrivateIPv4CIDRs != nil { - for _, pCidr := range nc.PrivateIPv4CIDRs { + if nc.PrivateIPs != nil { + for _, pCidr := range nc.PrivateIPs { log.Info("start processing private cidr", "cidr", pCidr) // if parse success, then check if private cidr exist, here we suppose it must be a cidr format string ip, _, err := net.ParseCIDR(pCidr) diff --git a/test/e2e/manifest/testVPC/customize_networkconfig.yaml b/test/e2e/manifest/testVPC/customize_networkconfig.yaml index 913c8e46d..c8f291954 100644 --- a/test/e2e/manifest/testVPC/customize_networkconfig.yaml +++ b/test/e2e/manifest/testVPC/customize_networkconfig.yaml @@ -5,15 +5,11 @@ kind: VPCNetworkConfiguration metadata: name: selfdefinedconfig spec: - defaultGatewayPath: /infra/tier-0s/PLR - # nsx-operator-ci would replace '{edge-cluster-id}' with real edge-cluster-id of testbed - edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/{edge-cluster-id} - defaultIPv4SubnetSize: 26 + defaultSubnetSize: 26 nsxtProject: /orgs/default/projects/nsx_operator_e2e_test - externalIPv4Blocks: - - /infra/ip-blocks/e2e_test_external_ip_blk - privateIPv4CIDRs: + privateIPs: - 172.29.0.0/16 - 172.39.0.0/16 - defaultSubnetAccessMode: Public + podSubnetAccessMode: Public + vpcConnectivityProfile: "" \ No newline at end of file diff --git a/test/e2e/manifest/testVPC/customize_networkconfig_updated.yaml b/test/e2e/manifest/testVPC/customize_networkconfig_updated.yaml index a718cd518..625c5a909 100644 --- a/test/e2e/manifest/testVPC/customize_networkconfig_updated.yaml +++ b/test/e2e/manifest/testVPC/customize_networkconfig_updated.yaml @@ -5,16 +5,12 @@ kind: VPCNetworkConfiguration metadata: name: selfdefinedconfig spec: - defaultGatewayPath: /infra/tier-0s/PLR - # nsx-operator-ci would replace '{edge-cluster-id}' with real edge-cluster-id of testbed - edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/{edge-cluster-id} - defaultIPv4SubnetSize: 26 + defaultSubnetSize: 26 nsxtProject: /orgs/default/projects/nsx_operator_e2e_test - externalIPv4Blocks: - - /infra/ip-blocks/e2e_test_external_ip_blk - privateIPv4CIDRs: + privateIPs: - 172.29.0.0/16 - 172.39.0.0/16 - 172.49.0.0/16 - defaultSubnetAccessMode: Public + podSubnetAccessMode: Public + vpcConnectivityProfile: "" \ No newline at end of file diff --git a/test/e2e/manifest/testVPC/default_networkconfig.yaml b/test/e2e/manifest/testVPC/default_networkconfig.yaml index dbfb2edb3..1d470daea 100644 --- a/test/e2e/manifest/testVPC/default_networkconfig.yaml +++ b/test/e2e/manifest/testVPC/default_networkconfig.yaml @@ -9,14 +9,10 @@ metadata: annotations: nsx.vmware.com/default: "true" spec: - defaultGatewayPath: /infra/tier-0s/PLR - # nsx-operator-ci would replace '{edge-cluster-id}' with real edge-cluster-id of testbed - edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/{edge-cluster-id} - defaultIPv4SubnetSize: 26 + defaultSubnetSize: 26 nsxtProject: /orgs/default/projects/nsx_operator_e2e_test - externalIPv4Blocks: - - /infra/ip-blocks/e2e_test_external_ip_blk - privateIPv4CIDRs: + privateIPs: - 172.28.0.0/16 - 172.38.0.0/16 - defaultSubnetAccessMode: Public + podSubnetAccessMode: Public + vpcConnectivityProfile: "" diff --git a/test/e2e/manifest/testVPC/system_networkconfig.yaml b/test/e2e/manifest/testVPC/system_networkconfig.yaml index 843f7b5d0..c04afc176 100644 --- a/test/e2e/manifest/testVPC/system_networkconfig.yaml +++ b/test/e2e/manifest/testVPC/system_networkconfig.yaml @@ -6,15 +6,11 @@ kind: VPCNetworkConfiguration metadata: name: system spec: - defaultGatewayPath: /infra/tier-0s/PLR - # nsx-operator-ci would replace '{edge-cluster-id}' with real edge-cluster-id of testbed - edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/{edge-cluster-id} - defaultIPv4SubnetSize: 26 + defaultSubnetSize: 26 nsxtProject: /orgs/default/projects/nsx_operator_e2e_test - externalIPv4Blocks: - - /infra/ip-blocks/e2e_test_external_ip_blk - privateIPv4CIDRs: + privateIPs: - 172.27.0.0/16 - 172.37.0.0/16 - defaultSubnetAccessMode: Public + podSubnetAccessMode: Public + vpcConnectivityProfile: "" \ No newline at end of file diff --git a/test/e2e/nsx_networkinfo_test.go b/test/e2e/nsx_networkinfo_test.go index de628682e..ec99df325 100644 --- a/test/e2e/nsx_networkinfo_test.go +++ b/test/e2e/nsx_networkinfo_test.go @@ -78,7 +78,7 @@ func TestCustomizedNetworkInfo(t *testing.T) { err := testData.waitForResourceExistByPath(vpcPath, true) assertNil(t, err) - //verify private ipblocks created for vpc + // verify private ipblocks created for vpc p_ipb_id1 := ns_uid + "_" + CustomizedPrivateCIDR1 p_ipb_id2 := ns_uid + "_" + CustomizedPrivateCIDR2 @@ -97,7 +97,7 @@ func TestInfraNetworkInfo(t *testing.T) { err := testData.waitForResourceExistByPath(vpcPath, true) assertNil(t, err) - //verify private ipblocks created for vpc + // verify private ipblocks created for vpc p_ipb_id1 := ns_uid + "_" + InfraPrivateCIDR1 p_ipb_id2 := ns_uid + "_" + InfraPrivateCIDR2 @@ -128,7 +128,7 @@ func TestDefaultNetworkInfo(t *testing.T) { err := testData.waitForResourceExistByPath(vpcPath, true) assertNil(t, err) - //verify private ipblocks created for vpc, id is nsuid + cidr + // verify private ipblocks created for vpc, id is nsuid + cidr p_ipb_id1 := ns_uid + "_" + DefaultPrivateCIDR1 p_ipb_id2 := ns_uid + "_" + DefaultPrivateCIDR2 @@ -171,7 +171,7 @@ func TestSharedNetworkInfo(t *testing.T) { assertTrue(t, vpcPath == vpcPath1, "vpcPath %s should be the same as vpcPath2 %s", vpcPath, vpcPath1) - //verify private ipblocks created for vpc, id is nsuid + cidr + // verify private ipblocks created for vpc, id is nsuid + cidr p_ipb_id1 := ns_uid + "_" + CustomizedPrivateCIDR1 p_ipb_id2 := ns_uid + "_" + CustomizedPrivateCIDR2 @@ -205,12 +205,12 @@ func TestUpdateVPCNetworkconfigNetworkInfo(t *testing.T) { // Check networkinfo cr existence networkinfo_name, _ := verifyCRCreated(t, NetworkInfoCRType, ns, 1) - privateIPv4CIDRs, err := testData.getCRPropertiesByJson(defaultTimeout, NetworkInfoCRType, networkinfo_name, ns, ".vpcs[0].privateIPv4CIDRs") - assertTrue(t, strings.Contains(privateIPv4CIDRs, CustomizedPrivateCIDR1), "privateIPv4CIDRs %s should contain %s", privateIPv4CIDRs, CustomizedPrivateCIDR1) - assertTrue(t, strings.Contains(privateIPv4CIDRs, CustomizedPrivateCIDR2), "privateIPv4CIDRs %s should contain %s", privateIPv4CIDRs, CustomizedPrivateCIDR1) + privateIPs, err := testData.getCRPropertiesByJson(defaultTimeout, NetworkInfoCRType, networkinfo_name, ns, ".vpcs[0].privateIPs") + assertTrue(t, strings.Contains(privateIPs, CustomizedPrivateCIDR1), "privateIPs %s should contain %s", privateIPs, CustomizedPrivateCIDR1) + assertTrue(t, strings.Contains(privateIPs, CustomizedPrivateCIDR2), "privateIPs %s should contain %s", privateIPs, CustomizedPrivateCIDR1) assertNil(t, err) - //verify private ipblocks created for vpc, id is nsuid + cidr + // verify private ipblocks created for vpc, id is nsuid + cidr p_ipb_id1 := ns_uid + "_" + CustomizedPrivateCIDR1 p_ipb_id2 := ns_uid + "_" + CustomizedPrivateCIDR2 @@ -220,8 +220,8 @@ func TestUpdateVPCNetworkconfigNetworkInfo(t *testing.T) { vncPath, _ := filepath.Abs("./manifest/testVPC/customize_networkconfig_updated.yaml") _ = applyYAML(vncPath, "") - privateIPv4CIDRs, err = testData.getCRPropertiesByJson(defaultTimeout, NetworkInfoCRType, networkinfo_name, ns, ".vpcs[0].privateIPv4CIDRs") - assertTrue(t, strings.Contains(privateIPv4CIDRs, CustomizedPrivateCIDR3), "privateIPv4CIDRs %s should contain %s", privateIPv4CIDRs, CustomizedPrivateCIDR3) + privateIPs, err = testData.getCRPropertiesByJson(defaultTimeout, NetworkInfoCRType, networkinfo_name, ns, ".vpcs[0].privateIPs") + assertTrue(t, strings.Contains(privateIPs, CustomizedPrivateCIDR3), "privateIPs %s should contain %s", privateIPs, CustomizedPrivateCIDR3) assertNil(t, err) p_ipb_id3 := ns_uid + "_" + CustomizedPrivateCIDR3 verifyPrivateIPBlockCreated(t, ns, p_ipb_id3) diff --git a/test/e2e/nsx_subnet_test.go b/test/e2e/nsx_subnet_test.go index f89b56408..6fb1bb2c2 100644 --- a/test/e2e/nsx_subnet_test.go +++ b/test/e2e/nsx_subnet_test.go @@ -41,12 +41,12 @@ func verifySubnetSetCR(subnetSet string) bool { log.Printf("Failed to get %s/%s: %s", E2ENamespace, subnetSet, err) return false } - if string(subnetSetCR.Spec.AccessMode) != vpcNetworkConfig.Spec.DefaultSubnetAccessMode { - log.Printf("AccessMode is %s, while it's expected to be %s", subnetSetCR.Spec.AccessMode, vpcNetworkConfig.Spec.DefaultSubnetAccessMode) + if string(subnetSetCR.Spec.AccessMode) != vpcNetworkConfig.Spec.PodSubnetAccessMode { + log.Printf("AccessMode is %s, while it's expected to be %s", subnetSetCR.Spec.AccessMode, vpcNetworkConfig.Spec.PodSubnetAccessMode) return false } - if subnetSetCR.Spec.IPv4SubnetSize != vpcNetworkConfig.Spec.DefaultIPv4SubnetSize { - log.Printf("IPv4SubnetSize is %d, while it's expected to be %d", subnetSetCR.Spec.IPv4SubnetSize, vpcNetworkConfig.Spec.DefaultIPv4SubnetSize) + if subnetSetCR.Spec.IPv4SubnetSize != vpcNetworkConfig.Spec.DefaultSubnetSize { + log.Printf("IPv4SubnetSize is %d, while it's expected to be %d", subnetSetCR.Spec.IPv4SubnetSize, vpcNetworkConfig.Spec.DefaultSubnetSize) return false } return true