-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Custom Metrics HPA Autoscaler #12277
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
Conversation
Hi @enoodle. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Codecov Report
@@ Coverage Diff @@
## main #12277 +/- ##
==========================================
- Coverage 87.55% 87.53% -0.02%
==========================================
Files 195 195
Lines 9600 9617 +17
==========================================
+ Hits 8405 8418 +13
- Misses 915 918 +3
- Partials 280 281 +1
Continue to review full report at Codecov.
|
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.
I like the idea in general, but haven't fully reviewed. I think we should break the API change out first.
@@ -22,7 +22,7 @@ import ( | |||
networkingclient "knative.dev/networking/pkg/client/injection/client" | |||
sksinformer "knative.dev/networking/pkg/client/injection/informers/networking/v1alpha1/serverlessservice" | |||
kubeclient "knative.dev/pkg/client/injection/kube/client" | |||
hpainformer "knative.dev/pkg/client/injection/kube/informers/autoscaling/v2beta1/horizontalpodautoscaler" | |||
hpainformer "knative.dev/pkg/client/injection/kube/informers/autoscaling/v2beta2/horizontalpodautoscaler" |
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.
WDYT about making the API change to v2beta2 separate PR wise? It seems like that'd be a good change in isolation to the rest in this PR even. Would make the actual changes a lot smaller too.
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.
OK, I will do that.
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.
/ok-to-test |
b9a1dff
to
40bcd5e
Compare
/hold Until #12278 merges, which this'll rebase on I guess |
Type: autoscalingv2beta1.PodsMetricSourceType, | ||
Pods: &autoscalingv2beta1.PodsMetricSource{ | ||
MetricName: pa.Metric(), | ||
TargetAverageValue: *targetQuantity, |
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.
is the assumption that we only want this to be TargetAverageValue
? would we ever want TargetValue
or TargetAverageUtilization
?
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.
Sort of, yes. This seems like the most simple option out of the three. I wanted a simple change without adding new annotations. If we add an annotation we can allow the user to choose between them.
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.
I'm not sure how it would clear for users that its only using the TargetAverage, can we at least document it somehow
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.
Yes, that is right. I will add it here : https://github.com/knative/docs/blob/main/docs/serving/autoscaling/autoscaling-metrics.md
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.
40bcd5e
to
025b9b1
Compare
@@ -225,8 +225,7 @@ func validateMetric(annotations map[string]string) *apis.FieldError { | |||
return nil | |||
} | |||
case HPA: | |||
switch metric { | |||
case CPU, Memory: | |||
if metric != "" { |
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.
I don't think this is very important (and pretty subjective, so please feel free to disregard this comment), but stylistically, using a switch
here looks a little nicer to me (as it mirrors the KPA case above), i.e.
case HPA:
switch metric {
case "":
break
default:
return nil
}
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.
I understand, I will make that change.
I believe the hold can be removed now that #12278 is merged |
Yes, I have rebased this PR since #12278 was merged. |
/hold cancel |
/lgtm |
168852e
to
27b469d
Compare
rebased on changes to hpa test. |
/retest |
@markusthoemmes I think this is ready to merge, would you mind taking a look |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enoodle, markusthoemmes 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 |
Fixes #3134
This is based on #4112 , but tries to have a simpler solution with no added annotations, by assuming that any metric name other than
cpu
ormemory
is a custom metric name.Proposed Changes
cpu
ormemory
then it will be used as a custom metric on the pods with the target value used as averageUtilization value.Release Note