Commit 079158fa authored by Pengfei Ni's avatar Pengfei Ni

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.
parent 47320fd3
...@@ -74,16 +74,19 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *v1.Pod, attemp ...@@ -74,16 +74,19 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *v1.Pod, attemp
Annotations: newPodAnnotations(pod), 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) { 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 // TODO: Add domain support in new runtime interface
hostname, _, err := m.runtimeHelper.GeneratePodHostNameAndDomain(pod) hostname, _, err := m.runtimeHelper.GeneratePodHostNameAndDomain(pod)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment