1
0
Fork 0

Nomad provider to allow empty services

This commit is contained in:
chrispruitt 2024-04-04 05:54:04 -04:00 committed by GitHub
parent 2c6418e17a
commit ac1753a614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 3540 additions and 87 deletions

View file

@ -97,8 +97,11 @@ func (p *Provider) buildTCPConfig(i item, configuration *dynamic.TCPConfiguratio
}
for _, service := range configuration.Services {
if err := p.addServerTCP(i, service.LoadBalancer); err != nil {
return err
// Leave load balancer empty when no address and allowEmptyServices = true
if !(i.Address == "" && p.AllowEmptyServices) {
if err := p.addServerTCP(i, service.LoadBalancer); err != nil {
return err
}
}
}
@ -115,8 +118,11 @@ func (p *Provider) buildUDPConfig(i item, configuration *dynamic.UDPConfiguratio
}
for _, service := range configuration.Services {
if err := p.addServerUDP(i, service.LoadBalancer); err != nil {
return err
// Leave load balancer empty when no address and allowEmptyServices = true
if !(i.Address == "" && p.AllowEmptyServices) {
if err := p.addServerUDP(i, service.LoadBalancer); err != nil {
return err
}
}
}
@ -136,8 +142,11 @@ func (p *Provider) buildServiceConfig(i item, configuration *dynamic.HTTPConfigu
}
for _, service := range configuration.Services {
if err := p.addServer(i, service.LoadBalancer); err != nil {
return err
// Leave load balancer empty when no address and allowEmptyServices = true
if !(i.Address == "" && p.AllowEmptyServices) {
if err := p.addServer(i, service.LoadBalancer); err != nil {
return err
}
}
}