@@ -3668,6 +3668,9 @@ func buildListener(port v1.ServicePort, annotations map[string]string, sslPorts
3668
3668
// EnsureLoadBalancer implements LoadBalancer.EnsureLoadBalancer
3669
3669
func (c * Cloud ) EnsureLoadBalancer (ctx context.Context , clusterName string , apiService * v1.Service , nodes []* v1.Node ) (* v1.LoadBalancerStatus , error ) {
3670
3670
annotations := apiService .Annotations
3671
+ if isLBExternal (annotations ) {
3672
+ return nil , cloudprovider .ImplementedElsewhere
3673
+ }
3671
3674
klog .V (2 ).Infof ("EnsureLoadBalancer(%v, %v, %v, %v, %v, %v, %v)" ,
3672
3675
clusterName , apiService .Namespace , apiService .Name , c .region , apiService .Spec .LoadBalancerIP , apiService .Spec .Ports , annotations )
3673
3676
@@ -3679,7 +3682,6 @@ func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiS
3679
3682
if len (apiService .Spec .Ports ) == 0 {
3680
3683
return nil , fmt .Errorf ("requested load balancer with no ports" )
3681
3684
}
3682
-
3683
3685
// Figure out what mappings we want on the load balancer
3684
3686
listeners := []* elb.Listener {}
3685
3687
v2Mappings := []nlbPortMapping {}
@@ -4065,6 +4067,9 @@ func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiS
4065
4067
4066
4068
// GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer
4067
4069
func (c * Cloud ) GetLoadBalancer (ctx context.Context , clusterName string , service * v1.Service ) (* v1.LoadBalancerStatus , bool , error ) {
4070
+ if isLBExternal (service .Annotations ) {
4071
+ return nil , false , nil
4072
+ }
4068
4073
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4069
4074
4070
4075
if isNLB (service .Annotations ) {
@@ -4325,6 +4330,9 @@ func (c *Cloud) updateInstanceSecurityGroupsForLoadBalancer(lb *elb.LoadBalancer
4325
4330
4326
4331
// EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted.
4327
4332
func (c * Cloud ) EnsureLoadBalancerDeleted (ctx context.Context , clusterName string , service * v1.Service ) error {
4333
+ if isLBExternal (service .Annotations ) {
4334
+ return nil
4335
+ }
4328
4336
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4329
4337
4330
4338
if isNLB (service .Annotations ) {
@@ -4509,11 +4517,13 @@ func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName strin
4509
4517
4510
4518
// UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer
4511
4519
func (c * Cloud ) UpdateLoadBalancer (ctx context.Context , clusterName string , service * v1.Service , nodes []* v1.Node ) error {
4520
+ if isLBExternal (service .Annotations ) {
4521
+ return cloudprovider .ImplementedElsewhere
4522
+ }
4512
4523
instances , err := c .findInstancesForELB (nodes , service .Annotations )
4513
4524
if err != nil {
4514
4525
return err
4515
4526
}
4516
-
4517
4527
loadBalancerName := c .GetLoadBalancerName (ctx , clusterName , service )
4518
4528
if isNLB (service .Annotations ) {
4519
4529
lb , err := c .describeLoadBalancerv2 (loadBalancerName )
0 commit comments