MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / InstancePodDNSNames

Function InstancePodDNSNames

internal/naming/dns.go:20–36  ·  view source on GitHub ↗

InstancePodDNSNames returns the possible DNS names for instance. The first name is the fully qualified domain name (FQDN).

(ctx context.Context, instance *appsv1.StatefulSet)

Source from the content-addressed store, hash-verified

18// InstancePodDNSNames returns the possible DNS names for instance. The first
19// name is the fully qualified domain name (FQDN).
20func InstancePodDNSNames(ctx context.Context, instance *appsv1.StatefulSet) []string {
21 var (
22 domain = KubernetesClusterDomain(ctx)
23 namespace = instance.Namespace
24 name = instance.Name + "-0." + instance.Spec.ServiceName
25 )
26
27 // We configure our instances with a subdomain so that Pods get stable DNS
28 // names in the form "{pod}.{service}.{namespace}.svc.{cluster-domain}".
29 // - https://docs.k8s.io/concepts/services-networking/dns-pod-service/#pods
30 return []string{
31 name + "." + namespace + ".svc." + domain,
32 name + "." + namespace + ".svc",
33 name + "." + namespace,
34 name,
35 }
36}
37
38// RepoHostPodDNSNames returns the possible DNS names for a pgBackRest repository host Pod.
39// The first name is the fully qualified domain name (FQDN).

Callers 2

instanceCertificateMethod · 0.92
TestInstancePodDNSNamesFunction · 0.85

Calls 1

KubernetesClusterDomainFunction · 0.85

Tested by 1

TestInstancePodDNSNamesFunction · 0.68