[BUILD] Docker SD: Fix up deprecated types

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
pull/16765/head
Bryan Boreham 3 days ago
parent 95d47c0512
commit d6f9ba6310
  1. 6
      discovery/moby/nodes.go
  2. 5
      discovery/moby/services.go
  3. 3
      discovery/moby/tasks.go

@ -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)
}

@ -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
}

@ -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)
}

Loading…
Cancel
Save