[BUILD] Docker SD: Fix up deprecated types

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2025-06-23 16:15:58 +01:00
parent 95d47c0512
commit d6f9ba6310
3 changed files with 6 additions and 8 deletions

View file

@ -19,7 +19,7 @@ import (
"net"
"strconv"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/discovery/targetgroup"
@ -48,7 +48,7 @@ func (d *Discovery) refreshNodes(ctx context.Context) ([]*targetgroup.Group, err
Source: "DockerSwarm",
}
nodes, err := d.client.NodeList(ctx, types.NodeListOptions{Filters: d.filters})
nodes, err := d.client.NodeList(ctx, swarm.NodeListOptions{Filters: d.filters})
if err != nil {
return nil, fmt.Errorf("error while listing swarm nodes: %w", err)
}
@ -85,7 +85,7 @@ func (d *Discovery) refreshNodes(ctx context.Context) ([]*targetgroup.Group, err
}
func (d *Discovery) getNodesLabels(ctx context.Context) (map[string]map[string]string, error) {
nodes, err := d.client.NodeList(ctx, types.NodeListOptions{})
nodes, err := d.client.NodeList(ctx, swarm.NodeListOptions{})
if err != nil {
return nil, fmt.Errorf("error while listing swarm nodes: %w", err)
}

View file

@ -19,7 +19,6 @@ import (
"net"
"strconv"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/prometheus/common/model"
@ -46,7 +45,7 @@ func (d *Discovery) refreshServices(ctx context.Context) ([]*targetgroup.Group,
Source: "DockerSwarm",
}
services, err := d.client.ServiceList(ctx, types.ServiceListOptions{Filters: d.filters})
services, err := d.client.ServiceList(ctx, swarm.ServiceListOptions{Filters: d.filters})
if err != nil {
return nil, fmt.Errorf("error while listing swarm services: %w", err)
}
@ -127,7 +126,7 @@ func (d *Discovery) refreshServices(ctx context.Context) ([]*targetgroup.Group,
}
func (d *Discovery) getServicesLabelsAndPorts(ctx context.Context) (map[string]map[string]string, map[string][]swarm.PortConfig, error) {
services, err := d.client.ServiceList(ctx, types.ServiceListOptions{})
services, err := d.client.ServiceList(ctx, swarm.ServiceListOptions{})
if err != nil {
return nil, nil, err
}

View file

@ -19,7 +19,6 @@ import (
"net"
"strconv"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/prometheus/common/model"
@ -43,7 +42,7 @@ func (d *Discovery) refreshTasks(ctx context.Context) ([]*targetgroup.Group, err
Source: "DockerSwarm",
}
tasks, err := d.client.TaskList(ctx, types.TaskListOptions{Filters: d.filters})
tasks, err := d.client.TaskList(ctx, swarm.TaskListOptions{Filters: d.filters})
if err != nil {
return nil, fmt.Errorf("error while listing swarm services: %w", err)
}