Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud provider[Packet] fixes #4274

Merged

Conversation

ipochi
Copy link
Contributor

@ipochi ipochi commented Aug 18, 2021

This PR address certain issues found when deploying Cluster Autoscaler on Equinix Metal, formerly Packet.

  1. fix panic on entry in nil map

    In the latest version of cluster-autoscaler (cloudprovider: packet), the
    code panics and the pods go into CrashLoopBackoff due to an entry
    assignment on a nil map.

  2. Consider the string prefix equinixmetal://

    When K8s API is queried to get providerID from Node Spec, some machines
    return packet://<uuid>, whereas some return equinixmetal://, this
    creates error as the string is not trimmed properly and hence results in
    a 404 when an untrimmed string is queried to Equinix Metal API for
    device information.

  3. Make controller node label configurable

    Currently the label to identify controller/master node is hard coded to
    node-role.kubernetes.io/master.

    There have been some conversations centered around replacing the label
    with node-role.kubernetes.io/control-plane.

    In Lokomotive, the label to identify
    the controller/master node is node.kubernetes.io/master, the reasons
    for this is mentioned in this issue

    Make the label configurable by setting an env variable in
    the deployment CONTROLLER_NODE_IDENTIFIER_LABEL, if set then the value
    in the env variable is used for identifying controller/master nodes, if
    not set/passed, then the existing behavior is followed choosing the
    existing label.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 18, 2021
