optimize code duplicate for updatePodCIDR

This commit is contained in:
Ke Zhang 2016-08-09 15:46:21 +08:00
parent 70d6fe6d1c
commit 2b654d1206

View File

@ -281,11 +281,13 @@ func (kl *Kubelet) syncNetworkStatus() {
// updatePodCIDR updates the pod CIDR in the runtime state if it is different // updatePodCIDR updates the pod CIDR in the runtime state if it is different
// from the current CIDR. // from the current CIDR.
func (kl *Kubelet) updatePodCIDR(cidr string) { func (kl *Kubelet) updatePodCIDR(cidr string) {
if kl.runtimeState.podCIDR() == cidr { podCIDR := kl.runtimeState.podCIDR()
if podCIDR == cidr {
return 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) kl.runtimeState.setPodCIDR(cidr)
if kl.networkPlugin != nil { if kl.networkPlugin != nil {