From ae9e93d7845e1f5656c4ec6a87ff64b2ee3320a7 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Wed, 23 Oct 2019 17:16:23 -0700 Subject: [PATCH] Move CheckLimitsForResolvConf to Kubelet#syncLoop --- pkg/kubelet/kubelet.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 9fa8fcf52eca..8d29ae69fc0c 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -1833,6 +1833,13 @@ func (kl *Kubelet) syncLoop(updates <-chan kubetypes.PodUpdate, handler SyncHand factor = 2 ) duration := base + // Responsible for checking limits in resolv.conf + // The limits do not have anything to do with individual pods + // Since this is called in syncLoop, we don't need to call it anywhere else + if kl.dnsConfigurer != nil && kl.dnsConfigurer.ResolverConfig != "" { + kl.dnsConfigurer.CheckLimitsForResolvConf() + } + for { if err := kl.runtimeState.runtimeErrors(); err != nil { klog.Errorf("skipping pod synchronization - %v", err) @@ -2039,11 +2046,6 @@ func (kl *Kubelet) handleMirrorPod(mirrorPod *v1.Pod, start time.Time) { func (kl *Kubelet) HandlePodAdditions(pods []*v1.Pod) { start := kl.clock.Now() sort.Sort(sliceutils.PodsByCreationTime(pods)) - // Responsible for checking limits in resolv.conf - // The limits do not have anything to do with individual pods - if kl.dnsConfigurer != nil && kl.dnsConfigurer.ResolverConfig != "" { - kl.dnsConfigurer.CheckLimitsForResolvConf() - } for _, pod := range pods { existingPods := kl.podManager.GetPods() // Always add the pod to the pod manager. Kubelet relies on the pod @@ -2081,10 +2083,6 @@ func (kl *Kubelet) HandlePodAdditions(pods []*v1.Pod) { // being updated from a config source. func (kl *Kubelet) HandlePodUpdates(pods []*v1.Pod) { start := kl.clock.Now() - // Responsible for checking limits in resolv.conf - if kl.dnsConfigurer != nil && kl.dnsConfigurer.ResolverConfig != "" { - kl.dnsConfigurer.CheckLimitsForResolvConf() - } for _, pod := range pods { kl.podManager.UpdatePod(pod) if kubetypes.IsMirrorPod(pod) {