Skip to content

Commit fbe3521

Browse files
committed
fix: formating and typo
1 parent d7f14fb commit fbe3521

File tree

2 files changed

+71
-71
lines changed

2 files changed

+71
-71
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_standard.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const (
6565
nodeLabelRole = "kubernetes.io/role"
6666
nicFailedState = "Failed"
6767

68-
storageAccountNameMaxLength = 24
68+
storageAccountNameMaxLength = 24
6969
frontendIPConfigNameMaxLength = 80
7070
loadBalancerRuleNameMaxLength = 80
7171
)
@@ -283,10 +283,10 @@ func (az *Cloud) getLoadBalancerRuleName(service *v1.Service, protocol v1.Protoc
283283
return ruleName
284284
}
285285

286-
// Load balancer rule name must be less or equal to 80 charactors, so excluding the hyphen two segments cannot exceed 79
286+
// Load balancer rule name must be less or equal to 80 characters, so excluding the hyphen two segments cannot exceed 79
287287
subnetSegment := *subnet
288-
if len(ruleName) + len(subnetSegment) + 1 > loadBalancerRuleNameMaxLength {
289-
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength - len(ruleName) - 1]
288+
if len(ruleName)+len(subnetSegment)+1 > loadBalancerRuleNameMaxLength {
289+
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength-len(ruleName)-1]
290290
}
291291

