Skip to content

Commit fec3caa

Browse files
committed
Filter NodeBalancers when we know their ipv4
1 parent 0e0250e commit fec3caa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cloud/linode/loadbalancers.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,15 @@ func (l *loadbalancers) getNodeBalancerByHostname(ctx context.Context, service *
450450
}
451451

452452
func (l *loadbalancers) getNodeBalancerByIPv4(ctx context.Context, service *v1.Service, ipv4 string) (*linodego.NodeBalancer, error) {
453-
lbs, err := l.client.ListNodeBalancers(ctx, nil)
453+
// TODO: use this constructor once we merge in linodego v1 update
454+
// f := &linodego.Filter{}
455+
// f.AddField(linodego.Eq, "ipv4", ipv4)
456+
// filter, err := f.MarshalJSON()
457+
// if err != nil {
458+
// return nil, err
459+
// }
460+
filter := fmt.Sprintf(`{"ipv4": "%v"}`, ipv4)
461+
lbs, err := l.client.ListNodeBalancers(ctx, &linodego.ListOptions{Filter: filter})
454462
if err != nil {
455463
return nil, err
456464
}

0 commit comments

Comments
 (0)