In DNSRR there is no Endpoint.VirtualIPs - use Spec.TaskTemplate.Networks
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
2023-02-03 00:11:24 +01:00
parent c757750ff3
commit 1c0b30963b

View File

@@ -510,17 +510,17 @@ func (p *Provider) parseService(ctx context.Context, service swarmtypes.Service,
if service.Spec.EndpointSpec.Mode == swarmtypes.ResolutionModeDNSRR {
if dData.ExtraConf.Docker.LBSwarm {
dData.NetworkSettings.Networks = make(map[string]*networkData)
for _, virtualIP := range service.Endpoint.VirtualIPs {
networkService := networkMap[virtualIP.NetworkID]
for _, net := range service.Spec.TaskTemplate.Networks {
networkService := networkMap[net.Target]
if networkService != nil {
network := &networkData{
Name: networkService.Name,
ID: virtualIP.NetworkID,
ID: net.Target,
Addr: "tasks." + service.Spec.Name,
}
dData.NetworkSettings.Networks[network.Name] = network
} else {
logger.Debug().Msgf("Network not found, id: %s", virtualIP.NetworkID)
logger.Debug().Msgf("Network not found, id: %s", net.Target)
}
}
} else {