Skip to content

Commit

Permalink
Change field name
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
  • Loading branch information
wenqiq committed Jun 19, 2024
1 parent f77ca30 commit 88264d8
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
maxItems: 5
minItems: 0
type: array
lb_service_size:
lbServiceSize:
enum:
- SMALL
- MEDIUM
Expand All @@ -102,7 +102,7 @@ spec:
context in logs. Less than or equal to 8 characters.
maxLength: 8
type: string
vpc_connectivity_profile:
vpcConnectivityProfile:
description: VPCConnectivityProfile ID. This profile has configuration
related to create VPC transit gateway attachment.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type VPCNetworkConfigurationSpec struct {
DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"`

// VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment.
VPCConnectivityProfile string `json:"vpc_connectivity_profile,omitempty"`
VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"`

// +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE
LbServiceSize string `json:"lb_service_size,omitempty"`
LbServiceSize string `json:"lbServiceSize,omitempty"`

// Edge cluster path on which the networking elements will be created.
EdgeClusterPath string `json:"edgeClusterPath,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 @@ -28,10 +28,10 @@ type VPCNetworkConfigurationSpec struct {
DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"`

// VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment.
VPCConnectivityProfile string `json:"vpc_connectivity_profile,omitempty"`
VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"`

// +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE
LbServiceSize string `json:"lb_service_size,omitempty"`
LbServiceSize string `json:"lbServiceSize,omitempty"`

// Edge cluster path on which the networking elements will be created.
EdgeClusterPath string `json:"edgeClusterPath,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/ippool/ippool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (r *IPPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
}

// TODO: As we do not have base controller in Go, we need to take care of NSX exceptions in each controller separately.
//I agree we should not do infinite retry for all errors, but it's ok to add error handling in a following patch
// I agree we should not do infinite retry for all errors, but it's ok to add error handling in a following patch

// TODO: Since only the cloud provider creates it, we can take all the validation logic into consideration later.

Expand All @@ -141,7 +141,7 @@ func (r *IPPoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
updateFail(r, &ctx, obj, &err)
return resultRequeue, err
}
obj.Spec.Type = vpcNetworkConfig.DefaultSubnetAccessMode
obj.Spec.Type = vpcNetworkConfig.DefaultPodSubnetAccessMode
}

if obj.ObjectMeta.DeletionTimestamp.IsZero() {
Expand Down
12 changes: 6 additions & 6 deletions pkg/controllers/networkinfo/vpcnetworkconfig_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ func buildNetworkConfigInfo(vpcConfigCR v1alpha1.VPCNetworkConfiguration) (*comm
EdgeClusterPath: vpcConfigCR.Spec.EdgeClusterPath,
// VPCConnectivityProfile: vpcConfigCR.Spec.VPCConnectivityProfile,
// VPCServiceProfile: vpcConfigCR.Spec.VPCServiceProfile,
NsxtProject: project,
ExternalIPv4Blocks: vpcConfigCR.Spec.ExternalIPv4Blocks,
PrivateIPv4CIDRs: vpcConfigCR.Spec.PrivateIPv4CIDRs,
DefaultIPv4SubnetSize: vpcConfigCR.Spec.DefaultIPv4SubnetSize,
DefaultSubnetAccessMode: vpcConfigCR.Spec.DefaultSubnetAccessMode,
ShortID: vpcConfigCR.Spec.ShortID,
NsxtProject: project,
ExternalIPv4Blocks: vpcConfigCR.Spec.ExternalIPv4Blocks,
PrivateIPv4CIDRs: vpcConfigCR.Spec.PrivateIPv4CIDRs,
DefaultIPv4SubnetSize: vpcConfigCR.Spec.DefaultIPv4SubnetSize,
DefaultPodSubnetAccessMode: vpcConfigCR.Spec.DefaultPodSubnetAccessMode,
ShortID: vpcConfigCR.Spec.ShortID,
}
return ninfo, nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/controllers/networkinfo/vpcnetworkconfig_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ func TestBuildNetworkConfigInfo(t *testing.T) {
PrivateIPv4CIDRs: []string{"private-ipb-1", "private-ipb-2"},
DefaultIPv4SubnetSize: 64,
// VPCServiceProfile: "test-VpcServiceProfile",
VPCConnectivityProfile: "test-VPCConnectivityProfile",
DefaultSubnetAccessMode: "Public",
NSXTProject: "/orgs/default/projects/nsx_operator_e2e_test",
VPCConnectivityProfile: "test-VPCConnectivityProfile",
DefaultPodSubnetAccessMode: "Public",
NSXTProject: "/orgs/default/projects/nsx_operator_e2e_test",
}
spec2 := v1alpha1.VPCNetworkConfigurationSpec{
// DefaultGatewayPath: "test-gw-path-2",
// EdgeClusterPath: "test-edge-path-2",
// ExternalIPv4Blocks: []string{"external-ipb-1", "external-ipb-2"},
PrivateIPv4CIDRs: []string{"private-ipb-1", "private-ipb-2"},
DefaultIPv4SubnetSize: 32,
DefaultSubnetAccessMode: "Private",
NSXTProject: "/orgs/anotherOrg/projects/anotherProject",
PrivateIPv4CIDRs: []string{"private-ipb-1", "private-ipb-2"},
DefaultIPv4SubnetSize: 32,
DefaultPodSubnetAccessMode: "Private",
NSXTProject: "/orgs/anotherOrg/projects/anotherProject",
}
testCRD1 := v1alpha1.VPCNetworkConfiguration{
Spec: spec1,
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestBuildNetworkConfigInfo(t *testing.T) {
assert.Equal(t, tt.org, nc.Org)
assert.Equal(t, tt.project, nc.NsxtProject)
assert.Equal(t, tt.subnetSize, nc.DefaultIPv4SubnetSize)
assert.Equal(t, tt.accessMode, nc.DefaultSubnetAccessMode)
assert.Equal(t, tt.accessMode, nc.DefaultPodSubnetAccessMode)
assert.Equal(t, tt.isDefault, nc.IsDefault)
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/subnet/subnet_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *SubnetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
return ResultRequeue, err
}
if obj.Spec.AccessMode == "" {
obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultSubnetAccessMode)
obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultPodSubnetAccessMode)
}
if obj.Spec.IPv4SubnetSize == 0 {
obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultIPv4SubnetSize
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/subnetset/subnetset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (r *SubnetSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
return ResultRequeue, err
}
if obj.Spec.AccessMode == "" {
obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultSubnetAccessMode)
obj.Spec.AccessMode = v1alpha1.AccessMode(vpcNetworkConfig.DefaultPodSubnetAccessMode)
}
if obj.Spec.IPv4SubnetSize == 0 {
obj.Spec.IPv4SubnetSize = vpcNetworkConfig.DefaultIPv4SubnetSize
Expand Down
14 changes: 7 additions & 7 deletions pkg/nsx/services/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ type VPCNetworkConfigInfo struct {
DefaultGatewayPath string // deprecated, existing field
// VPCServiceProfile string
// VPCConnectivityProfile string
EdgeClusterPath string // deprecated, existing field
NsxtProject string
ExternalIPv4Blocks []string // deprecated, existing field
PrivateIPv4CIDRs []string
DefaultIPv4SubnetSize int
DefaultSubnetAccessMode string
ShortID string
EdgeClusterPath string // deprecated, existing field
NsxtProject string
ExternalIPv4Blocks []string // deprecated, existing field
PrivateIPv4CIDRs []string
DefaultIPv4SubnetSize int
DefaultPodSubnetAccessMode string
ShortID string
}
2 changes: 1 addition & 1 deletion pkg/nsx/services/securitypolicy/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (service *SecurityPolicyService) wrapRules(rules []model.Rule) ([]*data.Str
for _, r := range rules {
rule := r
rule.ResourceType = &common.ResourceTypeRule // need this field to identify the resource type
childRule := model.ChildRule{ // We need to put child rule's id into upper level, otherwise, NSX-T will not find the child rule
childRule := model.ChildRule{ // We need to put child rule's id into upper level, otherwise, NSX-T will not find the child rule
ResourceType: resourceType, // Children are not allowed for rule, so we don't need to wrap ServiceEntry into Children
Id: rule.Id,
Rule: &rule,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/nsx_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func verifySubnetSetCR(subnetSet string) bool {
log.Printf("Failed to get %s/%s: %s", E2ENamespace, subnetSet, err)
return false
}
if string(subnetSetCR.Spec.AccessMode) != vpcNetworkConfig.Spec.DefaultSubnetAccessMode {
log.Printf("AccessMode is %s, while it's expected to be %s", subnetSetCR.Spec.AccessMode, vpcNetworkConfig.Spec.DefaultSubnetAccessMode)
if string(subnetSetCR.Spec.AccessMode) != vpcNetworkConfig.Spec.DefaultPodSubnetAccessMode {
log.Printf("AccessMode is %s, while it's expected to be %s", subnetSetCR.Spec.AccessMode, vpcNetworkConfig.Spec.DefaultPodSubnetAccessMode)
return false
}
if subnetSetCR.Spec.IPv4SubnetSize != vpcNetworkConfig.Spec.DefaultIPv4SubnetSize {
Expand Down

0 comments on commit 88264d8

Please sign in to comment.