Skip to content

Commit 9f075c5

Browse files
author
Rahul Sharma
committed
remove deprecated vpcname flag
1 parent 5a59a82 commit 9f075c5

File tree

5 files changed

+8
-55
lines changed

5 files changed

+8
-55
lines changed

cloud/linode/cloud.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ var supportedLoadBalancerTypes = []string{ciliumLBType, nodeBalancerLBType}
3434
// We expect it to be initialized with flags external to this package, likely in
3535
// main.go
3636
var Options struct {
37-
KubeconfigFlag *pflag.Flag
38-
LinodeGoDebug bool
39-
EnableRouteController bool
40-
EnableTokenHealthChecker bool
41-
// Deprecated: use VPCNames instead
42-
VPCName string
37+
KubeconfigFlag *pflag.Flag
38+
LinodeGoDebug bool
39+
EnableRouteController bool
40+
EnableTokenHealthChecker bool
4341
VPCNames string
4442
SubnetNames string
4543
LoadBalancerType string
@@ -138,15 +136,6 @@ func newCloud() (cloudprovider.Interface, error) {
138136
healthChecker = newHealthChecker(linodeClient, tokenHealthCheckPeriod, Options.GlobalStopChannel)
139137
}
140138

141-
if Options.VPCName != "" && Options.VPCNames != "" {
142-
return nil, fmt.Errorf("cannot have both vpc-name and vpc-names set")
143-
}
144-
145-
if Options.VPCName != "" {
146-
klog.Warningf("vpc-name flag is deprecated. Use vpc-names instead")
147-
Options.VPCNames = Options.VPCName
148-
}
149-
150139
// SubnetNames can't be used without VPCNames also being set
151140
if Options.SubnetNames != "" && Options.VPCNames == "" {
152141
klog.Warningf("failed to set flag subnet-names: vpc-names must be set to a non-empty value")

cloud/linode/cloud_test.go

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/golang/mock/gomock"
99
"github.com/stretchr/testify/assert"
10-
"github.com/stretchr/testify/require"
1110
cloudprovider "k8s.io/cloud-provider"
1211

1312
"github.com/linode/linode-cloud-controller-manager/cloud/linode/client/mocks"
@@ -22,14 +21,14 @@ func TestNewCloudRouteControllerDisabled(t *testing.T) {
2221
t.Setenv("LINODE_REQUEST_TIMEOUT_SECONDS", "10")
2322

2423
t.Run("should not fail if vpc is empty and routecontroller is disabled", func(t *testing.T) {
25-
Options.VPCName = ""
24+
Options.VPCNames = ""
2625
Options.EnableRouteController = false
2726
_, err := newCloud()
2827
assert.NoError(t, err)
2928
})
3029

3130
t.Run("fail if vpcname is empty and routecontroller is enabled", func(t *testing.T) {
32-
Options.VPCName = ""
31+
Options.VPCNames = ""
3332
Options.EnableRouteController = true
3433
_, err := newCloud()
3534
assert.Error(t, err)
@@ -58,28 +57,6 @@ func TestNewCloud(t *testing.T) {
5857
assert.Error(t, err, "expected error when linode region is empty")
5958
})
6059

61-
t.Run("should fail if both vpcname and vpcnames are set", func(t *testing.T) {
62-
Options.VPCName = "tt"
63-
Options.VPCNames = "tt"
64-
defer func() {
65-
Options.VPCName = ""
66-
Options.VPCNames = ""
67-
}()
68-
_, err := newCloud()
69-
assert.Error(t, err, "expected error when both vpcname and vpcnames are set")
70-
})
71-
72-
t.Run("should not fail if deprecated vpcname is set", func(t *testing.T) {
73-
Options.VPCName = "tt"
74-
defer func() {
75-
Options.VPCName = ""
76-
Options.VPCNames = ""
77-
}()
78-
_, err := newCloud()
79-
require.NoError(t, err, "expected no error if deprecated flag vpcname is set")
80-
assert.Equal(t, "tt", Options.VPCNames, "expected vpcnames to be set to vpcname")
81-
})
82-
8360
t.Run("should fail if both nodeBalancerBackendIPv4SubnetID and nodeBalancerBackendIPv4SubnetName are set", func(t *testing.T) {
8461
Options.VPCNames = "tt"
8562
Options.NodeBalancerBackendIPv4SubnetID = 12345

deploy/chart/templates/daemonset.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ spec:
7979
{{- if and .Values.routeController .Values.routeController.vpcNames }}
8080
{{- $vpcNames = .Values.routeController.vpcNames }}
8181
{{- end }}
82-
{{- $vpcName := .Values.vpcName }}
83-
{{- if and .Values.routeController .Values.routeController.vpcName }}
84-
{{- $vpcName = .Values.routeController.vpcName }}
85-
{{- end }}
86-
{{- if and $vpcName $vpcNames }}
87-
{{- fail "Both vpcName and vpcNames are set. Please use only vpcNames." }}
88-
{{- end }}
8982
{{- $subnetNames := .Values.subnetNames }}
9083
{{- if and .Values.routeController .Values.routeController.subnetNames }}
9184
{{- $subnetNames = .Values.routeController.subnetNames }}
@@ -106,8 +99,8 @@ spec:
10699
{{- end }}
107100
{{- if .Values.routeController }}
108101
- --enable-route-controller=true
109-
{{- if not (or $vpcName $vpcNames) }}
110-
{{- fail "Neither vpcName nor vpcNames is set. Please set one of them." }}
102+
{{- if not $vpcNames }}
103+
{{- fail "vpcNames not set. Please set it when enabling route_controller for VPCs." }}
111104
{{- end }}
112105
{{- if not $clusterCIDR }}
113106
{{- fail "clusterCIDR is required if route-controller is enabled" }}
@@ -120,9 +113,6 @@ spec:
120113
{{- with $vpcNames }}
121114
- --vpc-names={{ . }}
122115
{{- end }}
123-
{{- with $vpcName }}
124-
- --vpc-name={{ . }}
125-
{{- end }}
126116
{{- with $subnetNames }}
127117
- --subnet-names={{ . }}
128118
{{- end }}

deploy/chart/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ tolerations:
7575

7676
# This section adds ability to enable route-controller for ccm
7777
# routeController:
78-
# vpcName: <name of VPC> [Deprecated: use vpcNames instead]
7978
# vpcNames: <comma separated list of vpc names>
8079
# subnetNames: <comma separated list of subnet names>
8180
# clusterCIDR: 10.192.0.0/10
@@ -88,7 +87,6 @@ tolerations:
8887
# nodeCIDRMaskSizeIPv6: 64
8988

9089
# vpcs and subnets that node internal IPs will be assigned from (not required if already specified in routeController)
91-
# vpcName: <name of VPC> [Deprecated: use vpcNames instead]
9290
# vpcNames: <comma separated list of vpc names>
9391
# subnetNames: <comma separated list of subnet names>
9492

main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func main() {
8383
command.Flags().BoolVar(&linode.Options.LinodeGoDebug, "linodego-debug", false, "enables debug output for the LinodeAPI wrapper")
8484
command.Flags().BoolVar(&linode.Options.EnableRouteController, "enable-route-controller", false, "enables route_controller for ccm")
8585
command.Flags().BoolVar(&linode.Options.EnableTokenHealthChecker, "enable-token-health-checker", false, "enables Linode API token health checker")
86-
command.Flags().StringVar(&linode.Options.VPCName, "vpc-name", "", "[deprecated: use vpc-names instead] vpc name whose routes will be managed by route-controller")
8786
command.Flags().StringVar(&linode.Options.VPCNames, "vpc-names", "", "comma separated vpc names whose routes will be managed by route-controller")
8887
command.Flags().StringVar(&linode.Options.SubnetNames, "subnet-names", "default", "comma separated subnet names whose routes will be managed by route-controller (requires vpc-names flag to also be set)")
8988
command.Flags().StringVar(&linode.Options.LoadBalancerType, "load-balancer-type", "nodebalancer", "configures which type of load-balancing to use for LoadBalancer Services (options: nodebalancer, cilium-bgp)")

0 commit comments

Comments
 (0)