Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Qiu <[email protected]>
  • Loading branch information
wenqiq committed Jul 18, 2024
1 parent 3028d3b commit f3bef41
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build/yaml/crd/nsx.vmware.com_subnets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ spec:
type: boolean
type: object
accessMode:
default: Private
default: Private_TGW
description: Access mode of Subnet, accessible only from within VPC
or from outside VPC.
enum:
- Private
- Private_TGW
- Public
- Project
type: string
Expand Down
4 changes: 2 additions & 2 deletions build/yaml/crd/nsx.vmware.com_subnetsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ spec:
type: boolean
type: object
accessMode:
default: Private
default: Private_TGW
description: Access mode of Subnet, accessible only from within VPC
or from outside VPC.
enum:
- Private
- Private_TGW
- Public
- Project
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ spec:
Must be Public or Private.
enum:
- Public
- Private
- Private_TGW
- Project
type: string
privateIPs:
Expand Down
4 changes: 2 additions & 2 deletions build/yaml/samples/nsx_v1alpha1_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
privateIPs:
- 172.26.0.0/16
- 172.36.0.0/16
podSubnetAccessMode: Private
podSubnetAccessMode: Private_TGW
---
# Sample to create VPCNetworkConfiguration CR using a pre-created NSX VPC.
apiVersion: nsx.vmware.com/v1alpha1
Expand All @@ -22,6 +22,6 @@ metadata:
spec:
vpc: /orgs/default/projects/proj-1/vpcs/vpc-1
defaultIPv4SubnetSize: 28
podSubnetAccessMode: Private
podSubnetAccessMode: Private_TGW
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/ipaddressallocation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const (
)

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// IPAddressAllocation is the Schema for the IP allocation API.
// +kubebuilder:printcolumn:name="IPAddressBlockVisibility",type=string,JSONPath=`.spec.ip_address_block_visibility`,description="IPAddressBlockVisibility of IPAddressAllocation"
Expand All @@ -31,7 +31,7 @@ type IPAddressAllocation struct {
Status IPAddressAllocationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// IPAddressAllocationList contains a list of IPAddressAllocation.
type IPAddressAllocationList struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +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:default:=Private
// +kubebuilder:validation:Enum=Private;Public;Project
// +kubebuilder:default:=Private_TGW
// +kubebuilder:validation:Enum=Private_TGW;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet CIDRS.
// +kubebuilder:validation:MinItems=0
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +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:default:=Private
// +kubebuilder:validation:Enum=Private;Public;Project
// +kubebuilder:default:=Private_TGW
// +kubebuilder:validation:Enum=Private_TGW;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet advanced configuration.
AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

const (
AccessModePublic string = "Public"
AccessModePrivate string = "Private"
AccessModePrivate string = "Private_TGW"
AccessModeProject string = "Project"
LbServiceSizeSmall string = "SMALL"
LbServiceSizeMedium string = "MEDIUM"
Expand Down Expand Up @@ -56,8 +56,8 @@ type VPCNetworkConfigurationSpec struct {
// +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
// Must be Public, Private_TGW, or Project.
// +kubebuilder:validation:Enum=Public;Private_TGW;Project
PodSubnetAccessMode string `json:"podSubnetAccessMode,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/v1alpha1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +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:default:=Private
// +kubebuilder:validation:Enum=Private;Public;Project
// +kubebuilder:default:=Private_TGW
// +kubebuilder:validation:Enum=Private_TGW;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet CIDRS.
// +kubebuilder:validation:MinItems=0
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/v1alpha1/subnetset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +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:default:=Private
// +kubebuilder:validation:Enum=Private;Public;Project
// +kubebuilder:default:=Private_TGW
// +kubebuilder:validation:Enum=Private_TGW;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet advanced configuration.
AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/v1alpha1/vpcnetworkconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

const (
AccessModePublic string = "Public"
AccessModePrivate string = "Private"
AccessModePrivate string = "Private_TGW"
AccessModeProject string = "Project"
LbServiceSizeSmall string = "SMALL"
LbServiceSizeMedium string = "MEDIUM"
Expand Down Expand Up @@ -57,7 +57,7 @@ type VPCNetworkConfigurationSpec struct {
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
// +kubebuilder:validation:Enum=Public;Private_TGW;Project
PodSubnetAccessMode string `json:"podSubnetAccessMode,omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/namespace/namespace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (r *NamespaceReconciler) createDefaultSubnetSet(ns string, defaultPodAccess
}
if name == types.DefaultVMSubnetSet {
// use "Private" type for VM
obj.Spec.AccessMode = v1alpha1.AccessMode("Private")
obj.Spec.AccessMode = v1alpha1.AccessMode(v1alpha1.AccessModePrivate)
} else if name == types.DefaultPodSubnetSet {
obj.Spec.AccessMode = v1alpha1.AccessMode(defaultPodAccessMode)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ func TestBuildNetworkConfigInfo(t *testing.T) {
vpcConnectivityProfile string
}{
{"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, ""},
{"with-VpcConnectivityProfile", testCRD2, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private_TGW", false, "test-VpcConnectivityProfile"},
{"with-defaultNetworkConfig", testCRD3, "test-gw-path-2", "test-edge-path-2", "anotherOrg", "anotherProject", 32, "Private_TGW", true, ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit f3bef41

Please sign in to comment.