-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Add support for external metrics in kubectl #60424
Conversation
if metric.External.TargetAverageValue != nil { | ||
current := "<unknown>" | ||
if len(hpa.Status.CurrentMetrics) > i && hpa.Status.CurrentMetrics[i].External != nil { | ||
current = hpa.Status.CurrentMetrics[i].External.CurrentAverageValue.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a check for CurrentAverageValue nil here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if spec.External.TargetAverageValue != nil { | ||
current := "<unknown>" | ||
if len(statuses) > i && statuses[i].External != nil { | ||
current = statuses[i].External.CurrentAverageValue.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, check for nil CurrentAverageValue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments inline
if len(hpa.Status.CurrentMetrics) > i && hpa.Status.CurrentMetrics[i].External != nil { | ||
current = hpa.Status.CurrentMetrics[i].External.CurrentValue.String() | ||
} | ||
w.Write(LEVEL_1, "%q:\t%s / %s\n", metric.External.MetricName, current, metric.External.TargetValue.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to somehow differentiate between "value" and "average value"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added details in brackets after metric name (following example from resource utilization).
if len(statuses) > i && statuses[i].External != nil { | ||
current = statuses[i].External.CurrentValue.String() | ||
} | ||
list = append(list, fmt.Sprintf("%s/%s", current, spec.External.TargetValue.String())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to differentiate between "value" and "average value"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "(avg)" to the average value. I don't think there is room for much more (don't want to stretch the presentation too much)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack, that's what I was looking for
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bskiba, DirectXMan12, janetkuo 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 |
/retest |
Automatic merge from submit-queue (batch tested with PRs 59310, 60424, 60308, 60436, 60020). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Add support for metrics coming from external sources when describing or printing horizontal pod autoscaler objects. API change: #60096
@MaciekPytel @DirectXMan12
Release note: