Skip to content

Commit 6187c3d

Browse files
author
Alena Prokharchyk
committed
Merge pull request #30 from prachidamle/ip_from_host_label
Use the public ip from host labels if provided in metadata
2 parents 340f2f3 + 5fce5fe commit 6187c3d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: metadata/metadata.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ func (m *MetadataClient) getContainersDnsRecords(dnsEntries map[string]dns.DnsRe
9797
logrus.Infof("%v", err)
9898
continue
9999
}
100-
ip := host.AgentIP
100+
101+
ip, ok := host.Labels["io.rancher.host.external_dns_ip"]
102+
103+
if !ok || ip == "" {
104+
ip = host.AgentIP
105+
}
106+
101107
fqdn := dns.ConvertToFqdn(container.ServiceName, container.StackName, m.EnvironmentName)
102108
records := []string{ip}
103109
dnsEntry := dns.DnsRecord{fqdn, records, "A", dns.TTL}

0 commit comments

Comments
 (0)