Skip to content

Commit e54d5ac

Browse files
committed
update NetworkConfiguration CR with new VPC API
Signed-off-by: Wenqi Qiu <[email protected]>
1 parent 4bc8285 commit e54d5ac

30 files changed

+372
-371
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
bin/
33
.DS_Store
44
go.work
5-
go.work.sum
5+
go.work.sum
6+
vendor/
7+
.golangci-bin/

build/yaml/crd/nsx.vmware.com_ipaddressallocations.yaml

+12-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.11.0
7+
creationTimestamp: null
78
name: ipaddressallocations.nsx.vmware.com
89
spec:
910
group: nsx.vmware.com
@@ -29,19 +30,14 @@ spec:
2930
description: IPAddressAllocation is the Schema for the IP allocation API.
3031
properties:
3132
apiVersion:
32-
description: |-
33-
APIVersion defines the versioned schema of this representation of an object.
34-
Servers should convert recognized schemas to the latest internal value, and
35-
may reject unrecognized values.
36-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
33+
description: 'APIVersion defines the versioned schema of this representation
34+
of an object. Servers should convert recognized schemas to the latest
35+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3736
type: string
3837
kind:
39-
description: |-
40-
Kind is a string value representing the REST resource this object represents.
41-
Servers may infer this from the endpoint the client submits requests to.
42-
Cannot be updated.
43-
In CamelCase.
44-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
38+
description: 'Kind is a string value representing the REST resource this
39+
object represents. Servers may infer this from the endpoint the client
40+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4541
type: string
4642
metadata:
4743
type: object
@@ -73,10 +69,10 @@ spec:
7369
description: Condition defines condition of custom resource.
7470
properties:
7571
lastTransitionTime:
76-
description: |-
77-
Last time the condition transitioned from one status to another.
78-
This should be when the underlying condition changed. If that is not known, then using the time when
79-
the API field changed is acceptable.
72+
description: Last time the condition transitioned from one status
73+
to another. This should be when the underlying condition changed.
74+
If that is not known, then using the time when the API field
75+
changed is acceptable.
8076
format: date-time
8177
type: string
8278
message:

build/yaml/crd/nsx.vmware.com_ippools.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ spec:
172172
type: object
173173
type: array
174174
type:
175-
description: Type defines the type of this IPPool, Public or Private.
175+
description: Type defines the type of this IPPool, Public, Private
176+
or Project.
176177
enum:
177178
- Public
178179
- Private
180+
- Project
179181
type: string
180182
type: object
181183
status:

build/yaml/crd/nsx.vmware.com_subnets.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ spec:
6161
enum:
6262
- Private
6363
- Public
64+
- Project
6465
type: string
6566
advancedConfig:
6667
description: Subnet advanced configuration.

build/yaml/crd/nsx.vmware.com_subnetsets.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ spec:
6161
enum:
6262
- Private
6363
- Public
64+
- Project
6465
type: string
6566
advancedConfig:
6667
description: Subnet advanced configuration.

build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml

