Skip to content

Commit d823f7b

Browse files
Remove check for number of subnets
1 parent d5dc7a0 commit d823f7b

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

pkg/cloudprovider/providers/oci/load_balancer_spec.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,14 @@ func NewLBSpec(svc *v1.Service, nodes []*v1.Node, defaultSubnets []string, sslCo
134134
return nil, errors.Errorf("a configuration for subnet1 must be specified for an internal load balancer")
135135
}
136136
subnets = subnets[:1]
137-
} else {
138-
if subnets[0] == "" || subnets[1] == "" {
139-
return nil, errors.Errorf("a configuration for both subnets must be specified")
140-
}
141137
}
138+
// Disable check for whether there are two subnets, rely on OCI to decide whether the number of subnets is correct
139+
// This allows LoadBalancers to be created in single AD regions
140+
// else {
141+
// if subnets[0] == "" || subnets[1] == "" {
142+
// return nil, errors.Errorf("a configuration for both subnets must be specified")
143+
// }
144+
// }
142145

143146
listeners, err := getListeners(svc, sslConfig)
144147
if err != nil {

pkg/cloudprovider/providers/oci/load_balancer_spec_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -566,21 +566,6 @@ func TestNewLBSpecFailure(t *testing.T) {
566566
},
567567
expectedErrMsg: "error parsing service annotation: service.beta.kubernetes.io/oci-load-balancer-connection-idle-timeout=whoops",
568568
},
569-
"missing subnet defaults and annotations": {
570-
service: &v1.Service{
571-
ObjectMeta: metav1.ObjectMeta{
572-
Namespace: "kube-system",
573-
Name: "testservice",
574-
UID: "test-uid",
575-
Annotations: map[string]string{},
576-
},
577-
Spec: v1.ServiceSpec{
578-
SessionAffinity: v1.ServiceAffinityNone,
579-
Ports: []v1.ServicePort{},
580-
},
581-
},
582-
expectedErrMsg: "a configuration for both subnets must be specified",
583-
},
584569
"internal lb missing subnet1": {
585570
defaultSubnetTwo: "two",
586571
service: &v1.Service{

0 commit comments

Comments
 (0)