Commit Graph

27 Commits

Author SHA1 Message Date
Maciek Pytel 6c8898b944 GCE: move fetching MachineType to MigInfoProvider
This allows more consistent error handling with other GCE API calls.
Also removed caching errors for MachineType API in cache.go, since
it was never never used anyway and it's inconsistent with error handling
for other APIs.
2022-06-29 15:44:45 +02:00
Bartłomiej Wróblewski a65b84197b Cache Mig instances in GceCache 2021-12-21 09:55:45 +00:00
Bartłomiej Wróblewski 577ac88555 Refresh instances to mig cache in MigInfoProvider 2021-12-20 09:27:32 +00:00
Bartłomiej Wróblewski f8a5aae0b8 Add caching of instance template names to GceCache 2021-11-04 10:43:43 +00:00
Benjamin Pineau d905ec28dd implement GetOptions for GCE
Support per-MIG (scaledown) settings as permited by the
cloudprovider's interface `GetOptions()` method.
2021-08-21 18:18:48 +02:00
Benjamin Pineau 087df8951d gcp: faster startup and refreshes with many MIGs
With 1.5k MIGs attached to a cluster, cluster-autoscaler needs about
40mn to start. Refreshing MIGs+ITs concurrently brings that down to
about 5mn.

While bulk GCE API calls (triggered at startup and on Refresh() calls)
and a few stateless functions (called by GetMigInstanceTemplate) become
concurrent, cache accesses remains lock protected. To that effect:
* Set RegenerateInstancesCache to run parallels RegenerateInstanceCacheForMig
  (slightly adapted so the slow GceService.FetchMigInstances call isn't locked)
* Set fetchAutoMigs to run parallels registerMig: rework GetMigInstanceTemplate
  so the slow InstanceGroupManagers.Get+InstanceTemplates.Get calls aren't locked

Tested on a large k8s cluster (> 1k MIGs) with intense scaling activity,
and tested on live clusters with "go build -race" cluster-autoscaler builds.
2020-12-24 11:33:49 +01:00
Maciek Pytel 655b4081f4 Migrate to klog v2 2020-06-05 17:22:26 +02:00
Marwan Ahmed a32deba59d more lint fixes 2020-06-03 17:14:20 -07:00
Brett Elliott 8f7bd5c91e Support caching errors when fetching machine types. 2020-05-21 18:05:05 +02:00
Julien Balestra 3441f616e1 cluster-autoscaler/skip-node: unblock cluster autoscaler when having a single nodegroup for node error
Signed-off-by: Julien Balestra <julien.balestra@datadoghq.com>
2019-09-11 13:40:23 +02:00
Łukasz Osipiuk 8cb8393205 Capitalize log messages in gce/cache.go
Change-Id: Id44382af91ff136ea3b69b9597795b39138b36f1
2019-05-29 14:10:25 +02:00
Łukasz Osipiuk 6cd164b7cd Add caching for mig instance templates 2019-05-29 14:10:25 +02:00
Łukasz Osipiuk 5f3f55434f Update MIG target size cache via LIST api call
If MIG target size cache is empty we are now refreshing via single
list call per zone. For non-empty cache we are querying MIGs one by one.

Change-Id: I444dc4d766aedf2d2a768a5b6972d7799dffb6f4
2019-04-16 13:56:33 +02:00
Łukasz Osipiuk e4e23e396f Separate mig-basename caching in GceCache 2019-04-10 16:44:45 +02:00
Łukasz Osipiuk bb9c4fcc92 Remove GceCache.migsMutex 2019-04-09 14:52:29 +02:00
Łukasz Osipiuk ca3d9bec52 Return MigInformation as a copy from GceCache.GetMig
This is to ensure that original struct is not modified when
in caller code which does not hold migsMutex lock.
2019-04-05 11:49:53 +02:00
Łukasz Osipiuk bd8760bbef Only refresh instances cache for one mig on cache miss in GetMigForInstance
Change-Id: I1ba550f727c7bb9e25904113e9b5e738bb8c53b1
2019-04-05 11:49:53 +02:00
Łukasz Osipiuk 34ab8ee3b1 Avoid passing GceRef arugment as pointer 2019-04-05 11:49:52 +02:00
Łukasz Osipiuk 7f65b8f7ab Use mig ref as value in GceCache.instancesCache 2019-04-05 11:49:19 +02:00
Łukasz Osipiuk 8228e8f4a6 Store migs in GceRef->MigInformation map in gce/cache.go 2019-04-03 14:31:52 +02:00
vivekbagade 2a0535b00f Added migTargetSizeCache in GceCache to cache TargetSize calls for
each GCEMig for each loop of the CA. The cache is invalidated during
refresh that occurs during the start of each loop and during MIG
size change (SetMigSize and DeleteInstances)
2019-03-01 18:12:58 +01:00
CodeLingo Bot c0603afdeb Fix error format strings according to best practices from CodeReviewComments
Fix error format strings according to best practices from CodeReviewComments

Fix error format strings according to best practices from CodeReviewComments

Reverted incorrect change to with error format string

Signed-off-by: CodeLingo Bot <hello@codelingo.io>
Signed-off-by: CodeLingoBot <hello@codelingo.io>
Signed-off-by: CodeLingo Bot <hello@codelingo.io>
Signed-off-by: CodeLingo Bot <bot@codelingo.io>

Resolve conflict

Signed-off-by: CodeLingo Bot <hello@codelingo.io>
Signed-off-by: CodeLingoBot <hello@codelingo.io>
Signed-off-by: CodeLingo Bot <hello@codelingo.io>
Signed-off-by: CodeLingo Bot <bot@codelingo.io>

Fix error strings in testscases to remedy failing tests

Signed-off-by: CodeLingo Bot <bot@codelingo.io>

Fix more error strings to remedy failing tests

Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-01-11 09:10:31 +13:00
Łukasz Osipiuk a2d7e66bb0 Return quota/stockout info from gce cloud provider 2018-12-07 16:21:34 +01:00
Łukasz Osipiuk 016bf7fc2c Use k8s.io/klog instead github.com/golang/glog 2018-11-26 17:30:31 +01:00
mooncake 6f1c28ef8e Fix typos: alredy -> already
Signed-off-by: mooncake <xcoder@tenxcloud.com>
2018-11-04 21:14:45 +08:00
Aleksandra Malinowska 7227ffe725 code review fixes 2018-08-13 15:04:03 +02:00
Aleksandra Malinowska 38f2bb9a2b Extract cache from GCE manager 2018-08-09 11:22:16 +02:00