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

allow users to avoid aws instance not found spam #6265

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

grosser
Copy link
Contributor

@grosser grosser commented Nov 9, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

allows users to mark nodes for "do not spam me about missing aws instance"

Which issue(s) this PR fixes:

fixes #6096

Special notes for your reviewer:

not ready to be merged, just for discussion

Does this PR introduce a user-facing change?

TODO

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 9, 2023
@k8s-ci-robot k8s-ci-robot requested a review from drmorr0 November 9, 2023 18:29
@k8s-ci-robot k8s-ci-robot added the area/provider/aws Issues or PRs related to aws provider label Nov 9, 2023
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 9, 2023
// nodes that belong to an asg that is not autoscaled will not be found in the asgCache below
// do not spam warnings about them being unable to be found
// users that see this error can add an annotation to their nodes to avoid it
if node.Annotations != nil && node.Annotations["k8s.io/cluster-autoscaler/enabled"] == "false" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test confirming this works correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I can add tests if anyone with merge permission can confirm this is a good approach

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems fine to me, yes.

Rather: imo the ideal approach would be to just have that error be logged at a lower verbosity, but I think that's going to be non-trivial to accomplish given how the code is currently organized, so this seems fine as an alternate solution.

@grosser grosser marked this pull request as ready for review November 18, 2023 18:04
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 18, 2023
@k8s-ci-robot k8s-ci-robot requested a review from drmorr0 November 18, 2023 18:05
@grosser
Copy link
Contributor Author

grosser commented Nov 18, 2023

improved comment, added test

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 18, 2023
@drmorr0
Copy link
Contributor

drmorr0 commented Nov 20, 2023

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: drmorr0, grosser

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 Nov 20, 2023
@k8s-ci-robot k8s-ci-robot merged commit 81eed96 into kubernetes:master Nov 20, 2023
6 checks passed
@brydoncheyney
Copy link
Contributor

k8s.io/cluster-autoscaler/enabled is not a valid annotation key - https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set - which expects only a single DNS prefix.

Attempting to manually add this annotation to an existing node will fail -

# nodes "ip-XXX-XXX-XXX-XXX.ec2.internal" was not valid:
# * metadata.annotations: Invalid value: "k8s.io/cluster-autoscaler/enabled": a qualified name must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')

Note that the use of the k8s.io/cluster-autoscaler/enabled tag is valid within AWS.

This could be fixed by using an alternative key format, such as k8s.io/cluster-autoscaler-enabled

I'll pull a PR together for this.

@grosser
Copy link
Contributor Author

grosser commented Nov 20, 2023 via email

@scottblack1
Copy link

Curious why we have used node.annotation here instead of a label for example?

As far as I can see there is no easy way to automatically annotate nodes in EKS as this is not an available argument in the eks_bootstrap.sh.

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 area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Failed to check cloud provider" flooding logs
5 participants