-
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
Add --service-account-name flag #401
Conversation
Hi @igsong. 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 |
@@ -107,7 +108,8 @@ func (p *ConfigurationEditFlags) addSharedFlags(command *cobra.Command) { | |||
"keep the running image for the service constant when not explicitly specifying "+ | |||
"the image. (--no-lock-to-digest pulls the image tag afresh with each new revision)") | |||
// Don't mark as changing the revision. | |||
|
|||
command.Flags().StringVar(&p.ServiceAccountName, "service-account-name", "-", "Service account name. To unset, specify \"-\".") |
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.
any particular reason we are using default as -
instead of 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've changed the default value to an empty 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.
thanks!
Addition of new flag should be highlighted in release notes, can you please append a line in https://github.com/knative/client/blob/master/CHANGELOG.adoc ? |
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.
We also need an e2e integration test for this feature.
docs/cmd/kn_service_create.md
Outdated
--requests-cpu string The requested CPU (e.g., 250m). | ||
--requests-memory string The requested memory (e.g., 64Mi). | ||
--revision-name string The revision name to set. Must start with the service name and a dash as a prefix. Empty revision name will result in the server generating a name for the revision. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}") | ||
--service-account-name string Service account name. To unset, specify "-". (default "-") |
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.
Let’s make clearer with “To unset specify “-“ as the value”
Also would this be clearer with “” instead of “-“?
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 agree. I will make the change.
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.
How can you unset something when you create a service ? Isn't it just good enough to leave out the option if you don't want to create a service account being set ?
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've changed the description of the flag with the change of the name of the flag.
pkg/serving/config_changes.go
Outdated
// UpdateServiceAccountName updates the service account name used for the corresponding knative service | ||
func UpdateServiceAccountName(template *servingv1alpha1.RevisionTemplateSpec, serviceAccountName string) error { | ||
serviceAccountName = strings.TrimSpace(serviceAccountName) | ||
if serviceAccountName == "-" { |
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.
Related to my comment above in description. Empty string for unsettling would make this read better
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've changed the default value to an empty string.
docs/cmd/kn_service_update.md
Outdated
--requests-cpu string The requested CPU (e.g., 250m). | ||
--requests-memory string The requested memory (e.g., 64Mi). | ||
--revision-name string The revision name to set. Must start with the service name and a dash as a prefix. Empty revision name will result in the server generating a name for the revision. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}") | ||
--service-account-name string Service account name. To unset, specify "-". (default "-") |
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.
Does this mean, that when you use kn service update
without this option, that the service account will be always removed because the default is -
? I would expect that there is no default and service account name is left untouched when this option is not given.
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 kn service update
I would prefer:
--service-account new-name
: Update the service account with the new name--service-account
: Clear the service account- Option not given : Don't touch service account
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've made a change according to your comments. Please check it out and, if there are additional comments, please let me know.
…ge its default value from "-" to an empty string. In addition, CHANGELOG.adoc is changed.
The following is the coverage report on pkg/.
|
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 to me. Keeping it open if there is any additional feedback.
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: igsong, navidshaikh 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 |
We'll need |
@@ -58,6 +58,7 @@ kn service create NAME --image IMAGE [flags] | |||
--requests-cpu string The requested CPU (e.g., 250m). | |||
--requests-memory string The requested memory (e.g., 64Mi). | |||
--revision-name string The revision name to set. Must start with the service name and a dash as a prefix. Empty revision name will result in the server generating a name for the revision. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}") | |||
--service-account string Service account name to set. Empty service account name will result to clear the service account. |
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 know, it's a bit nit-picky, but using a --service-account
without arg during a kn service create
is a no-op and it won't clear the service account (as there is one). I know that this option is shared, but maybe we can use still different help messages for create & update ?
happy to get this PR merged now, but maybe we can adjust this in a later PR.
/test pull-knative-client-integration-tests-latest-release |
/retest |
This changeset introduces the coveragecalculator package to the webhook based API Coverage tool. This package contains wire-contract that the webhook server would expose to any client using the tool to get API coverage data. README.md file has more information. The change also introuces the concept of rules to provide a mechanism to control resource tree traversal.
Proposed Changes
--service-account-name
to set serviceAccountName property of ksvcRelease Note