+14-16
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,26 @@ spec:
5353
When a field is not set in a Namespace's VPCNetworkConfiguration, the
5454
Namespace will use the value in the default VPCNetworkConfiguration.
5555
properties:
56-
defaultGatewayPath:
57-
description: PolicyPath of Tier0 or Tier0 VRF gateway.
58-
type: string
5956
defaultIPv4SubnetSize:
6057
default: 26
6158
description: Default size of Subnet based upon estimated workload
6259
count. Defaults to 26.
6360
type: integer
64-
defaultSubnetAccessMode:
65-
description: DefaultSubnetAccessMode defines the access mode of the
66-
default SubnetSet for PodVM and VM. Must be Public or Private.
61+
defaultPodSubnetAccessMode:
62+
description: DefaultPodSubnetAccessMode defines the access mode of
63+
the default SubnetSet for PodVM. Must be Public or Private.
6764
enum:
6865
- Public
6966
- Private
67+
- Project
7068
type: string
71-
edgeClusterPath:
72-
description: Edge cluster path on which the networking elements will
73-
be created.
69+
lbServiceSize:
70+
enum:
71+
- SMALL
72+
- MEDIUM
73+
- LARGE
74+
- XLARGE
7475
type: string
75-
externalIPv4Blocks:
76-
description: NSX-T IPv4 Block paths used to allocate external Subnets.
77-
items:
78-
type: string
79-
maxItems: 5
80-
minItems: 0
81-
type: array
8276
nsxtProject:
8377
description: NSX-T Project the Namespace associated with.
8478
type: string
@@ -94,6 +88,10 @@ spec:
9488
context in logs. Less than or equal to 8 characters.
9589
maxLength: 8
9690
type: string
91+
vpcConnectivityProfile:
92+
description: VPCConnectivityProfile ID. This profile has configuration
93+
related to create VPC transit gateway attachment.
94+
type: string
9795
type: object
9896
status:
9997
description: VPCNetworkConfigurationStatus defines the observed state

build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
privateIPv4CIDRs:
1313
- 172.26.0.0/16
1414
- 172.36.0.0/16
15-
defaultSubnetAccessMode: Private
15+
defaultPodSubnetAccessMode: Private

pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type SubnetSpec struct {
1616
// +kubebuilder:validation:Minimum:=16
1717
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
1818
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
19-
// +kubebuilder:validation:Enum=Private;Public
19+
// +kubebuilder:validation:Enum=Private;Public;Project
2020
AccessMode AccessMode `json:"accessMode,omitempty"`
2121
// Subnet CIDRS.
2222
// +kubebuilder:validation:MinItems=0
@@ -38,9 +38,9 @@ type SubnetStatus struct {
3838
}
3939

4040
// +genclient
41-
//+kubebuilder:object:root=true
42-
//+kubebuilder:subresource:status
43-
//+kubebuilder:storageversion
41+
// +kubebuilder:object:root=true
42+
// +kubebuilder:subresource:status
43+
// +kubebuilder:storageversion
4444

4545
// Subnet is the Schema for the subnets API.
4646
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
@@ -54,7 +54,7 @@ type Subnet struct {
5454
Status SubnetStatus `json:"status,omitempty"`
5555
}
5656

57-
//+kubebuilder:object:root=true
57+
// +kubebuilder:object:root=true
5858

5959
// SubnetList contains a list of Subnet.
6060
type SubnetList struct {

pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type SubnetSetSpec struct {
1414
// +kubebuilder:validation:Minimum:=16
1515
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
1616
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
17-
// +kubebuilder:validation:Enum=Private;Public
17+
// +kubebuilder:validation:Enum=Private;Public;Project
1818
AccessMode AccessMode `json:"accessMode,omitempty"`
1919
// Subnet advanced configuration.
2020
AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"`
@@ -37,9 +37,9 @@ type SubnetSetStatus struct {
3737
}
3838

3939
// +genclient
40-
//+kubebuilder:object:root=true
41-
//+kubebuilder:subresource:status
42-
//+kubebuilder:storageversion
40+
// +kubebuilder:object:root=true
41+
// +kubebuilder:subresource:status
42+
// +kubebuilder:storageversion
4343

4444
// SubnetSet is the Schema for the subnetsets API.
4545
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
@@ -53,7 +53,7 @@ type SubnetSet struct {
5353
Status SubnetSetStatus `json:"status,omitempty"`
5454
}
5555

56-
//+kubebuilder:object:root=true
56+
// +kubebuilder:object:root=true
5757

5858
// SubnetSetList contains a list of SubnetSet.
5959
type SubnetSetList struct {

pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go

+22-18
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import (
99
)
1010

1111
const (
12-
AccessModePublic string = "Public"
13-
AccessModePrivate string = "Private"
12+
AccessModePublic string = "Public"
13+
AccessModePrivate string = "Private"
14+
AccessModeProject string = "Project"
15+
LbServiceSizeSmall string = "SMALL"
16+
LbServiceSizeMedium string = "MEDIUM"
17+
LbServiceSizeLarge string = "LARGE"
18+
LbServiceSizeXlarge string = "XLARGE"
1419
)
1520

1621
// VPCNetworkConfigurationSpec defines the desired state of VPCNetworkConfiguration.
@@ -19,16 +24,15 @@ const (
1924
// in a Namespace's VPCNetworkConfiguration, the Namespace will use the value
2025
// in the default VPCNetworkConfiguration.
2126
type VPCNetworkConfigurationSpec struct {
22-
// PolicyPath of Tier0 or Tier0 VRF gateway.
23-
DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"`
24-
// Edge cluster path on which the networking elements will be created.
25-
EdgeClusterPath string `json:"edgeClusterPath,omitempty"`
27+
// VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment.
28+
VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"`
29+
30+
// +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE
31+
LbServiceSize string `json:"lbServiceSize,omitempty"`
32+
2633
// NSX-T Project the Namespace associated with.
2734
NSXTProject string `json:"nsxtProject,omitempty"`
28-
// NSX-T IPv4 Block paths used to allocate external Subnets.
29-
// +kubebuilder:validation:MinItems=0
30-
// +kubebuilder:validation:MaxItems=5
31-
ExternalIPv4Blocks []string `json:"externalIPv4Blocks,omitempty"`
35+
3236
// Private IPv4 CIDRs used to allocate Private Subnets.
3337
// +kubebuilder:validation:MinItems=0
3438
// +kubebuilder:validation:MaxItems=5
@@ -37,12 +41,12 @@ type VPCNetworkConfigurationSpec struct {
3741
// Defaults to 26.
3842
// +kubebuilder:default=26
3943
DefaultIPv4SubnetSize int `json:"defaultIPv4SubnetSize,omitempty"`
40-
// DefaultSubnetAccessMode defines the access mode of the default SubnetSet for PodVM and VM.
44+
// DefaultPodSubnetAccessMode defines the access mode of the default SubnetSet for PodVM.
4145
// Must be Public or Private.
42-
// +kubebuilder:validation:Enum=Public;Private
43-
DefaultSubnetAccessMode string `json:"defaultSubnetAccessMode,omitempty"`
46+
// +kubebuilder:validation:Enum=Public;Private;Project
47+
DefaultPodSubnetAccessMode string `json:"defaultPodSubnetAccessMode,omitempty"`
4448
// ShortID specifies Identifier to use when displaying VPC context in logs.
45-
// Less than or equal to 8 characters.
49+
// Less than equal to 8 characters.
4650
// +kubebuilder:validation:MaxLength=8
4751
// +optional
4852
ShortID string `json:"shortID,omitempty"`
@@ -64,9 +68,9 @@ type VPCInfo struct {
6468

6569
// +genclient
6670
// +genclient:nonNamespaced
67-
//+kubebuilder:object:root=true
68-
//+kubebuilder:subresource:status
69-
//+kubebuilder:storageversion
71+
// +kubebuilder:object:root=true
72+
// +kubebuilder:subresource:status
73+
// +kubebuilder:storageversion
7074

7175
// VPCNetworkConfiguration is the Schema for the vpcnetworkconfigurations API.
7276
// +kubebuilder:resource:scope="Cluster"
@@ -81,7 +85,7 @@ type VPCNetworkConfiguration struct {
8185
Status VPCNetworkConfigurationStatus `json:"status,omitempty"`
8286
}
8387

84-
//+kubebuilder:object:root=true
88+
// +kubebuilder:object:root=true
8589

8690
// VPCNetworkConfigurationList contains a list of VPCNetworkConfiguration.
8791
type VPCNetworkConfigurationList struct {

0 commit comments

Comments
 (0)