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

[cluster-autoscaler] Publish node group min/max metrics #4022

Merged

Conversation

amrmahdi
Copy link
Contributor

This change publishes the node groups min and max count set on the cluster autoscaler. The current use case that these metrics are needed for is to create alerts when the number of nodes in the cluster reach a certain percentage of the max allowed nodes for example.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @amrmahdi!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 21, 2021
Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

although i like these kind of metrics, i think there will be issues with the cardinality around the node group IDs.

cluster-autoscaler/metrics/metrics.go Show resolved Hide resolved
Copy link

@dntosas dntosas left a comment

Choose a reason for hiding this comment

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

very nice addition, one minor comment 👍

cluster-autoscaler/core/autoscaler.go Outdated Show resolved Hide resolved
@feiskyer
Copy link
Member

+1 as well to add those metrics. could you fix the CI failures?

@amrmahdi amrmahdi force-pushed the amrh/nodegroupminmaxmetrics branch 2 times, most recently from 51f0613 to 0e97a40 Compare April 24, 2021 19:34
@amrmahdi
Copy link
Contributor Author

/test

@k8s-ci-robot
Copy link
Contributor

@amrmahdi: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@amrmahdi amrmahdi closed this Apr 25, 2021
@amrmahdi amrmahdi reopened this Apr 25, 2021
@feiskyer
Copy link
Member

/test

@k8s-ci-robot
Copy link
Contributor

@feiskyer: No presubmit jobs available for kubernetes/autoscaler@master

In response to this:

/test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@feiskyer
Copy link
Member

@mwielgus @MaciekPytel any ideas the tests didn't run now for this PR?

@elmiko
Copy link
Contributor

elmiko commented Apr 26, 2021

+1 as well to add those metrics.

i'm curious if we could get some consensus around using node group IDs in the metrics. i think there are other metrics that could benefit from using these identifiers, but i have been warned against using them in the past.

i think if we are going to agree that node group IDs are acceptable to use as metrics labels, then we should also establish guidance as to when it is appropriate. for example, this PR proposes a metric that will only get updated once (although this misses the notion of node groups being adjusted after initialization), is this usage of node group IDs acceptable? if this usage is acceptable, when is it unacceptable to use them?

@amrmahdi amrmahdi force-pushed the amrh/nodegroupminmaxmetrics branch 2 times, most recently from 51b4dc9 to 42ce8b7 Compare April 30, 2021 19:38
@amrmahdi
Copy link
Contributor Author

@mwielgus @MaciekPytel any ideas the tests didn't run now for this PR?

Can we get help on the CI? It seems it is waiting for a maintainer.

image

@feiskyer
Copy link
Member

feiskyer commented May 6, 2021

@mwielgus @MaciekPytel could you help to approve the github actions? The new changes from github actions make it required of approval first from maintainers (this is also true for other PRs).

@amrmahdi
Copy link
Contributor Author

amrmahdi commented May 6, 2021

/assign @vivekbagade

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2021
@amrmahdi amrmahdi force-pushed the amrh/nodegroupminmaxmetrics branch from 42ce8b7 to 2b4f971 Compare May 17, 2021 19:22
@amrmahdi amrmahdi force-pushed the amrh/nodegroupminmaxmetrics branch from 2b4f971 to 2bd7f0e Compare May 17, 2021 19:27
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 17, 2021
@amrmahdi amrmahdi force-pushed the amrh/nodegroupminmaxmetrics branch from f2b343b to 3ac32b8 Compare May 21, 2021 00:36
@amrmahdi amrmahdi requested review from towca and MaciekPytel May 21, 2021 00:37
Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

i like the addition of the flag, i'm happy with this solution.
/lgtm

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

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

actually, i just thought about something. @amrmahdi would you mind adding something to the FAQ to mention the new flag please?

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 21, 2021
@amrmahdi
Copy link
Contributor Author

i just thought about something. @amrmahdi would you mind adding som

Yes I missed that. Thanks

@MaciekPytel
Copy link
Contributor

Left one more comment, otherwise lgtm.

@amrmahdi amrmahdi requested a review from elmiko May 21, 2021 15:33
Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

thanks for the update
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amrmahdi, elmiko, feiskyer

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

@amrmahdi
Copy link
Contributor Author

I approved the github workflows. I'll defer to @mwielgus on cardinality.

@towca Any more concerns?

@amrmahdi
Copy link
Contributor Author

I approved the github workflows. I'll defer to @mwielgus on cardinality.

@towca Any more concerns?

@towca @mwielgus can we close on this PR? Thanks

@towca
Copy link
Collaborator

towca commented Jul 5, 2021

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 5, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9f84d39 into kubernetes:master Jul 5, 2021
MaciekPytel added a commit to MaciekPytel/autoscaler that referenced this pull request Jul 8, 2021
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.
k8s-ci-robot added a commit that referenced this pull request Jul 8, 2021
Skipping metrics tests added in #4022
piotrnosek pushed a commit to piotrnosek/autoscaler that referenced this pull request Nov 30, 2021
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.
k8s-ci-robot added a commit that referenced this pull request Apr 25, 2022
…e-1.21-nodegroup-minmax

[cluster-autoscaler] backport #4022 Publish node group min/max metrics into 1.21
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>
tim-smart pushed a commit to arisechurch/autoscaler that referenced this pull request Nov 22, 2022
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.
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. area/cluster-autoscaler 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.

9 participants