abe2ca94c5
Previously, we were only returning a single ListenerPort for a single service. However, we actually allow a single service to be serviced over multiple ports, as well as allow users to define what hostnames they expect their services to be contacted over. When no hosts are defined, we return the default ingress domain for any configured DNS domain. To show this in the UI, we modify the gateway-services-nodes API to return a GatewayConfig.Addresses field, which is a list of addresses over which the specific service can be contacted.
32 lines
717 B
Go
32 lines
717 B
Go
// +build !consulent
|
|
|
|
package agent
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/consul/agent/config"
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
)
|
|
|
|
type enterpriseDNSConfig struct{}
|
|
|
|
func getEnterpriseDNSConfig(conf *config.RuntimeConfig) enterpriseDNSConfig {
|
|
return enterpriseDNSConfig{}
|
|
}
|
|
|
|
func (d *DNSServer) parseDatacenterAndEnterpriseMeta(labels []string, _ *dnsConfig, datacenter *string, _ *structs.EnterpriseMeta) bool {
|
|
switch len(labels) {
|
|
case 1:
|
|
*datacenter = labels[0]
|
|
return true
|
|
case 0:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func serviceCanonicalDNSName(name, kind, datacenter, domain string, _ *structs.EnterpriseMeta) string {
|
|
return fmt.Sprintf("%s.%s.%s.%s", name, kind, datacenter, domain)
|
|
}
|