mirror of https://github.com/k3s-io/k3s
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
parent
47320fd3f0
commit
079158fa08
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue