Limit HPA emergency mode to repeated failures#453
Draft
djahandarie wants to merge 1 commit intomercari:mainfrom
Draft
Limit HPA emergency mode to repeated failures#453djahandarie wants to merge 1 commit intomercari:mainfrom
djahandarie wants to merge 1 commit intomercari:mainfrom
Conversation
djahandarie
commented
Jul 2, 2025
| } | ||
|
|
||
| if err := c.c.List(ctx, &evList, opts); err != nil { | ||
| logger.Info("Failed to get events for HPA to check for FailedGetResourceMetric, switch to emergency mode", "hpa", currenthpa.Name) |
Contributor
Author
There was a problem hiding this comment.
This discards the err object, should probably log it
Contributor
Author
There was a problem hiding this comment.
Also maybe this should be Warn or Err instead of Info
djahandarie
commented
Jul 2, 2025
| } | ||
|
|
||
| // count number of FailedGetResourceMetric events that occured in the last 5 minutes | ||
| fiveMinutesAgo := time.Now().Add(-5 * time.Minute) |
Contributor
Author
There was a problem hiding this comment.
Should probably at least move this into a constant
djahandarie
commented
Jul 2, 2025
| } | ||
| } | ||
|
|
||
| if count > 5 { |
djahandarie
commented
Jul 3, 2025
| } | ||
|
|
||
| if count > 5 { | ||
| logger.Info("HPA failed to get resource metrics over 5 times in the last 5 minutes, switch to emergency mode", "hpa", currenthpa.Name, "failCount", count) |
Contributor
Author
There was a problem hiding this comment.
Maybe this can be a Warn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance the Horizontal Pod Autoscaler (HPA) logic to switch to emergency mode only after multiple failures to retrieve resource metrics within a specified timeframe. This change prevents unnecessary transitions to emergency mode due to transient issues.