-
Notifications
You must be signed in to change notification settings - Fork 263
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
feat(service create/update): Add support of minScale/maxScale/target #157
Conversation
Hi @rhuss. 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. |
/ok-to-test |
/assign sixolet |
@rhuss: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/ok-to-test |
Integration test should be fixed if #155 is merged and this PR rebased on top of it |
docs/cmd/kn_service_create.md
Outdated
-n, --namespace string List the requested object(s) in given namespace. | ||
--requests-cpu string The requested CPU (e.g., 250m). | ||
--requests-memory string The requested CPU (e.g., 64Mi). | ||
--target int Number of in-flight requests per pod. |
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.
The issues talks about containerConcurrency, so I think this should be named something like that. The "target" config option is different - we can add a flag for that too if people want it, but my original request is for CC.
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.
tbh, I think we can add all autoscaling processing annotations in one go. But I'm fine of course to remove target
if we agree that this is not something we want to expose via the CLI (althouhg I believe every part of the public Knative API which is put into annotation should be available as CLI option as this is hard to find out elsewhere as it is not part of the CRD schema and nobody memorizes the full name of annotation keys)
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 +1 for exposing all of them too - I just didn't want this PR to go thru w/o addressing what the issue was asking for :-)
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.
got you, valid point.
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.
The word target
(unless I am missing something or has historical meaning) is vague and not meaningful in this context? Why can't this be no-in-flights
or similar?
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.
were you going to add that flag?
These concurrency flags are added to kn service create
and kn service update
. There is the general problem that for changing these annotations on update, this will trigger a new revision, and don't touch the old revision. This means if you have used minScale
then this revision will always spin up that many pods even when its not the latest revision anymore (revisions are immutable). The only thing to get this back to 0 is to fiddle around with the autoscaler CRD. There is some discussions over there to make metadata like annotations mutable on revision instances, but as long as this doesn't happen we have to deal with that (i.e. don't modify the annotation on the running Revision but on the Service/Configuration's Revision template). See knative/serving#3547 (comment) for the discussion over there in serving.
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.
For the naming:
I like --min-scale
and --max-scale
as it's concise and pretty clear what it means. Alternatively we could call it --min-replicas
& --max-replicas
to reflect the Deployment fields affected (or even --min-pods
and --max-pods
). However this suggestion again connects to K8s which we shouldn't do ("replicas" and even more "pods" is a concept occupied by K8s). So I'm fine with --min-scale
& --max-scale
.
Another option would be --scale-max
and --scale-min
which would put the options nicely together, e.g. in an alphabetically ordered help options list or documentation. This is important when your option list gets long (ever tried jx create cluster minikube --help
;-P), and I think for create and update it will still grow.
For --target
I agree that it is to unspecific as an option name.
My suggestions would be (with preference in that order):
--scale-target 10
(would fit to a--scale-min
and--scale-max
(but could be misread that it's a target to reach 10, but afaiu its just the number of concurrent requests after that a scale up event happen)--scale-after-requests 10
(which reads nicely like inscale after 10 request
)--scale-after 10
--concurrency-target 10
--scale-in-flight 10
(not sure whether this clear enough)--scale-after-concurrent-requests 10
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.
For clarity, containerConcurrency
and the target
annotation are two different things. The first is an enforced limit, the second is a "soft" target for the autoscaler. In the absence of the second, the second is inferred from the first.
In that sense I'd opt for:
--concurrency-limit
to define the former--concurrency-target
to define the latter. We should encodeconcurrency
into here as for the KPA the default will beconcurrency
. If we also want to expose the HPA as an autoscaler, things will get more tricky here though.
I think that nicely encodes the difference in the name. The CLI docs could say that --concurrency-target
defaults to --concurrency-limit
if not passed.
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.
Ah, I see. There can be different types of autoscaling triggers, which currently is based on concurrent requests (but could be e.g. CPU consumption when using the HPA). But maxScale and minScale are more a global scaling (boundary) option which applies regardless of the type of scaling.
So my suggestion now would be:
--max-scale
and--min-scale
(as in this PR)--concurrency-target
(renaming the option)--concurrency-limit
(adding to this PR, by setting the proper field in the spec)
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.
@markusthoemmes Just saw that containerConcurrency
is part of PodAutoscaler
which is not part of the public API. So is it correct, that this datum can't be changed from a client like kn
? Or is there a corresponding field on Service
which the get put into the PodAutoscaler
resource when a service is created ?
For now, I think for now we have to ommit --concurrency-limit
031eec8
to
27d167d
Compare
@cppforlife @sixolet From my POV we are good for review and eventually merge with this PR.
The introduction of |
containerConcurrency is part of a KnService so kn should expose the option
…Sent from my iPad
On Jun 6, 2019, at 5:05 AM, Roland Huß ***@***.***> wrote:
@rhuss commented on this pull request.
In docs/cmd/kn_service_create.md:
> -n, --namespace string List the requested object(s) in given namespace.
--requests-cpu string The requested CPU (e.g., 250m).
--requests-memory string The requested CPU (e.g., 64Mi).
+ --target int Number of in-flight requests per pod.
@markusthoemmes Just saw that containerConcurrency is part of PodAutoscaler which is not part of the public API. So is it correct, that this datum can't be changed from a client like kn ? Or is there a corresponding field on Service which the get put into the PodAutoscaler resource when a service is created ?
For now, I think for now we have to ommit --concurrency-limit
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@duglin Ah, I see. It's on the RevisionSpec, not ServiceSpec. Thanks for the heads up. So I will add |
Thanks!! |
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.
Mostly good. A little bit I'd like to see moved to a separate PR.
@@ -36,8 +37,9 @@ func NewServiceUpdateCommand(p *commands.KnParams) *cobra.Command { | |||
kn service update mysvc --requests-cpu 500m --limits-memory 1024Mi`, | |||
RunE: func(cmd *cobra.Command, args []string) (err error) { | |||
if len(args) != 1 { | |||
return errors.New("requires the service name.") | |||
return errors.New("'kn update' requires the service name") |
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.
This isn't an accurate rendition of the actual command, and these changes seem unrelated to what you're doing in the rest of the PR. Can you make a separate PR?
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.
fair point, will do
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.
cleaned up and rebased
…ency-target/concurrency-limit Autoscaler concurrency annotations are added to the revision template if --min-scale / --max-scale / --concurrency-target/--concurrency-limit are provided to `kn service create` and `kn service update` Fixes knative#151
The following is the coverage report on pkg/.
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhuss, sixolet 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 |
- Test PR for knative#157 /hold
Runs cross platform build to ensure all the checks pass
Bonuses: * better handling of missing bazel test artifacts (internal error) * clearly separate summary and detailed logs on failures
Autoscaler annotations are added to the revision template if
--min-scale / --max-scale / --target are provided to
kn service create
orkn service update
Fixes #151
This PR builds on top of #156 but can be back-ported on master if desired.For review I recommend to look at commit efb23b7 first, which contains the delta.
The PR is now based on upstream master only.