Deflake TestUpdateNodeStatusWithLease - guard cached machineInfo

This commit is contained in:
Jordan Liggitt
2020-08-05 09:59:56 -04:00
parent f7e3bcdec2
commit b181c76cbd
4 changed files with 27 additions and 12 deletions

View File

@@ -382,5 +382,13 @@ func (kl *Kubelet) GetVersionInfo() (*cadvisorapiv1.VersionInfo, error) {
// GetCachedMachineInfo assumes that the machine info can't change without a reboot
func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorapiv1.MachineInfo, error) {
kl.machineInfoLock.RLock()
defer kl.machineInfoLock.RUnlock()
return kl.machineInfo, nil
}
func (kl *Kubelet) setCachedMachineInfo(info *cadvisorapiv1.MachineInfo) {
kl.machineInfoLock.Lock()
defer kl.machineInfoLock.Unlock()
kl.machineInfo = info
}