mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
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
This commit is contained in:
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user