@@ -592,7 +603,7 @@ func (mgr *packetManagerRest) getNodes(nodegroup string) ([]string, error) {

for _, d := range devices.Devices {
if Contains(d.Tags, "k8s-cluster-"+mgr.getNodePoolDefinition(nodegroup).clusterName) && Contains(d.Tags, "k8s-nodepool-"+nodegroup) {
nodes = append(nodes, fmt.Sprintf("packet://%s", d.ID))
nodes = append(nodes, fmt.Sprintf("equinixmetal://%s", d.ID))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, wouldn't this cause the autoscaler to think that any Nodes w/ the 'packet://' provider id prefix to be unregistered (and as a result, eventually deleted)?

// UpdateNodes updates the state of the nodes in the ClusterStateRegistry and recalculates the stats
func (csr *ClusterStateRegistry) UpdateNodes(nodes []*apiv1.Node, nodeInfosForGroups map[string]*schedulerframework.NodeInfo, currentTime time.Time) error {
csr.updateNodeGroupMetrics()
targetSizes, err := getTargetSizes(csr.cloudProvider)
if err != nil {
return err
}
cloudProviderNodeInstances, err := csr.getCloudProviderNodeInstances()
if err != nil {
return err
}
notRegistered := getNotRegisteredNodes(nodes, cloudProviderNodeInstances, currentTime)
csr.Lock()
defer csr.Unlock()
csr.nodes = nodes
csr.nodeInfosForGroups = nodeInfosForGroups
csr.previousCloudProviderNodeInstances = csr.cloudProviderNodeInstances
csr.cloudProviderNodeInstances = cloudProviderNodeInstances
csr.updateUnregisteredNodes(notRegistered)
csr.updateReadinessStats(currentTime)
// update acceptable ranges based on requests from last loop and targetSizes
// updateScaleRequests relies on acceptableRanges being up to date
csr.updateAcceptableRanges(targetSizes)
csr.updateScaleRequests(currentTime)
csr.handleInstanceCreationErrors(currentTime)
// recalculate acceptable ranges after removing timed out requests
csr.updateAcceptableRanges(targetSizes)
csr.updateIncorrectNodeGroupSizes(currentTime)
return nil
}

I've hit similar complications around the Node provider IDs with cluster-api-provider-packet around migration from an older version of the packet-ccm to a newer version of cloud-provider-equinix-metal, and the migration process can be a bit messy, especially since the ProviderID field on the Node is immutable.

There are probably a couple of options available:

  • Switch everything to use the new equinixmetal:;// provider id prefix and require using a newer version of the cloud-provider
  • Make the prefix configurable, so that it can work with either prefix, but the user must configure it correctly

Either way, we should probably document some type of migration strategy, since I'm not sure there is a way to stay flexible without changes to the core autoscaling code, or forcing node/device churn in the cluster.

For cluster-api-provider-packet, the current plan is to do something along the lines of:

  • Update packet-ccm to cloud-provider-equinix-metal
  • Upgrade the cluster api provider to a version that uses the new provider id prefix
  • Delete and Recreate the Node resources to change the providerID.

A similar approach should be possible with the autoscaler, thought it might be better to disable the autoscaler during the upgrade process to avoid any potential of confusion that could cause workload disruption during the node deletion/recreation process.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @detiber. Thanks for the feedback :)

@ipochi as far as I understand, it is not possible to get mixed packet:// and equnixmetal:// on a single cluster, right? Those are set by the CCM, which will either set it to one or another, or? If that's the case, we should indeed make it configurable.

Copy link
Contributor Author

@ipochi ipochi Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@detiber Thanks for your valuable feedback. I think I misunderstood about the importance of packet:// in

nodes = append(nodes, fmt.Sprintf("packet://%s", d.ID))

Also @invidian @detiber

Its is quite possible to get mixed packet:// and equinixmetal:// on a single cluster. If ta cluster is created with packet-ccm and then packet-ccm is upgraded to cloud-provider-equinix-metal, then any new nodes created will have equinixmetal://, whilst the old nodes would still continue to have packet://

Example:

$ kubectl get nodes
NAME                         STATUS   ROLES    AGE     VERSION
theta-anotherpool-worker-0   Ready    <none>   9m29s   v1.21.1 - After upgrade to cloud-provider-equinix-metal
theta-controller-0           Ready    <none>   86m     v1.21.1 - Before upgrade
theta-small-worker-0         Ready    <none>   86m     v1.21.1 - Before upgrade
$ kubectl get nodes -o jsonpath='{.items[*].spec.providerID}'
equinixmetal://536e117a-6d6e-4d9c-b502-f67170662aef packet://b7057a83-732e-4ae6-b5a7-d28516556ba6 packet://4815edc6-b0e2-4bdb-bbb0-daca73e72c1a⏎

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its is quite possible to get mixed packet:// and equinixmetal:// on a single cluster. If ta cluster is created with packet-ccm and then packet-ccm is upgraded to cloud-provider-equinix-metal, then any new nodes created will have equinixmetal://, whilst the old nodes would still continue to have packet://

Yes, but this is the situation which can be gated. You can disable the autoscaler, do CCM -> CCEM upgrade, re-register all nodes, then upgrade the autoscaler I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario I described above didn't involve autoscaler.

Merely upgrading from CCM TO CCEM and adding a node to the cluster.

Can deregistering and registering a node be done in case of a single controller node ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario I described above didn't involve autoscaler.

Merely upgrading from CCM TO CCEM and adding a node to the cluster.

It doesn't matter who adds new node :) But the autoscaler can do it unattended.

Can deregistering and registering a node be done in case of a single controller node ?

That seem Lokomotive specific question and I don't know the answer 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: We should't worry about controller nodes if I understand correctly ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming they will be correctly skipped, yes. Good point!

@@ -592,7 +603,7 @@ func (mgr *packetManagerRest) getNodes(nodegroup string) ([]string, error) {

for _, d := range devices.Devices {
if Contains(d.Tags, "k8s-cluster-"+mgr.getNodePoolDefinition(nodegroup).clusterName) && Contains(d.Tags, "k8s-nodepool-"+nodegroup) {
nodes = append(nodes, fmt.Sprintf("packet://%s", d.ID))
nodes = append(nodes, fmt.Sprintf("equinixmetal://%s", d.ID))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @detiber. Thanks for the feedback :)

@ipochi as far as I understand, it is not possible to get mixed packet:// and equnixmetal:// on a single cluster, right? Those are set by the CCM, which will either set it to one or another, or? If that's the case, we should indeed make it configurable.

In the latest version of cluster-autoscaler (cloudprovider: packet), the
code panics and the pods go into CrashLoopBackoff due to an entry
assignment on a nil map.

This commit fixes that by initializing the ConfigFile instance.

I believe this situation is created when the config file doesn't contain
any information about the nodepool and also `default` config is not
present, but this does not take care the use case of when `Global`
section is defined in the config file.

Below is the error reproduced when `[Global]` is used in the config
file.

```
panic: assignment to entry in nil map

goroutine 131 [running]:
k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet.createPacketManagerRest(0x44cf260, 0xc00085e448, 0xc000456670, 0x1, 0x1, 0x0, 0x0, 0x0, 0x3fe0000000000000, 0x3fe0000000000000, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet/packet_manager_rest.go:307 +0xaca
k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet.createPacketManager(0x44cf260, 0xc00085e448, 0xc000456670, 0x1, 0x1, 0x0, 0x0, 0x0, 0x3fe0000000000000, 0x3fe0000000000000, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet/packet_manager.go:64 +0x179
k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet.BuildPacket(0x3fe0000000000000, 0x3fe0000000000000, 0x1bf08eb000, 0x1176592e000, 0xa, 0x0, 0x4e200, 0x0, 0x186a0000000000, 0x0, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet/packet_cloud_provider.go:164 +0xe5
k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder.buildCloudProvider(0x3fe0000000000000, 0x3fe0000000000000, 0x1bf08eb000, 0x1176592e000, 0xa, 0x0, 0x4e200, 0x0, 0x186a0000000000, 0x0, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder/builder_all.go:91 +0x31f
k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder.NewCloudProvider(0x3fe0000000000000, 0x3fe0000000000000, 0x1bf08eb000, 0x1176592e000, 0xa, 0x0, 0x4e200, 0x0, 0x186a0000000000, 0x0, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder/cloud_provider_builder.go:45 +0x1e6
k8s.io/autoscaler/cluster-autoscaler/core.initializeDefaultOptions(0xc0013876e0, 0x452ef01, 0xc000d80e20)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/core/autoscaler.go:101 +0x2fd
k8s.io/autoscaler/cluster-autoscaler/core.NewAutoscaler(0x3fe0000000000000, 0x3fe0000000000000, 0x1bf08eb000, 0x1176592e000, 0xa, 0x0, 0x4e200, 0x0, 0x186a0000000000, 0x0, ...)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/core/autoscaler.go:65 +0x43
main.buildAutoscaler(0xc000313600, 0xc000d00000, 0x4496df, 0x7f9c7b60b4f0)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/main.go:337 +0x368
main.run(0xc00063e230)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/main.go:343 +0x39
main.main.func2(0x453b440, 0xc00029d380)
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/main.go:447 +0x2a
created by k8s.io/client-go/tools/leaderelection.(*LeaderElector).Run
	/gopath/src/k8s.io/autoscaler/cluster-autoscaler/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go:207 +0x113
```

Signed-off-by: Imran Pochi <imran@kinvolk.io>
@ipochi ipochi force-pushed the imran/cloud-provider-packet-fix branch 4 times, most recently from 97fd295 to 4b86c92 Compare August 19, 2021 15:24
@ipochi ipochi requested a review from detiber August 19, 2021 15:25
@ipochi
Copy link
Contributor Author

ipochi commented Aug 19, 2021

@invidian addressed your feedback.

@ipochi ipochi force-pushed the imran/cloud-provider-packet-fix branch from 4b86c92 to 8e6f109 Compare August 19, 2021 15:34
This commit adds another string prefix to consider `equinixmetal://`
along with the existing prefix `packet://`.

When K8s API is queried to get providerID from Node Spec, some machines
return `packet://<uuid>`, whereas some return `equinixmetal://`, this
creates error as the string is not trimmed properly and hence results in
a  404 when an untrimmed string is queried to Equinix Metal API for
device information.

Signed-off-by: Imran Pochi <imran@kinvolk.io>
Currently the label to identify controller/master node is hard coded to
`node-role.kubernetes.io/master`.

There have been some conversations centered around replacing the label
with `node-role.kubernetes.io/control-plane`.

In [Lokomotive](github.com/kinvolk/lokomotive), the label to identify
the controller/master node is `node.kubernetes.io/master`, the reasons
for this is mentioned in this [issue](kinvolk/lokomotive#227)

This commit makes the label configurable by setting an env variable in
the deployment `CONTROLLER_NODE_IDENTIFIER_LABEL`, if set then the value
in the env variable is used for identifying controller/master nodes, if
not set/passed, then the existing behaviour is followed choosing the
existing label.

Signed-off-by: Imran Pochi <imran@kinvolk.io>
Adds documentation regarding env variables introduced:

 - PACKET_CONTROLLER_NODE_IDENTIFIER_LABEL
 - INSTALLED_CCM

Signed-off-by: Imran Pochi <imran@kinvolk.io>
@detiber
Copy link
Member

detiber commented Aug 19, 2021

/lgtm
/approve

Since the autoscaler is versioned in lock step with kubernetes minor versions, we'll need to also backport this to the appropriate release branches as well.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: detiber, ipochi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2021
@k8s-ci-robot k8s-ci-robot merged commit fb8fdf8 into kubernetes:master Aug 19, 2021
// renamed from packet to equinixmetal.
prefix := packetPrefix

switch installedCCM := os.Getenv("INSTALLED_CCM"); installedCCM {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto PACKET_ prefix + env variable name could be a constant :)

@invidian
Copy link
Member

@ipochi can branch be removed now?

@ipochi
Copy link
Contributor Author

ipochi commented Aug 20, 2021

/lgtm
/approve

Since the autoscaler is versioned in lock step with kubernetes minor versions, we'll need to also backport this to the appropriate release branches as well.

@detiber

Can you please provide guidance on how to backport this to the release branches and till which autoscaler release ?

@ipochi ipochi deleted the imran/cloud-provider-packet-fix branch August 20, 2021 06:58
@detiber
Copy link
Member

detiber commented Aug 20, 2021

@detiber

Can you please provide guidance on how to backport this to the release branches and till which autoscaler release ?

You should be able to cherry-pick the commit and create a PR against the cluster-autoscaler-release-* branches that are appropriate.

I don't see a need to backport to anything that isn't currently supported, so I think 1.19, 1.20, 1.21, and 1.22 are probably the appropriate branches we'd want to backport to.

You might be able to leverage the "cherry-pick script" from the kubernetes release team: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md, but since I don't do it frequently, I generally just do it manually:

git checkout -b backport-1.22 upstream/cluster-autoscaler-release-1.22 # assuming the upstream k/autoscaler repo is configured as the remote 'upstream'
git cherry-pick <sha for commit 1> <sha for commit 2> ...

And repeating for the other branches.

#4260 is an example of a manual cherry-pick PR
#4269 is an example of an automated cherry-pick PR

ipochi pushed a commit to kinvolk/autoscaler that referenced this pull request Aug 23, 2021
ipochi pushed a commit to kinvolk/autoscaler that referenced this pull request Aug 27, 2021
ipochi pushed a commit to kinvolk/autoscaler that referenced this pull request Aug 27, 2021
ipochi pushed a commit to kinvolk/autoscaler that referenced this pull request Aug 27, 2021
ipochi pushed a commit to kinvolk/autoscaler that referenced this pull request Aug 27, 2021
@ipochi
Copy link
Contributor Author

ipochi commented Aug 27, 2021

@detiber
Created the necessary backporting PRs

k8s-ci-robot added a commit that referenced this pull request Sep 6, 2021
Backport Merge pull request #4274 to upstream/cluster-autoscaler-release-1.22
k8s-ci-robot added a commit that referenced this pull request Sep 6, 2021
Backport Merge pull request #4274 to upstream/cluster-autoscaler-release-1.21
k8s-ci-robot added a commit that referenced this pull request Sep 7, 2021
Backport Merge pull request #4274 to upstream/cluster-autoscaler-release-1.20
k8s-ci-robot added a commit that referenced this pull request Sep 7, 2021
Backport Merge pull request #4274 to upstream/cluster-autoscaler-release-1.19
himanshu-kun added a commit to gardener/autoscaler that referenced this pull request Jun 25, 2022
* Fix cluster-autoscaler clusterapi sample manifest

This commit fixes sample manifest of cluster-autoscaler clusterapi
provider.

(cherry picked from commit a5fee21)

* Adding functionality to cordon the node before destroying it. This helps load balancer to remove the node from healthy hosts (ALB does have this support).
This won't fix the issue of 502 completely as there is some time node has to live even after cordoning as to serve In-Flight request but load balancer can be configured to remove Cordon nodes from healthy host list.
This feature is enabled by cordon-node-before-terminating flag with default value as false to retain existing behavior.

* Set maxAsgNamesPerDescribe to the new maximum value

While this was previously effectively limited to 50, `DescribeAutoScalingGroups` now supports
fetching 100 ASG per calls on all regions, matching what's documented:
https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAutoScalingGroups.html
```
     AutoScalingGroupNames.member.N
       The names of the Auto Scaling groups.
       By default, you can only specify up to 50 names.
       You can optionally increase this limit using the MaxRecords parameter.
     MaxRecords
       The maximum number of items to return with this call.
       The default value is 50 and the maximum value is 100.
```

Doubling this halves API calls on large clusters, which should help to prevent throttling.

* Break out unmarshal from GenerateEC2InstanceTypes

Refactor to allow for optimisation

* Optimise GenerateEC2InstanceTypes unmarshal memory usage

The pricing json for us-east-1 is currently 129MB. Currently fetching
this into memory and parsing results in a large memory footprint on
startup, and can lead to the autoscaler being OOMKilled.

Change the ReadAll/Unmarshal logic to a stream decoder to significantly
reduce the memory use.

* use aws sdk to find region

* update readme

* Update cluster-autoscaler/cloudprovider/aws/README.md

Co-authored-by: Guy Templeton <guyjtempleton@googlemail.com>

* Merge pull request kubernetes#4274 from kinvolk/imran/cloud-provider-packet-fix

Cloud provider[Packet] fixes

* Fix bug where a node that becomes ready after 2 mins can be treated as unready. Deprecated LongNotStarted

 In cases where node n1 would:
 1) Be created at t=0min
 2) Ready condition is true at t=2.5min
 3) Not ready taint is removed at t=3min
 the ready node is counted as unready

 Tested cases after fix:
 1) Case described above
 2) Nodes not starting even after 15mins still
 treated as unready
 3) Nodes created long ago that suddenly become unready are
 counted as unready.

