mirror of https://github.com/k3s-io/k3s
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 herepull/6/head
commit
d9533c9530
|
@ -297,11 +297,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 {
|
||||||
|
|
Loading…
Reference in New Issue