CRI: add support for dns cluster first policy

PR #29378 introduces ClusterFirstWithHostNet policy but only dockertools
was updated to support the feature. This PR updates kuberuntime to
support it for all runtimes.

Also fixes #43352.
pull/6/head
Pengfei Ni 2017-03-20 14:32:46 +08:00
parent 47320fd3f0
commit 079158fa08
1 changed files with 12 additions and 9 deletions

View File

@ -74,16 +74,19 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *v1.Pod, attemp
Annotations: newPodAnnotations(pod),
}
dnsServers, dnsSearches, useClusterFirstPolicy, err := m.runtimeHelper.GetClusterDNS(pod)
if err != nil {
return nil, err
}
podSandboxConfig.DnsConfig = &runtimeapi.DNSConfig{
Servers: dnsServers,
Searches: dnsSearches,
}
if useClusterFirstPolicy {
podSandboxConfig.DnsConfig.Options = defaultDNSOptions
}
if !kubecontainer.IsHostNetworkPod(pod) {
dnsServers, dnsSearches, _, err := m.runtimeHelper.GetClusterDNS(pod)
if err != nil {
return nil, err
}
podSandboxConfig.DnsConfig = &runtimeapi.DNSConfig{
Servers: dnsServers,
Searches: dnsSearches,
Options: defaultDNSOptions,
}
// TODO: Add domain support in new runtime interface
hostname, _, err := m.runtimeHelper.GeneratePodHostNameAndDomain(pod)
if err != nil {