chore: update to non-deprecated Docker SDK types

- Use container.Summary instead of types.Container
- Use swarmtypes.ServiceListOptions instead of types.ServiceListOptions
- Use swarmtypes.TaskListOptions instead of types.TaskListOptions

These types were deprecated in favor of package-specific types.
This commit is contained in:
rcourtman 2025-11-27 09:36:05 +00:00
parent d7d1631e1c
commit 60cd019d33
2 changed files with 3 additions and 5 deletions

View file

@ -22,7 +22,6 @@ import (
"syscall"
"time"
"github.com/docker/docker/api/types"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
systemtypes "github.com/docker/docker/api/types/system"
@ -766,7 +765,7 @@ func (a *Agent) pruneStaleCPUSamples(active map[string]struct{}) {
}
}
func (a *Agent) collectContainer(ctx context.Context, summary types.Container) (agentsdocker.Container, error) {
func (a *Agent) collectContainer(ctx context.Context, summary containertypes.Summary) (agentsdocker.Container, error) {
const perContainerTimeout = 15 * time.Second
containerCtx, cancel := context.WithTimeout(ctx, perContainerTimeout)

View file

@ -7,7 +7,6 @@ import (
"strconv"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
swarmtypes "github.com/docker/docker/api/types/swarm"
systemtypes "github.com/docker/docker/api/types/system"
@ -159,7 +158,7 @@ func (a *Agent) collectSwarmData(ctx context.Context, info systemtypes.Info, con
}
func (a *Agent) collectSwarmDataFromManager(ctx context.Context, info systemtypes.Info, scope string, containers map[string]agentsdocker.Container, includeServices, includeTasks bool) ([]agentsdocker.Service, []agentsdocker.Task, error) {
serviceList, err := a.docker.ServiceList(ctx, types.ServiceListOptions{Status: true})
serviceList, err := a.docker.ServiceList(ctx, swarmtypes.ServiceListOptions{Status: true})
if err != nil {
return nil, nil, err
}
@ -184,7 +183,7 @@ func (a *Agent) collectSwarmDataFromManager(ctx context.Context, info systemtype
taskFilters.Add("node", info.Swarm.NodeID)
}
taskList, err := a.docker.TaskList(ctx, types.TaskListOptions{Filters: taskFilters})
taskList, err := a.docker.TaskList(ctx, swarmtypes.TaskListOptions{Filters: taskFilters})
if err != nil {
return services, nil, err
}