Skip to content

Commit

Permalink
fix: handle svc objects with empty annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Privitere <[email protected]>
  • Loading branch information
cprivitere committed Jun 25, 2024
1 parent dce7b65 commit cfb9955
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions metal/loadbalancers/emlb/emlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ func (l *LB) reconcileService(ctx context.Context, svc *v1.Service, n []*v1.Node

patch := client.MergeFrom(svc.DeepCopy())

svc.Annotations[LoadBalancerIDAnnotation] = loadBalancer.GetId()
svc.Annotations["equinix.com/loadbalancerMetro"] = l.manager.GetMetro()
annotations := svc.GetAnnotations()
if annotations == nil {
annotations = make(map[string]string)
}

annotations[LoadBalancerIDAnnotation] = loadBalancer.GetId()
annotations["equinix.com/loadbalancerMetro"] = l.manager.GetMetro()

svc.SetAnnotations(annotations)

return l.client.Patch(ctx, svc, patch)
}
Expand Down

0 comments on commit cfb9955

Please sign in to comment.