Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gandhipr committed Apr 17, 2024
1 parent c45e45d commit eb99a37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ The `AZURE_ENABLE_VMSS_FLEX` environment variable enables VMSS Flex support. By
|---------------------------|---------|-----------------------------------------|---------------------------|
| enableVmssFlex | false | AZURE_ENABLE_VMSS_FLEX | enableVmssFlex |

The `AZURE_GET_VMSS_SIZE_REFRESH_PERIOD` environment variable defines in seconds how frequently to call GET VMSS API to fetch VMSS info per nodegroup instance. By default, value is 30 seconds.
The AZURE_GET_VMSS_SIZE_REFRESH_PERIOD environment variable defines, in seconds, the frequency to call the GET VMSS API to fetch VMSS info per spot nodegroup instance.
By default, the value is 30 seconds. Currently, this API is only utilized for spot instances.

| Config Name | Default | Environment Variable | Cloud Config File |
|---------------------------|---------|-------------------------------------|---------------------------|
Expand Down
19 changes: 14 additions & 5 deletions cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var (
defaultVmssInstancesRefreshPeriod = 5 * time.Minute
vmssContextTimeout = 3 * time.Minute
vmssSizeMutex sync.Mutex
defaultGetVmssSizeRefreshPeriod = VmssSizeRefreshPeriodDefault * time.Second
)

const (
Expand All @@ -60,19 +59,29 @@ type ScaleSet struct {
maxSize int

enableForceDelete bool

sizeMutex sync.Mutex
curSize int64

enableDynamicInstanceList bool


// curSize tracks (and caches) the number of VMs in this ScaleSet.
// It is periodically updated from vmss.Sku.Capacity, with VMSS itself coming
// either from azure.Cache (which periodically does VMSS.List)
// or from direct VMSS.Get (used for Spot).
curSize int64
// lastSizeRefresh is the time curSize was last refreshed from vmss.Sku.Capacity.
// Together with sizeRefreshPeriod, it is used to determine if it is time to refresh curSize.
lastSizeRefresh time.Time
// sizeRefreshPeriod is how often curSize is refreshed from vmss.Sku.Capacity.
// (Set from azureCache.refreshInterval = VmssCacheTTL or [defaultMetadataCache]refreshInterval = 1min)
sizeRefreshPeriod time.Duration
// getVmssSizeRefreshPeriod is how often curSize should be refreshed in case VMSS.Get call is used (only spot instances).
// (Set from GetVmssSizeRefreshPeriod, if specified = get-vmss-size-refresh-period = 30s,
// or override from autoscalerProfile.GetVmssSizeRefreshPeriod)
getVmssSizeRefreshPeriod time.Duration

instancesRefreshPeriod time.Duration
instancesRefreshJitter int

sizeMutex sync.Mutex
instanceMutex sync.Mutex
instanceCache []cloudprovider.Instance
lastInstanceRefresh time.Time
Expand Down

0 comments on commit eb99a37

Please sign in to comment.