@@ -239,7 +239,7 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri
239239 klog .Infof ("created new NodeBalancer (%d) for service (%s)" , nb .ID , serviceNn )
240240
241241 case nil :
242- if err = l .updateNodeBalancer (ctx , service , nodes , nb ); err != nil {
242+ if err = l .updateNodeBalancer (ctx , clusterName , service , nodes , nb ); err != nil {
243243 sentry .CaptureError (ctx , err )
244244 return nil , err
245245 }
@@ -263,7 +263,7 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri
263263}
264264
265265//nolint:funlen
266- func (l * loadbalancers ) updateNodeBalancer (ctx context.Context , service * v1.Service , nodes []* v1.Node , nb * linodego.NodeBalancer ) (err error ) {
266+ func (l * loadbalancers ) updateNodeBalancer (ctx context.Context , clusterName string , service * v1.Service , nodes []* v1.Node , nb * linodego.NodeBalancer ) (err error ) {
267267 if len (nodes ) == 0 {
268268 return fmt .Errorf ("%w: service %s" , errNoNodesAvailable , getServiceNn (service ))
269269 }
@@ -280,7 +280,7 @@ func (l *loadbalancers) updateNodeBalancer(ctx context.Context, service *v1.Serv
280280 }
281281 }
282282
283- tags := l .getLoadBalancerTags (ctx , service )
283+ tags := l .getLoadBalancerTags (ctx , clusterName , service )
284284 if ! reflect .DeepEqual (nb .Tags , tags ) {
285285 update := nb .GetUpdateOptions ()
286286 update .Tags = & tags
@@ -392,7 +392,7 @@ func (l *loadbalancers) UpdateLoadBalancer(ctx context.Context, clusterName stri
392392 }
393393 }
394394
395- return l .updateNodeBalancer (ctx , serviceWithStatus , nodes , nb )
395+ return l .updateNodeBalancer (ctx , clusterName , serviceWithStatus , nodes , nb )
396396}
397397
398398// Delete any NodeBalancer configs for ports that no longer exist on the Service
@@ -505,19 +505,20 @@ func (l *loadbalancers) getNodeBalancerByID(ctx context.Context, service *v1.Ser
505505 return nb , nil
506506}
507507
508- func (l * loadbalancers ) getLoadBalancerTags (_ context.Context , service * v1.Service ) []string {
508+ func (l * loadbalancers ) getLoadBalancerTags (_ context.Context , clusterName string , service * v1.Service ) []string {
509+ tags := []string {clusterName }
509510 tagStr , ok := getServiceAnnotation (service , annLinodeLoadBalancerTags )
510511 if ok {
511- return strings .Split (tagStr , "," )
512+ return append ( tags , strings .Split (tagStr , "," ) ... )
512513 }
513- return [] string {}
514+ return tags
514515}
515516
516517func (l * loadbalancers ) createNodeBalancer (ctx context.Context , clusterName string , service * v1.Service , configs []* linodego.NodeBalancerConfigCreateOptions ) (lb * linodego.NodeBalancer , err error ) {
517518 connThrottle := getConnectionThrottle (service )
518519
519520 label := l .GetLoadBalancerName (ctx , clusterName , service )
520- tags := l .getLoadBalancerTags (ctx , service )
521+ tags := l .getLoadBalancerTags (ctx , clusterName , service )
521522 createOpts := linodego.NodeBalancerCreateOptions {
522523 Label : & label ,
523524 Region : l .zone ,
0 commit comments