Merge pull request #29969 from ZTE-PaaS/zhangke-patch-015

Automatic merge from submit-queue

remove duplicate code in updatePodCIDR

As kl.runtimeState.podCIDR() is a sync method, need fetch lock and release lock, so we only invoke once here
pull/6/head
Kubernetes Submit Queue 2016-08-22 17:40:43 -07:00 committed by GitHub
commit d9533c9530
1 changed files with 4 additions and 2 deletions

View File

@ -297,11 +297,13 @@ func (kl *Kubelet) syncNetworkStatus() {
// updatePodCIDR updates the pod CIDR in the runtime state if it is different
// from the current CIDR.
func (kl *Kubelet) updatePodCIDR(cidr string) {
if kl.runtimeState.podCIDR() == cidr {
podCIDR := kl.runtimeState.podCIDR()
if podCIDR == cidr {
return
}
glog.Infof("Setting Pod CIDR: %v -> %v", kl.runtimeState.podCIDR(), cidr)
glog.Infof("Setting Pod CIDR: %v -> %v", podCIDR, cidr)
kl.runtimeState.setPodCIDR(cidr)
if kl.networkPlugin != nil {