mirror of
https://github.com/prometheus/prometheus.git
synced 2026-07-15 20:13:08 -04:00
Docker Swarm service discovery dereferenced s.Spec.TaskTemplate.ContainerSpec unconditionally when building the per-service labels. In the moby SDK, TaskSpec.ContainerSpec is an optional pointer that is mutually exclusive with PluginSpec and NetworkAttachmentSpec: it is nil when a service's task runtime is "plugin" or "attachment". ServiceList returns those services with no runtime filtering, so a nil ContainerSpec reached the label map and panicked, aborting the whole services refresh. Set the container hostname and image labels only when ContainerSpec is non-nil, mirroring the existing guard in refreshTasks. Add a regression test with a plugin service (nil ContainerSpec) alongside a normal one. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| testdata | ||
| docker.go | ||
| docker_test.go | ||
| dockerswarm.go | ||
| metrics_docker.go | ||
| metrics_dockerswarm.go | ||
| mock_test.go | ||
| network.go | ||
| nodes.go | ||
| nodes_test.go | ||
| services.go | ||
| services_test.go | ||
| tasks.go | ||
| tasks_test.go | ||