fix: Prevent broken dnsmasq entries for services without internal domain
Services registered via the service API have a domain but no internal domain (that's a Wild Cloud instance concept). The dnsmasq generator was producing broken entries like `local=//` and `address=//`. Fix: skip internal domain entries when InternalDomain is empty, in both config.go and config_modular.go. Also fix DNS entries to point to Central's IP (where HAProxy listens) rather than the backend address — all traffic flows through Central. Added 3 tests covering: service-only, mixed services+instances. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -57,11 +57,14 @@ func (g *ConfigGenerator) Generate(cfg *config.GlobalConfig, clouds []config.Ins
|
||||
continue
|
||||
}
|
||||
// Internal domain (.internal.cloud.example.tld) - local only, no external DNS
|
||||
resolution_section += fmt.Sprintf("local=/%s/\naddress=/%s/%s\n", cloud.Cloud.InternalDomain, cloud.Cloud.InternalDomain, loadBalancerIP)
|
||||
if cloud.Cloud.InternalDomain != "" {
|
||||
resolution_section += fmt.Sprintf("local=/%s/\naddress=/%s/%s\n", cloud.Cloud.InternalDomain, cloud.Cloud.InternalDomain, loadBalancerIP)
|
||||
}
|
||||
|
||||
// External domain (cloud.example.tld) - resolve to load balancer IP without external DNS lookup
|
||||
// This makes LAN traffic go directly to load balancer instead of routing through external DNS first
|
||||
resolution_section += fmt.Sprintf("address=/%s/%s\n", cloud.Cloud.Domain, loadBalancerIP)
|
||||
// External/primary domain - resolve to backend IP
|
||||
if cloud.Cloud.Domain != "" {
|
||||
resolution_section += fmt.Sprintf("address=/%s/%s\n", cloud.Cloud.Domain, loadBalancerIP)
|
||||
}
|
||||
}
|
||||
|
||||
template := `# Configuration file for dnsmasq.
|
||||
|
||||
Reference in New Issue
Block a user