diff --git a/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml b/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml index 23b96a849..9589a5af9 100644 --- a/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml +++ b/build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml @@ -94,6 +94,11 @@ spec: context in logs. Less than or equal to 8 characters. maxLength: 8 type: string + vpc: + description: NSX path of the VPC the Namespace associated with. If + vpc is set, only defaultIPv4SubnetSize and defaultSubnetAccessMode + take effect, other fields are ignored. + type: string type: object status: description: VPCNetworkConfigurationStatus defines the observed state diff --git a/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml b/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml index c19703c2f..cba5a787f 100644 --- a/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml +++ b/build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml @@ -13,3 +13,13 @@ spec: - 172.26.0.0/16 - 172.36.0.0/16 defaultSubnetAccessMode: Private +--- +# Sample to create VPCNetworkConfiguration CR using a pre-created NSX VPC. +apiVersion: nsx.vmware.com/v1alpha1 +kind: VPCNetworkConfiguration +metadata: + name: vpc-network-config-with-pre-created-vpc +spec: + vpc: /orgs/default/projects/proj-1/vpcs/vpc-1 + defaultIPv4SubnetSize: 28 + defaultSubnetAccessMode: Private diff --git a/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go b/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go index 9ba4babbc..23355f5f9 100644 --- a/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go +++ b/pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go @@ -46,6 +46,11 @@ type VPCNetworkConfigurationSpec struct { // +kubebuilder:validation:MaxLength=8 // +optional ShortID string `json:"shortID,omitempty"` + // NSX path of the VPC the Namespace associated with. + // If vpc is set, only defaultIPv4SubnetSize and defaultSubnetAccessMode + // take effect, other fields are ignored. + // +optional + VPC string `json:"vpc,omitempty"` } // VPCNetworkConfigurationStatus defines the observed state of VPCNetworkConfiguration diff --git a/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go b/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go index 9ba4babbc..23355f5f9 100644 --- a/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go +++ b/pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go @@ -46,6 +46,11 @@ type VPCNetworkConfigurationSpec struct { // +kubebuilder:validation:MaxLength=8 // +optional ShortID string `json:"shortID,omitempty"` + // NSX path of the VPC the Namespace associated with. + // If vpc is set, only defaultIPv4SubnetSize and defaultSubnetAccessMode + // take effect, other fields are ignored. + // +optional + VPC string `json:"vpc,omitempty"` } // VPCNetworkConfigurationStatus defines the observed state of VPCNetworkConfiguration