-
Notifications
You must be signed in to change notification settings - Fork 23
[kn-admin]Add support to enable or disable scale-to-zero #26
Conversation
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.
Looks good for me, but in order to provide a smooth UX we should stick to the convention to use --no-autoscale-to-zero
and --scale-to-zero
for the true/false values.
There is some specific handling for this in the client, and I wonder whether we should move our 'special' handling of option into a reusable library (like also how to deal with maps + arrays)
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.
- missing
unset
- missing unit tests
- missing integration tests
Thanks for your code review! @rhuss Thanks for point it out. I'll refine this PR to follow the same UX with cli to use @maximilien Same with above will refine it^^ for |
e4575da
to
88500a5
Compare
All comments addressed, it's ready for review, thanks! |
k8s.io/api v0.17.4 | ||
k8s.io/apimachinery v0.17.4 | ||
k8s.io/client-go v0.17.4 | ||
knative.dev/client v0.14.0 |
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.
why do you need a dependency on knative.dev/client
?
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.
@rhuss
I noticed there's a method in knative.dev/client to create flags like --scale-to-zero and --no-scale-to-zero, so reused it.
flags.AddBothBoolFlagsUnhidden
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 think this is ok for now but for the long run we should extract the parts that can be reused by plugins within the client into at least a dedicated package. Because the client coders will not be aware that this method is used by anybody outside the client itself, so its very likely that this can be changed by a refactoring or by accident.
Hi @rhuss @maximilien, All comments addressed, would you please help to review again, 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.
/lgtm
will wait for #14 to add more UT and e2e test |
- Init autoscaling subcommand - Support scale-to-zero config - Update examples in README
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
|
||
import ( | ||
"errors" | ||
"fmt" |
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.
Format Go code:
"fmt" | |
"fmt" | |
|
||
}) | ||
} | ||
|
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.
Format Go code:
As @rhuss have approved it and I filled up UT just now, @rhuss @maximilien would you please help to take a review, thanks! |
@zhanggbj: you cannot LGTM your own PR. 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. |
Hi @rhuss @maximilien , Would you please help to take a review, the last update is to fill up UT, thank you! |
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.
looks good for me now, let's get it merged.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhuss, zhanggbj 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 |
User Story: As a Knative administrator, I want to enable and disable scale to zero for Knative platform.
It might be desirable for Knative admins to enable or disable scale-to-zero for a specific Knative installation frequently, which is also discussed in #18. The kn-admin plugin will enable/disable this feature via the CLI instead of modifying ConfigMap. We can use this PR for further discussion on it. Thanks!
Note: please merge PR #25 first and then I'll rebase this one on it.
PR: