@@ -3678,6 +3678,9 @@ func buildListener(port v1.ServicePort, annotations map[string]string, sslPorts
3678
3678
// EnsureLoadBalancer implements LoadBalancer.EnsureLoadBalancer
3679
3679
func (c * Cloud ) EnsureLoadBalancer (ctx context.Context , clusterName string , apiService * v1.Service , nodes []* v1.Node ) (* v1.LoadBalancerStatus , error ) {
3680
3680
annotations := apiService .Annotations
3681
+ if isLBExternal (annotations ) {
3682
+ return nil , cloudprovider .ImplementedElsewhere
3683
+ }
3681
3684
klog .V (2 ).Infof ("EnsureLoadBalancer(%v, %v, %v, %v, %v, %v, %v)" ,
3682
3685
clusterName , apiService .Namespace , apiService .Name , c .region , apiService .Spec .LoadBalancerIP , apiService .Spec .Ports , annotations )
3683
3686
@@ -3689,7 +3692,6 @@ func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiS
3689
3692
if len (apiService .Spec .Ports ) == 0 {
3690
3693
return nil , fmt .Errorf ("requested load balancer with no ports" )
3691
3694
}
3692
-
3693
3695
// Figure out what mappings we want on the load balancer
3694
3696
listeners := []* elb.Listener {}
3695
3697
v2Mappings := []nlbPortMapping {}
@@ -4075,6 +4077,9 @@ func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiS
4075
4077
4076
4078
// GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer
4077
4079
func (c * Cloud ) GetLoadBalancer (ctx context.Context , clusterName string , service * v1.Service ) (* v1.LoadBalancerStatus , bool , error ) {
4080
+ if isLBExternal (service .Annotations ) {
4081
+ return nil , false , nil
4082
+ }
4078
4083
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4079
4084
4080
4085
if isNLB (service .Annotations ) {
@@ -4335,6 +4340,9 @@ func (c *Cloud) updateInstanceSecurityGroupsForLoadBalancer(lb *elb.LoadBalancer
4335
4340
4336
4341
// EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted.
4337
4342
func (c * Cloud ) EnsureLoadBalancerDeleted (ctx context.Context , clusterName string , service * v1.Service ) error {
4343
+ if isLBExternal (service .Annotations ) {
4344
+ return nil
4345
+ }
4338
4346
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4339
4347
4340
4348
if isNLB (service .Annotations ) {
@@ -4519,11 +4527,13 @@ func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName strin
4519
4527
4520
4528
// UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer
4521
4529
func (c * Cloud ) UpdateLoadBalancer (ctx context.Context , clusterName string , service * v1.Service , nodes []* v1.Node ) error {
4530
+ if isLBExternal (service .Annotations ) {
4531
+ return cloudprovider .ImplementedElsewhere
4532
+ }
4522
4533
instances , err := c .findInstancesForELB (nodes , service .Annotations )
4523
4534
if err != nil {
4524
4535
return err
4525
4536
}
4526
-
4527
4537
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4528
4538
if isNLB (service .Annotations ) {
4529
4539
lb , err := c .describeLoadBalancerv2 (loadBalancerName )
0 commit comments