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 <wenqiq@vmware.com>
  • Loading branch information
wenqiq committed Jul 11, 2024
1 parent 4bc8285 commit 0fe9fb3
Show file tree
Hide file tree
Showing 38 changed files with 544 additions and 533 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 @@ -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:
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 @@ -46,7 +46,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 @@ -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.
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 @@ -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.
Expand Down
109 changes: 59 additions & 50 deletions build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,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 All @@ -35,65 +31,78 @@ spec:
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
spec:
description: VPCNetworkConfigurationSpec defines the desired state of
VPCNetworkConfiguration. There is a default VPCNetworkConfiguration
that applies to Namespaces do not have a VPCNetworkConfiguration assigned.
When a field is not set in a Namespace's VPCNetworkConfiguration, the
Namespace will use the value in the default VPCNetworkConfiguration.
description: |-
VPCNetworkConfigurationSpec defines the desired state of VPCNetworkConfiguration.
There is a default VPCNetworkConfiguration that applies to Namespaces
do not have a VPCNetworkConfiguration assigned. 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.
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:
nsxProject:
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.
description: |-
ShortID specifies Identifier to use when displaying VPC 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
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
10 changes: 6 additions & 4 deletions build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ 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
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 0fe9fb3

Please sign in to comment.