* Improve misleading log

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>

* dont proactively decrement azure cache for unregistered nodes

* Cluster Autoscaler: fix unit tests after kubernetes#3924 was backported to 1.20 in kubernetes#4319

The backport included unit tests using a function that changed signature
after 1.20. This was not detected before merging because CI is not
running correctly on 1.20.

* Cluster Autoscaler: backport Github Actions CI to 1.20 (kubernetes#4366)

* annotate fakeNodes so that cloudprovider implementations can identify them if needed

* move annotations to cloudprovider package

* fix 1.19 test

* remove flaky test that's removed in master

* Cluster Autoscaler 1.20.1

* Make arch-specific releases use separate images instead of tags on the same image

This seems to be the current convention in k8s.

* Cluster Autoscaler: add arch-specific build targets to .gitignore

* CA - AWS - Instance List Update 03-10-21 - 1.20 release branch

* CA - AWS - Instance List Update 29-10-21 - 1.20 release branch

* Cluster-Autoscaler update AWS EC2 instance types with g5, m6 and r6

* CA - AWS Instance List Update - 13/12/21 - 1.20

* Merge pull request kubernetes#4497 from marwanad/add-more-azure-instance-types

add more azure instance types

* Cluster Autoscaler 1.20.2

* Add `--feature-gates` flag to support scale up on volume limits (CSI migration enabled)

Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

* CA - AWS Cloud Provider - 1.20 Static Instance List Update 02-06-2022

* Cluster Autoscaler - 1.20.3 release

* sync_file updates & other changes

* Updating vendor against git@github.com:kubernetes/kubernetes.git:e3de62298a730415c5d2ab72607ef6adadd6304d (e3de622)

* fixed some declaration errors

Co-authored-by: Kubernetes Prow Robot <k8s-ci-robot@users.noreply.github.com>
Co-authored-by: Hidekazu Nakamura <hidekazuna@gmail.com>
Co-authored-by: atul <atul.aggarwal@cleartax.in>
Co-authored-by: Benjamin Pineau <benjamin.pineau@datadoghq.com>
Co-authored-by: Adrian Lai <aidy@loathe.me.uk>
Co-authored-by: darkpssngr <shreyas300691@gmail.com>
Co-authored-by: Guy Templeton <guyjtempleton@googlemail.com>
Co-authored-by: Vivek Bagade <vivek.bagade92@gmail.com>
Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
Co-authored-by: Marwan Ahmed <marwanad@microsoft.com>
Co-authored-by: Jakub Tużnik <jtuznik@google.com>
Co-authored-by: GuyTempleton <guy.templeton@skyscanner.net>
Co-authored-by: sturman <4456572+sturman@users.noreply.github.com>
Co-authored-by: Maciek Pytel <maciekpytel@google.com>
Co-authored-by: ialidzhikov <i.alidjikov@gmail.com>
himanshu-kun added a commit to gardener/autoscaler that referenced this pull request Jun 25, 2022
* Set maxAsgNamesPerDescribe to the new maximum value

While this was previously effectively limited to 50, `DescribeAutoScalingGroups` now supports
fetching 100 ASG per calls on all regions, matching what's documented:
https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAutoScalingGroups.html
```
     AutoScalingGroupNames.member.N
       The names of the Auto Scaling groups.
       By default, you can only specify up to 50 names.
       You can optionally increase this limit using the MaxRecords parameter.
     MaxRecords
       The maximum number of items to return with this call.
       The default value is 50 and the maximum value is 100.
```

Doubling this halves API calls on large clusters, which should help to prevent throttling.

* Break out unmarshal from GenerateEC2InstanceTypes

Refactor to allow for optimisation

* Optimise GenerateEC2InstanceTypes unmarshal memory usage

The pricing json for us-east-1 is currently 129MB. Currently fetching
this into memory and parsing results in a large memory footprint on
startup, and can lead to the autoscaler being OOMKilled.

Change the ReadAll/Unmarshal logic to a stream decoder to significantly
reduce the memory use.

* use aws sdk to find region

* Merge pull request kubernetes#4274 from kinvolk/imran/cloud-provider-packet-fix

Cloud provider[Packet] fixes

* Fix templated nodeinfo names collisions in BinpackingNodeEstimator

Both upscale's `getUpcomingNodeInfos` and the binpacking estimator now uses
the same shared DeepCopyTemplateNode function and inherits its naming
pattern, which is great as that fixes a long standing bug.

Due to that, `getUpcomingNodeInfos` will enrich the cluster snapshots with
generated nodeinfos and nodes having predictable names (using template name
+ an incremental ordinal starting at 0) for upcoming nodes.

Later, when it looks for fitting nodes for unschedulable pods (when upcoming
nodes don't satisfy those (FitsAnyNodeMatching failing due to nodes capacity,
or pods antiaffinity, ...), the binpacking estimator will also build virtual
nodes and place them in a snapshot fork to evaluate scheduler predicates.

Those temporary virtual nodes are built using the same pattern (template name
and an index ordinal also starting at 0) as the one previously used by
`getUpcomingNodeInfos`, which means it will generate the same nodeinfos/nodes
names for nodegroups having upcoming nodes.

But adding nodes by the same name in an existing cluster snapshot isn't
allowed, and the evaluation attempt will fail.

Practically this blocks re-upscales for nodegroups having upcoming nodes,
which can cause a significant delay.

* Improve misleading log

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>

* dont proactively decrement azure cache for unregistered nodes

* annotate fakeNodes so that cloudprovider implementations can identify them if needed

* move annotations to cloudprovider package

* Cluster Autoscaler 1.21.1

* CA - AWS - Instance List Update 03-10-21 - 1.21 release branch

* CA - AWS - Instance List Update 29-10-21 - 1.21 release branch

* Cluster-Autoscaler update AWS EC2 instance types with g5, m6 and r6

* CA - AWS Instance List Update - 13/12/21 - 1.21

* Merge pull request kubernetes#4497 from marwanad/add-more-azure-instance-types

add more azure instance types

* Cluster Autoscaler 1.21.2

* Add `--feature-gates` flag to support scale up on volume limits (CSI migration enabled)

Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

* [Cherry pick 1.21] Remove TestDeleteBlob UT

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>

* cherry-pick kubernetes#4022 [cluster-autoscaler] Publish node group min/max metrics

* Skipping metrics tests added in kubernetes#4022

Each test works in isolation, but they cause panic when the entire
suite is run (ex. make test-in-docker), because the underlying
metrics library panics when the same metric is registered twice.

(cherry picked from commit 52392b3)

* cherry-pick kubernetes#4162 and kubernetes#4172 [cluster-autoscaler]Add flag to control DaemonSet eviction on non-empty nodes & Allow DaemonSet pods to opt in/out
from eviction.

* CA - AWS Cloud Provider - 1.21 Static Instance List Update 02-06-2022

* fix instance type fallback

Instead of logging a fatal error, log a standard error and fall back to
loading instance types from the static list.

* Cluster Autoscaler - 1.21.3 release

* FAQ updated

* Sync_changes file updated

Co-authored-by: Benjamin Pineau <benjamin.pineau@datadoghq.com>
Co-authored-by: Adrian Lai <aidy@loathe.me.uk>
Co-authored-by: darkpssngr <shreyas300691@gmail.com>
Co-authored-by: Kubernetes Prow Robot <k8s-ci-robot@users.noreply.github.com>
Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
Co-authored-by: Marwan Ahmed <marwanad@microsoft.com>
Co-authored-by: Jakub Tużnik <jtuznik@google.com>
Co-authored-by: GuyTempleton <guy.templeton@skyscanner.net>
Co-authored-by: sturman <4456572+sturman@users.noreply.github.com>
Co-authored-by: Maciek Pytel <maciekpytel@google.com>
Co-authored-by: ialidzhikov <i.alidjikov@gmail.com>
Co-authored-by: Zhecheng Li <zhechengli@microsoft.com>
Co-authored-by: Shubham Kuchhal <shubham.kuchhal@india.nec.com>
Co-authored-by: Todd Neal <tnealt@amazon.com>
himanshu-kun added a commit to gardener/autoscaler that referenced this pull request Jun 25, 2022
* Set maxAsgNamesPerDescribe to the new maximum value

While this was previously effectively limited to 50, `DescribeAutoScalingGroups` now supports
fetching 100 ASG per calls on all regions, matching what's documented:
https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAutoScalingGroups.html
```
     AutoScalingGroupNames.member.N
       The names of the Auto Scaling groups.
       By default, you can only specify up to 50 names.
       You can optionally increase this limit using the MaxRecords parameter.
     MaxRecords
       The maximum number of items to return with this call.
       The default value is 50 and the maximum value is 100.
```

Doubling this halves API calls on large clusters, which should help to prevent throttling.

* Break out unmarshal from GenerateEC2InstanceTypes

Refactor to allow for optimisation

* Optimise GenerateEC2InstanceTypes unmarshal memory usage

The pricing json for us-east-1 is currently 129MB. Currently fetching
this into memory and parsing results in a large memory footprint on
startup, and can lead to the autoscaler being OOMKilled.

Change the ReadAll/Unmarshal logic to a stream decoder to significantly
reduce the memory use.

* Use highest available magnum microversion

Magnum allows using the microversion string "latest",
and it will replace it internally with the highest
microversion that it supports.

This will let the autoscaler use microversion 1.10 which
allows scaling groups to 0 nodes, if it is available.

The autoscaler will still be able to use microversion 1.9
on older versions of magnum.

* Merge pull request kubernetes#4274 from kinvolk/imran/cloud-provider-packet-fix

Cloud provider[Packet] fixes

* Improve misleading log

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>

* Cluster Autoscaler 1.22.1

* CA - AWS - Instance List Update 03-10-21 - 1.22 release branch

* CA - AWS - Instance List Update 29-10-21 - 1.22 release branch

* Cluster-Autoscaler update AWS EC2 instance types with g5, m6 and r6

* Merge pull request kubernetes#4497 from marwanad/add-more-azure-instance-types

add more azure instance types

* CA - AWS Instance List Update - 13/12/21 - 1.22

* Cluster Autoscaler 1.22.2

* Add `--feature-gates` flag to support scale up on volume limits (CSI migration enabled)

Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

* Fix Azure IMDS Url in InstanceMetadataService initialization

* Remove variables not used in azure_util_test

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>

* add recent AKS agentpool label to ignore for similarity checks

* ignore azure csi topology label for similarity checks and populate it for scale from zero

* fix autoscaling due to VMSS tag prefix issue

corrected the azure_kubernetes_ercice_pool_test unit test cases involving the changed tag prefix

added const aksManagedPoolName attribute to the top of the code and fixed file name sercice -> service

added logic for old clusters that still have poolName

added legacy tag for poolName

Fixed Autoscaling due to VMSS tag prefix issue, added tags for legacy poolName and aksManagedPoolName, and corrected file name sercice->service

* CA - AWS Cloud Provider - 1.22 Static Instance List Update 02-06-2022

* fix instance type fallback

Instead of logging a fatal error, log a standard error and fall back to
loading instance types from the static list.

* Cluster Autoscaler - 1.22.3 release

* Sync_changes file updated

Co-authored-by: Benjamin Pineau <benjamin.pineau@datadoghq.com>
Co-authored-by: Adrian Lai <aidy@loathe.me.uk>
Co-authored-by: Kubernetes Prow Robot <k8s-ci-robot@users.noreply.github.com>
Co-authored-by: Thomas Hartland <thomas.george.hartland@cern.ch>
Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
Co-authored-by: Jakub Tużnik <jtuznik@google.com>
Co-authored-by: GuyTempleton <guy.templeton@skyscanner.net>
Co-authored-by: sturman <4456572+sturman@users.noreply.github.com>
Co-authored-by: Maciek Pytel <maciekpytel@google.com>
Co-authored-by: ialidzhikov <i.alidjikov@gmail.com>
Co-authored-by: Christian Bianchi <whites11@gmail.com>
Co-authored-by: Zhecheng Li <zhechengli@microsoft.com>
Co-authored-by: Marwan Ahmed <marwanad@microsoft.com>
Co-authored-by: mirandacraghead <mcraghead@microsoft.com>
Co-authored-by: Todd Neal <tnealt@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants