Skip to content

Commit

Permalink
update NetworkConfiguration CR with new VPC API
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Qiu <[email protected]>
  • Loading branch information
wenqiq committed Jul 15, 2024
1 parent 67a740a commit 3028d3b
Show file tree
Hide file tree
Showing 36 changed files with 334 additions and 339 deletions.
4 changes: 3 additions & 1 deletion build/yaml/crd/nsx.vmware.com_ippools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,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:
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/nsx.vmware.com_networkinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
name:
description: VPC name.
type: string
privateIPv4CIDRs:
privateIPs:
description: Private CIDRs used for the VPC.
items:
type: string
Expand Down
2 changes: 2 additions & 0 deletions build/yaml/crd/nsx.vmware.com_subnets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,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.
Expand Down
2 changes: 2 additions & 0 deletions build/yaml/crd/nsx.vmware.com_subnetsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,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.
Expand Down
75 changes: 38 additions & 37 deletions build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ spec:
scope: Cluster
versions:
- additionalPrinterColumns:
- description: NSXTProject the Namespace associated with
jsonPath: .spec.nsxtProject
name: NSXTProject
- description: NsxProject the Namespace associated with
jsonPath: .spec.nsxProject
name: NsxProject
type: string
- description: ExternalIPv4Blocks assigned to the Namespace
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:
Expand Down Expand Up @@ -58,55 +54,60 @@ spec:
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:
lbServiceSize:
enum:
- SMALL
- MEDIUM
- LARGE
- XLARGE
type: string
nsxProject:
description: NSX-T Project the Namespace associated with.
type: string
podSubnetAccessMode:
description: |-
DefaultSubnetAccessMode defines the access mode of the default SubnetSet for PodVM and VM.
PodSubnetAccessMode defines the access mode of the default SubnetSet for PodVM.
Must be Public or Private.
enum:
- Public
- Private
- Project
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.
privateIPs:
description: Private IPs.
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.
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.
Less than 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
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
vpcConnectivityProfile:
description: VpcConnectivityProfile ID. This profile has configuration
related to create VPC transit gateway attachment.
type: string
vpcServiceProfile:
description: The path of the configuration profile of the VPC services.
This will be an collection of default dhcp and subnet profiles.
The default vpc service profile will be created as part of new project
create workflow. That will be used as the default for all VPC created
under that project. The default value will be project specific default
VPC profile.
type: string
type: object
status:
description: VPCNetworkConfigurationStatus defines the observed state
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/samples/nsx_v1alpha1_networkinfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 7 additions & 5 deletions build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ metadata:
spec:
defaultGatewayPath: /infra/tier-0s/t0
edgeClusterPath: /infra/sites/default/enforcement-points/default/edge-clusters/2d9df59f-6dc6-4911-8865-21fadc23d4da
defaultIPv4SubnetSize: 26
nsxtProject: proj-1
defaultSubnetSize: 26
nsxProject: proj-1
externalIPv4Blocks:
- block1
privateIPv4CIDRs:
privateIPs:
- 172.26.0.0/16
- 172.36.0.0/16
defaultSubnetAccessMode: Private
podSubnetAccessMode: Private
---
# Sample to create VPCNetworkConfiguration CR using a pre-created NSX VPC.
apiVersion: nsx.vmware.com/v1alpha1
Expand All @@ -22,4 +22,6 @@ metadata:
spec:
vpc: /orgs/default/projects/proj-1/vpcs/vpc-1
defaultIPv4SubnetSize: 28
defaultSubnetAccessMode: Private
podSubnetAccessMode: Private
vpcConnectivityProfile: /orgs/default/projects/wenqi-test/vpc-connectivity-profiles/default
vpcServiceProfile: /orgs/default/projects/wenqi-test/vpc-service-profiles/default
8 changes: 4 additions & 4 deletions pkg/apis/nsx.vmware.com/v1alpha1/networkinfo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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() {
Expand Down
11 changes: 6 additions & 5 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 3028d3b

Please sign in to comment.