|
|
|
@ -28,14 +28,14 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
swarmLabelTaskPrefix = swarmLabel + "task_"
|
|
|
|
|
swarmLabelTaskID = swarmLabelTaskPrefix + "id"
|
|
|
|
|
swarmLabelTaskLabelPrefix = swarmLabelTaskPrefix + "label_"
|
|
|
|
|
swarmLabelTaskDesiredState = swarmLabelTaskPrefix + "desired_state"
|
|
|
|
|
swarmLabelTaskStatus = swarmLabelTaskPrefix + "state"
|
|
|
|
|
swarmLabelTaskContainerID = swarmLabelTaskPrefix + "container_id"
|
|
|
|
|
swarmLabelTaskSlot = swarmLabelTaskPrefix + "slot"
|
|
|
|
|
swarmLabelTaskPortMode = swarmLabelTaskPrefix + "port_publish_mode"
|
|
|
|
|
swarmLabelTaskPrefix = swarmLabel + "task_"
|
|
|
|
|
swarmLabelTaskID = swarmLabelTaskPrefix + "id"
|
|
|
|
|
swarmLabelTaskDesiredState = swarmLabelTaskPrefix + "desired_state"
|
|
|
|
|
swarmLabelTaskStatus = swarmLabelTaskPrefix + "state"
|
|
|
|
|
swarmLabelTaskContainerID = swarmLabelTaskPrefix + "container_id"
|
|
|
|
|
swarmLabelTaskSlot = swarmLabelTaskPrefix + "slot"
|
|
|
|
|
swarmLabelTaskPortMode = swarmLabelTaskPrefix + "port_publish_mode"
|
|
|
|
|
swarmLabelContainerLabelPrefix = swarmLabel + "container_label_"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (d *Discovery) refreshTasks(ctx context.Context) ([]*targetgroup.Group, error) {
|
|
|
|
@ -75,9 +75,11 @@ func (d *Discovery) refreshTasks(ctx context.Context) ([]*targetgroup.Group, err
|
|
|
|
|
commonLabels[swarmLabelTaskContainerID] = s.Status.ContainerStatus.ContainerID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for k, v := range s.Labels {
|
|
|
|
|
ln := strutil.SanitizeLabelName(k)
|
|
|
|
|
commonLabels[swarmLabelTaskLabelPrefix+ln] = v
|
|
|
|
|
if s.Spec.ContainerSpec != nil {
|
|
|
|
|
for k, v := range s.Spec.ContainerSpec.Labels {
|
|
|
|
|
ln := strutil.SanitizeLabelName(k)
|
|
|
|
|
commonLabels[swarmLabelContainerLabelPrefix+ln] = v
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for k, v := range serviceLabels[s.ServiceID] {
|
|
|
|
|