292292
return fmt.Sprintf("%s-%s-%s-%d", prefix, subnetSegment, protocol, port)
@@ -332,8 +332,8 @@ func (az *Cloud) getFrontendIPConfigName(service *v1.Service) string {
332332
subnetName := subnet(service)
333333
if subnetName != nil {
334334
ipcName := fmt.Sprintf("%s-%s", baseName, *subnetName)
335-
336-
// Azure lb front end configuration name must not exceed 80 charactors
335+
336+
// Azure lb front end configuration name must not exceed 80 characters
337337
if len(ipcName) > frontendIPConfigNameMaxLength {
338338
ipcName = ipcName[:frontendIPConfigNameMaxLength]
339339
}

staging/src/k8s.io/legacy-cloud-providers/azure/azure_standard_test.go

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ limitations under the License.
1919
package azure
2020

2121
import (
22-
"testing"
2322
"strconv"
23+
"testing"
2424

2525
"github.com/stretchr/testify/assert"
2626

@@ -261,13 +261,13 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
261261

262262
svc := &v1.Service{
263263
ObjectMeta: meta.ObjectMeta{
264-
Annotations: map[string]string{ },
265-
UID: "257b9655-5137-4ad2-b091-ef3f07043ad3",
264+
Annotations: map[string]string{},
265+
UID: "257b9655-5137-4ad2-b091-ef3f07043ad3",
266266
},
267267
}
268268

269269
cases := []struct {
270-
description string
270+
description string
271271
subnetName string
272272
isInternal bool
273273
useStandardLB bool
@@ -276,49 +276,49 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
276276
expected string
277277
}{
278278
{
279-
description: "internal lb should have subnet name on the rule name",
280-
subnetName: "shortsubnet",
281-
isInternal: true,
282-
useStandardLB: true,
283-
protocol: v1.ProtocolTCP,
284-
port: 9000,
285-
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet-TCP-9000",
279+
description: "internal lb should have subnet name on the rule name",
280+
subnetName: "shortsubnet",
281+
isInternal: true,
282+
useStandardLB: true,
283+
protocol: v1.ProtocolTCP,
284+
port: 9000,
285+
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet-TCP-9000",
286286
},
287287
{
288-
description: "internal standard lb should have subnet name on the rule name but truncated to 80 charactors",
289-
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
290-
isInternal: true,
291-
useStandardLB: true,
292-
protocol: v1.ProtocolTCP,
293-
port: 9000,
294-
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
288+
description: "internal standard lb should have subnet name on the rule name but truncated to 80 characters",
289+
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
290+
isInternal: true,
291+
useStandardLB: true,
292+
protocol: v1.ProtocolTCP,
293+
port: 9000,
294+
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
295295
},
296296
{
297-
description: "internal basic lb should have subnet name on the rule name but truncated to 80 charactors",
298-
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
299-
isInternal: true,
300-
useStandardLB: false,
301-
protocol: v1.ProtocolTCP,
302-
port: 9000,
303-
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
297+
description: "internal basic lb should have subnet name on the rule name but truncated to 80 characters",
298+
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
299+
isInternal: true,
300+
useStandardLB: false,
301+
protocol: v1.ProtocolTCP,
302+
port: 9000,
303+
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
304304
},
305305
{
306-
description: "external standard lb should not have subnet name on the rule name",
307-
subnetName: "shortsubnet",
308-
isInternal: false,
309-
useStandardLB: true,
310-
protocol: v1.ProtocolTCP,
311-
port: 9000,
312-
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
306+
description: "external standard lb should not have subnet name on the rule name",
307+
subnetName: "shortsubnet",
308+
isInternal: false,
309+
useStandardLB: true,
310+
protocol: v1.ProtocolTCP,
311+
port: 9000,
312+
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
313313
},
314314
{
315-
description: "external basic lb should not have subnet name on the rule name",
316-
subnetName: "shortsubnet",
317-
isInternal: false,
318-
useStandardLB: false,
319-
protocol: v1.ProtocolTCP,
320-
port: 9000,
321-
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
315+
description: "external basic lb should not have subnet name on the rule name",
316+
subnetName: "shortsubnet",
317+
isInternal: false,
318+
useStandardLB: false,
319+
protocol: v1.ProtocolTCP,
320+
port: 9000,
321+
expected: "a257b965551374ad2b091ef3f07043ad-TCP-9000",
322322
},
323323
}
324324

@@ -351,46 +351,46 @@ func TestGetFrontendIPConfigName(t *testing.T) {
351351
}
352352

353353
cases := []struct {
354-
description string
354+
description string
355355
subnetName string
356356
isInternal bool
357357
useStandardLB bool
358358
expected string
359359
}{
360360
{
361-
description: "internal lb should have subnet name on the frontend ip configuration name",
362-
subnetName: "shortsubnet",
363-
isInternal: true,
364-
useStandardLB: true,
365-
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet",
361+
description: "internal lb should have subnet name on the frontend ip configuration name",
362+
subnetName: "shortsubnet",
363+
isInternal: true,
364+
useStandardLB: true,
365+
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet",
366366
},
367367
{
368-
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
369-
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
370-
isInternal: true,
371-
useStandardLB: true,
372-
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
368+
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
369+
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
370+
isInternal: true,
371+
useStandardLB: true,
372+
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
373373
},
374374
{
375-
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
376-
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
377-
isInternal: true,
378-
useStandardLB: false,
379-
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
375+
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
376+
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
377+
isInternal: true,
378+
useStandardLB: false,
379+
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
380380
},
381381
{
382-
description: "external standard lb should not have subnet name on the frontend ip configuration name",
383-
subnetName: "shortsubnet",
384-
isInternal: false,
385-
useStandardLB: true,
386-
expected: "a257b965551374ad2b091ef3f07043ad",
382+
description: "external standard lb should not have subnet name on the frontend ip configuration name",
383+
subnetName: "shortsubnet",
384+
isInternal: false,
385+
useStandardLB: true,
386+
expected: "a257b965551374ad2b091ef3f07043ad",
387387
},
388388
{
389-
description: "external basic lb should not have subnet name on the frontend ip configuration name",
390-
subnetName: "shortsubnet",
391-
isInternal: false,
392-
useStandardLB: false,
393-
expected: "a257b965551374ad2b091ef3f07043ad",
389+
description: "external basic lb should not have subnet name on the frontend ip configuration name",
390+
subnetName: "shortsubnet",
391+
isInternal: false,
392+
useStandardLB: false,
393+
expected: "a257b965551374ad2b091ef3f07043ad",
394394
},
395395
}
396396

0 commit comments

Comments
 (0)