Skip to content

Commit 67efcdf

Browse files
author
Jeff Bornemann
committed
General clean-up of commented-out code, and other non-functional clean-up
1 parent a5f6377 commit 67efcdf

File tree

2 files changed

+36
-49
lines changed

2 files changed

+36
-49
lines changed

pkg/cloudprovider/providers/oci/load_balancer_spec.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ type LBSpec struct {
105105

106106
// NewLBSpec creates a LB Spec from a Kubernetes service and a slice of nodes.
107107
func NewLBSpec(svc *v1.Service, nodes []*v1.Node, defaultSubnets []string, sslConfig *SSLConfig, secListFactory securityListManagerFactory) (*LBSpec, error) {
108-
// Disable check for whether there are two subnets, rely on OCI to decide whether the number of subnets is correct
109-
// This allows LoadBalancers to be created in single AD regions
110-
// if len(defaultSubnets) != 2 {
111-
// return nil, errors.New("default subnets incorrectly configured")
112-
// }
113-
114108
if err := validateService(svc); err != nil {
115109
return nil, errors.Wrap(err, "invalid service")
116110
}
@@ -147,13 +141,6 @@ func NewLBSpec(svc *v1.Service, nodes []*v1.Node, defaultSubnets []string, sslCo
147141
}
148142
subnets = subnets[:1]
149143
}
150-
// Disable check for whether there are two subnets, rely on OCI to decide whether the number of subnets is correct
151-
// This allows LoadBalancers to be created in single AD regions
152-
// else {
153-
// if subnets[0] == "" || subnets[1] == "" {
154-
// return nil, errors.Errorf("a configuration for both subnets must be specified")
155-
// }
156-
// }
157144

158145
listeners, err := getListeners(svc, sslConfig)
159146
if err != nil {

pkg/cloudprovider/providers/oci/load_balancer_spec_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
7575
Spec: v1.ServiceSpec{
7676
SessionAffinity: v1.ServiceAffinityNone,
7777
Ports: []v1.ServicePort{
78-
v1.ServicePort{
78+
{
7979
Protocol: v1.ProtocolTCP,
8080
Port: int32(80),
8181
},
@@ -88,14 +88,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
8888
Internal: false,
8989
Subnets: []string{"one", "two"},
9090
Listeners: map[string]loadbalancer.ListenerDetails{
91-
"TCP-80": loadbalancer.ListenerDetails{
91+
"TCP-80": {
9292
DefaultBackendSetName: common.String("TCP-80"),
9393
Port: common.Int(80),
9494
Protocol: common.String("TCP"),
9595
},
9696
},
9797
BackendSets: map[string]loadbalancer.BackendSetDetails{
98-
"TCP-80": loadbalancer.BackendSetDetails{
98+
"TCP-80": {
9999
Backends: []loadbalancer.BackendDetails{},
100100
HealthChecker: &loadbalancer.HealthCheckerDetails{
101101
Protocol: common.String("HTTP"),
@@ -107,7 +107,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
107107
},
108108
SourceCIDRs: []string{"0.0.0.0/0"},
109109
Ports: map[string]portSpec{
110-
"TCP-80": portSpec{
110+
"TCP-80": {
111111
ListenerPort: 80,
112112
HealthCheckerPort: 10256,
113113
},
@@ -130,7 +130,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
130130
Spec: v1.ServiceSpec{
131131
SessionAffinity: v1.ServiceAffinityNone,
132132
Ports: []v1.ServicePort{
133-
v1.ServicePort{
133+
{
134134
Protocol: v1.ProtocolTCP,
135135
Port: int32(80),
136136
},
@@ -143,14 +143,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
143143
Internal: true,
144144
Subnets: []string{"one"},
145145
Listeners: map[string]loadbalancer.ListenerDetails{
146-
"TCP-80": loadbalancer.ListenerDetails{
146+
"TCP-80": {
147147
DefaultBackendSetName: common.String("TCP-80"),
148148
Port: common.Int(80),
149149
Protocol: common.String("TCP"),
150150
},
151151
},
152152
BackendSets: map[string]loadbalancer.BackendSetDetails{
153-
"TCP-80": loadbalancer.BackendSetDetails{
153+
"TCP-80": {
154154
Backends: []loadbalancer.BackendDetails{},
155155
HealthChecker: &loadbalancer.HealthCheckerDetails{
156156
Protocol: common.String("HTTP"),
@@ -162,7 +162,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
162162
},
163163
SourceCIDRs: []string{"0.0.0.0/0"},
164164
Ports: map[string]portSpec{
165-
"TCP-80": portSpec{
165+
"TCP-80": {
166166
ListenerPort: 80,
167167
HealthCheckerPort: 10256,
168168
},
@@ -186,7 +186,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
186186
Spec: v1.ServiceSpec{
187187
SessionAffinity: v1.ServiceAffinityNone,
188188
Ports: []v1.ServicePort{
189-
v1.ServicePort{
189+
{
190190
Protocol: v1.ProtocolTCP,
191191
Port: int32(80),
192192
},
@@ -199,14 +199,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
199199
Internal: false,
200200
Subnets: []string{"annotation-one", "annotation-two"},
201201
Listeners: map[string]loadbalancer.ListenerDetails{
202-
"TCP-80": loadbalancer.ListenerDetails{
202+
"TCP-80": {
203203
DefaultBackendSetName: common.String("TCP-80"),
204204
Port: common.Int(80),
205205
Protocol: common.String("TCP"),
206206
},
207207
},
208208
BackendSets: map[string]loadbalancer.BackendSetDetails{
209-
"TCP-80": loadbalancer.BackendSetDetails{
209+
"TCP-80": {
210210
Backends: []loadbalancer.BackendDetails{},
211211
HealthChecker: &loadbalancer.HealthCheckerDetails{
212212
Protocol: common.String("HTTP"),
@@ -218,7 +218,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
218218
},
219219
SourceCIDRs: []string{"0.0.0.0/0"},
220220
Ports: map[string]portSpec{
221-
"TCP-80": portSpec{
221+
"TCP-80": {
222222
ListenerPort: 80,
223223
HealthCheckerPort: 10256,
224224
},
@@ -242,7 +242,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
242242
Spec: v1.ServiceSpec{
243243
SessionAffinity: v1.ServiceAffinityNone,
244244
Ports: []v1.ServicePort{
245-
v1.ServicePort{
245+
{
246246
Protocol: v1.ProtocolTCP,
247247
Port: int32(80),
248248
},
@@ -255,14 +255,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
255255
Internal: false,
256256
Subnets: []string{"one", "two"},
257257
Listeners: map[string]loadbalancer.ListenerDetails{
258-
"TCP-80": loadbalancer.ListenerDetails{
258+
"TCP-80": {
259259
DefaultBackendSetName: common.String("TCP-80"),
260260
Port: common.Int(80),
261261
Protocol: common.String("TCP"),
262262
},
263263
},
264264
BackendSets: map[string]loadbalancer.BackendSetDetails{
265-
"TCP-80": loadbalancer.BackendSetDetails{
265+
"TCP-80": {
266266
Backends: []loadbalancer.BackendDetails{},
267267
HealthChecker: &loadbalancer.HealthCheckerDetails{
268268
Protocol: common.String("HTTP"),
@@ -274,7 +274,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
274274
},
275275
SourceCIDRs: []string{"0.0.0.0/0"},
276276
Ports: map[string]portSpec{
277-
"TCP-80": portSpec{
277+
"TCP-80": {
278278
ListenerPort: 80,
279279
HealthCheckerPort: 10256,
280280
},
@@ -297,7 +297,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
297297
Spec: v1.ServiceSpec{
298298
SessionAffinity: v1.ServiceAffinityNone,
299299
Ports: []v1.ServicePort{
300-
v1.ServicePort{
300+
{
301301
Protocol: v1.ProtocolTCP,
302302
Port: int32(80),
303303
},
@@ -310,7 +310,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
310310
Internal: false,
311311
Subnets: []string{"one", "two"},
312312
Listeners: map[string]loadbalancer.ListenerDetails{
313-
"TCP-80": loadbalancer.ListenerDetails{
313+
"TCP-80": {
314314
DefaultBackendSetName: common.String("TCP-80"),
315315
Port: common.Int(80),
316316
Protocol: common.String("TCP"),
@@ -320,7 +320,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
320320
},
321321
},
322322
BackendSets: map[string]loadbalancer.BackendSetDetails{
323-
"TCP-80": loadbalancer.BackendSetDetails{
323+
"TCP-80": {
324324
Backends: []loadbalancer.BackendDetails{},
325325
HealthChecker: &loadbalancer.HealthCheckerDetails{
326326
Protocol: common.String("HTTP"),
@@ -332,7 +332,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
332332
},
333333
SourceCIDRs: []string{"0.0.0.0/0"},
334334
Ports: map[string]portSpec{
335-
"TCP-80": portSpec{
335+
"TCP-80": {
336336
ListenerPort: 80,
337337
HealthCheckerPort: 10256,
338338
},
@@ -357,7 +357,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
357357
Spec: v1.ServiceSpec{
358358
SessionAffinity: v1.ServiceAffinityNone,
359359
Ports: []v1.ServicePort{
360-
v1.ServicePort{
360+
{
361361
Protocol: v1.ProtocolTCP,
362362
Port: int32(80),
363363
},
@@ -370,14 +370,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
370370
Internal: false,
371371
Subnets: []string{"annotation-one", "annotation-two"},
372372
Listeners: map[string]loadbalancer.ListenerDetails{
373-
"HTTP-80": loadbalancer.ListenerDetails{
373+
"HTTP-80": {
374374
DefaultBackendSetName: common.String("TCP-80"),
375375
Port: common.Int(80),
376376
Protocol: common.String("HTTP"),
377377
},
378378
},
379379
BackendSets: map[string]loadbalancer.BackendSetDetails{
380-
"TCP-80": loadbalancer.BackendSetDetails{
380+
"TCP-80": {
381381
Backends: []loadbalancer.BackendDetails{},
382382
HealthChecker: &loadbalancer.HealthCheckerDetails{
383383
Protocol: common.String("HTTP"),
@@ -389,7 +389,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
389389
},
390390
SourceCIDRs: []string{"0.0.0.0/0"},
391391
Ports: map[string]portSpec{
392-
"TCP-80": portSpec{
392+
"TCP-80": {
393393
ListenerPort: 80,
394394
HealthCheckerPort: 10256,
395395
},
@@ -414,7 +414,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
414414
Spec: v1.ServiceSpec{
415415
SessionAffinity: v1.ServiceAffinityNone,
416416
Ports: []v1.ServicePort{
417-
v1.ServicePort{
417+
{
418418
Protocol: v1.ProtocolTCP,
419419
Port: int32(80),
420420
},
@@ -427,14 +427,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
427427
Internal: false,
428428
Subnets: []string{"annotation-one", "annotation-two"},
429429
Listeners: map[string]loadbalancer.ListenerDetails{
430-
"TCP-80": loadbalancer.ListenerDetails{
430+
"TCP-80": {
431431
DefaultBackendSetName: common.String("TCP-80"),
432432
Port: common.Int(80),
433433
Protocol: common.String("TCP"),
434434
},
435435
},
436436
BackendSets: map[string]loadbalancer.BackendSetDetails{
437-
"TCP-80": loadbalancer.BackendSetDetails{
437+
"TCP-80": {
438438
Backends: []loadbalancer.BackendDetails{},
439439
HealthChecker: &loadbalancer.HealthCheckerDetails{
440440
Protocol: common.String("HTTP"),
@@ -446,7 +446,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
446446
},
447447
SourceCIDRs: []string{"0.0.0.0/0"},
448448
Ports: map[string]portSpec{
449-
"TCP-80": portSpec{
449+
"TCP-80": {
450450
ListenerPort: 80,
451451
HealthCheckerPort: 10256,
452452
},
@@ -471,7 +471,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
471471
Spec: v1.ServiceSpec{
472472
SessionAffinity: v1.ServiceAffinityNone,
473473
Ports: []v1.ServicePort{
474-
v1.ServicePort{
474+
{
475475
Protocol: v1.ProtocolTCP,
476476
Port: int32(80),
477477
},
@@ -484,14 +484,14 @@ func TestNewLBSpecSuccess(t *testing.T) {
484484
Internal: false,
485485
Subnets: []string{"annotation-one", "annotation-two"},
486486
Listeners: map[string]loadbalancer.ListenerDetails{
487-
"TCP-80": loadbalancer.ListenerDetails{
487+
"TCP-80": {
488488
DefaultBackendSetName: common.String("TCP-80"),
489489
Port: common.Int(80),
490490
Protocol: common.String("TCP"),
491491
},
492492
},
493493
BackendSets: map[string]loadbalancer.BackendSetDetails{
494-
"TCP-80": loadbalancer.BackendSetDetails{
494+
"TCP-80": {
495495
Backends: []loadbalancer.BackendDetails{},
496496
HealthChecker: &loadbalancer.HealthCheckerDetails{
497497
Protocol: common.String("HTTP"),
@@ -503,7 +503,7 @@ func TestNewLBSpecSuccess(t *testing.T) {
503503
},
504504
SourceCIDRs: []string{"0.0.0.0/0"},
505505
Ports: map[string]portSpec{
506-
"TCP-80": portSpec{
506+
"TCP-80": {
507507
ListenerPort: 80,
508508
HealthCheckerPort: 10256,
509509
},
@@ -629,7 +629,7 @@ func TestNewLBSpecSingleAD(t *testing.T) {
629629
Spec: v1.ServiceSpec{
630630
SessionAffinity: v1.ServiceAffinityNone,
631631
Ports: []v1.ServicePort{
632-
v1.ServicePort{
632+
{
633633
Protocol: v1.ProtocolTCP,
634634
Port: int32(80),
635635
},
@@ -642,14 +642,14 @@ func TestNewLBSpecSingleAD(t *testing.T) {
642642
Internal: false,
643643
Subnets: []string{"annotation-one"},
644644
Listeners: map[string]loadbalancer.ListenerDetails{
645-
"TCP-80": loadbalancer.ListenerDetails{
645+
"TCP-80": {
646646
DefaultBackendSetName: common.String("TCP-80"),
647647
Port: common.Int(80),
648648
Protocol: common.String("TCP"),
649649
},
650650
},
651651
BackendSets: map[string]loadbalancer.BackendSetDetails{
652-
"TCP-80": loadbalancer.BackendSetDetails{
652+
"TCP-80": {
653653
Backends: []loadbalancer.BackendDetails{},
654654
HealthChecker: &loadbalancer.HealthCheckerDetails{
655655
Protocol: common.String("HTTP"),
@@ -661,7 +661,7 @@ func TestNewLBSpecSingleAD(t *testing.T) {
661661
},
662662
SourceCIDRs: []string{"0.0.0.0/0"},
663663
Ports: map[string]portSpec{
664-
"TCP-80": portSpec{
664+
"TCP-80": {
665665
ListenerPort: 80,
666666
HealthCheckerPort: 10256,
667667
},

0 commit comments

Comments
 (0)