mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
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.
This commit is contained in:
parent
47320fd3f0
commit
079158fa08
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user