Merge pull request #93846 from knight42/fix/TestEnsureBackendPoolDeletedConcurrently

fix(azure): set default value of VmssVirtualMachinesCacheTTLInSeconds when initializing scaleSet
This commit is contained in:
Kubernetes Prow Robot 2020-08-10 21:12:17 -07:00 committed by GitHub
commit 04362870ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -83,13 +83,16 @@ type scaleSet struct {
// newScaleSet creates a new scaleSet. // newScaleSet creates a new scaleSet.
func newScaleSet(az *Cloud) (VMSet, error) { func newScaleSet(az *Cloud) (VMSet, error) {
var err error if az.Config.VmssVirtualMachinesCacheTTLInSeconds == 0 {
az.Config.VmssVirtualMachinesCacheTTLInSeconds = vmssVirtualMachinesCacheTTLDefaultInSeconds
}
ss := &scaleSet{ ss := &scaleSet{
Cloud: az, Cloud: az,
availabilitySet: newAvailabilitySet(az), availabilitySet: newAvailabilitySet(az),
vmssVMCache: &sync.Map{}, vmssVMCache: &sync.Map{},
} }
var err error
if !ss.DisableAvailabilitySetNodes { if !ss.DisableAvailabilitySetNodes {
ss.availabilitySetNodesCache, err = ss.newAvailabilitySetNodesCache() ss.availabilitySetNodesCache, err = ss.newAvailabilitySetNodesCache()
if err != nil { if err != nil {

View File

@ -154,9 +154,6 @@ func (ss *scaleSet) gcVMSSVMCache() error {
// newVMSSVirtualMachinesCache instanciates a new VMs cache for VMs belonging to the provided VMSS. // newVMSSVirtualMachinesCache instanciates a new VMs cache for VMs belonging to the provided VMSS.
func (ss *scaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cacheKey string) (*azcache.TimedCache, error) { func (ss *scaleSet) newVMSSVirtualMachinesCache(resourceGroupName, vmssName, cacheKey string) (*azcache.TimedCache, error) {
if ss.Config.VmssVirtualMachinesCacheTTLInSeconds == 0 {
ss.Config.VmssVirtualMachinesCacheTTLInSeconds = vmssVirtualMachinesCacheTTLDefaultInSeconds
}
vmssVirtualMachinesCacheTTL := time.Duration(ss.Config.VmssVirtualMachinesCacheTTLInSeconds) * time.Second vmssVirtualMachinesCacheTTL := time.Duration(ss.Config.VmssVirtualMachinesCacheTTLInSeconds) * time.Second
getter := func(key string) (interface{}, error) { getter := func(key string) (interface{}, error) {