From 913fb8097fe5616acd2473a0b35662186db2c759 Mon Sep 17 00:00:00 2001 From: Zhang Jinghui Date: Sat, 23 Nov 2019 19:18:00 +0800 Subject: [PATCH] modify comments on OnPodCreate function of svc plugin --- pkg/controllers/job/plugins/svc/svc.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/job/plugins/svc/svc.go b/pkg/controllers/job/plugins/svc/svc.go index c80070deee..b5a9ea1801 100644 --- a/pkg/controllers/job/plugins/svc/svc.go +++ b/pkg/controllers/job/plugins/svc/svc.go @@ -69,7 +69,17 @@ func (sp *servicePlugin) addFlags() { } func (sp *servicePlugin) OnPodCreate(pod *v1.Pod, job *batch.Job) error { - // use podName.serviceName as default pod DNS domain + // Add `hostname` and `subdomain` for pod, mount service config for pod. + // A pod with `hostname` and `subdomain` will have the fully qualified domain name(FQDN) + // `hostname.subdomain.namespace.svc.cluster-domain.example`. + // If there exists a headless service in the same namespace as the pod and with the + // same name as the `subdomain`, the cluster's KubeDNS Server will returns an A record for + // the Pods's fully qualified hostname, pointing to the Pod’s IP. + // `hostname.subdomain` will be used as address of the pod. + // By default, a client Pod’s DNS search list will include the Pod’s own namespace and + // the cluster’s default domain, so the pod can be accessed by pods in the same namespace + // through the address of pod. + // More info: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service if len(pod.Spec.Hostname) == 0 { pod.Spec.Hostname = pod.Name }