Skip to content

Commit c1f7c72

Browse files
Change name of flag to nodebalacer-prefix
1 parent 891cd2e commit c1f7c72

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

cloud/linode/cloud.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var Options struct {
5858
ClusterCIDRIPv4 string
5959
NodeCIDRMaskSizeIPv4 int
6060
NodeCIDRMaskSizeIPv6 int
61-
LoadBalancerPrefix string
61+
NodeBalancerPrefix string
6262
}
6363

6464
type linodeCloud struct {
@@ -72,7 +72,7 @@ type linodeCloud struct {
7272
var (
7373
instanceCache *instances
7474
ipHolderCharLimit int = 23
75-
LoadBalancerPrefixCharLimit int = 19
75+
NodeBalancerPrefixCharLimit int = 19
7676
)
7777

7878
func init() {
@@ -195,8 +195,8 @@ func newCloud() (cloudprovider.Interface, error) {
195195
return nil, fmt.Errorf("%s", msg)
196196
}
197197

198-
if len(Options.LoadBalancerPrefix) > LoadBalancerPrefixCharLimit {
199-
msg := fmt.Sprintf("load-balancer-prefix must be %d characters or less: %s is %d characters\n", LoadBalancerPrefixCharLimit, Options.LoadBalancerPrefix, len(Options.LoadBalancerPrefix))
198+
if len(Options.NodeBalancerPrefix) > NodeBalancerPrefixCharLimit {
199+
msg := fmt.Sprintf("nodebalancer-prefix must be %d characters or less: %s is %d characters\n", NodeBalancerPrefixCharLimit, Options.NodeBalancerPrefix, len(Options.NodeBalancerPrefix))
200200
klog.Error(msg)
201201
return nil, fmt.Errorf("%s", msg)
202202
}

cloud/linode/cloud_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ func TestNewCloud(t *testing.T) {
127127
assert.Error(t, err, "expected error if ipholdersuffix is longer than 23 chars")
128128
})
129129

130-
t.Run("should fail if load-balancer-prefix is longer than 19 chars", func(t *testing.T) {
131-
prefix := Options.LoadBalancerPrefix
132-
Options.LoadBalancerPrefix = strings.Repeat("a", 21)
130+
t.Run("should fail if nodebalancer-prefix is longer than 19 chars", func(t *testing.T) {
131+
prefix := Options.NodeBalancerPrefix
132+
Options.NodeBalancerPrefix = strings.Repeat("a", 21)
133133
defer func() {
134-
Options.LoadBalancerPrefix = prefix
134+
Options.NodeBalancerPrefix = prefix
135135
}()
136136
_, err := newCloud()
137-
assert.Error(t, err, "expected error if load-balancer-prefix is longer than 19 chars")
137+
assert.Error(t, err, "expected error if nodebalancer-prefix is longer than 19 chars")
138138
})
139139
}
140140

cloud/linode/loadbalancers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (l *loadbalancers) cleanupOldNodeBalancer(ctx context.Context, service *v1.
227227
// GetLoadBalancer will not modify service.
228228
func (l *loadbalancers) GetLoadBalancerName(_ context.Context, _ string, _ *v1.Service) string {
229229
unixNano := strconv.FormatInt(time.Now().UnixNano(), 16)
230-
return fmt.Sprintf("%s-%s", Options.LoadBalancerPrefix, unixNano[len(unixNano)-12:])
230+
return fmt.Sprintf("%s-%s", Options.NodeBalancerPrefix, unixNano[len(unixNano)-12:])
231231
}
232232

233233
// GetLoadBalancer returns the *v1.LoadBalancerStatus of service.

docs/configuration/environment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The CCM supports the following flags:
5353
| `--enable-ipv6-for-loadbalancers` | `false` | Set both IPv4 and IPv6 addresses for all LoadBalancer services (when disabled, only IPv4 is used). This can also be configured per-service using the `service.beta.kubernetes.io/linode-loadbalancer-enable-ipv6-ingress` annotation. |
5454
| `--node-cidr-mask-size-ipv4` | `24` | ipv4 cidr mask size for pod cidrs allocated to nodes |
5555
| `--node-cidr-mask-size-ipv6` | `64` | ipv6 cidr mask size for pod cidrs allocated to nodes |
56+
| `--nodebalancer-prefix` | `ccm` | Name prefix for LoadBalancers. (max. 19 char.) |
5657

5758
## Configuration Methods
5859

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func main() {
9898
command.Flags().IntVar(&linode.Options.NodeBalancerBackendIPv4SubnetID, "nodebalancer-backend-ipv4-subnet-id", 0, "ipv4 subnet id to use for NodeBalancer backends")
9999
command.Flags().StringVar(&linode.Options.NodeBalancerBackendIPv4SubnetName, "nodebalancer-backend-ipv4-subnet-name", "", "ipv4 subnet name to use for NodeBalancer backends")
100100
command.Flags().BoolVar(&linode.Options.DisableNodeBalancerVPCBackends, "disable-nodebalancer-vpc-backends", false, "disables nodebalancer backends in VPCs (when enabled, nodebalancers will only have private IPs as backends for backward compatibility)")
101-
command.Flags().StringVar(&linode.Options.LoadBalancerPrefix, "load-balancer-prefix", "ccm", "Name prefix for LoadBalancers. (max. 19 char.)")
101+
command.Flags().StringVar(&linode.Options.NodeBalancerPrefix, "nodebalancer-prefix", "ccm", "Name prefix for LoadBalancers. (max. 19 char.)")
102102

103103
// Set static flags
104104
command.Flags().VisitAll(func(fl *pflag.Flag) {

0 commit comments

Comments
 (0)