Skip to content
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 --quiet to hide the 'waiting for pods to be running' message in kubectl run #28801

Merged
merged 1 commit into from
Jul 12, 2016

Conversation

janetkuo
Copy link
Member

Ref #28695

@kubernetes/kubectl

Analytics

@janetkuo janetkuo added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 11, 2016
@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")
cmd.Flags().Bool("silent", false, "If true, hide the 'waiting for pod to be running' message")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making this a top-level flag? It's a common use case to run a command and ignore output.

Copy link
Member Author

@janetkuo janetkuo Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean we make it a global flag?

What'd other messages to be hidden? Something like when kubectl delete pod/foo --silent we don't print pod "foo" deleted but only print error messages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What'd other messages to be hidden? Something like when kubectl delete pod/foo --silent we don't print pod "foo" deleted but only print error messages?

Yep, only print error messages. When passing --silent you would rely on the return code to determine whether command succeeded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should get this in one place first and then come back later and
make it global. I'd like us to refactor the PrinterCommand stuff because
it's not aligned with how we do option structs (ideally we'd create an
option struct that we invoke bind on for the default printer options, and
hide retrieving the printer logic from commands).

On Mon, Jul 11, 2016 at 6:35 PM, Jeff Lowdermilk notifications@github.com
wrote:

In pkg/kubectl/cmd/run.go
#28801 (comment)
:

@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")

  • cmd.Flags().Bool("silent", false, "If true, hide the 'waiting for pod to be running' message")

What'd other messages to be hidden? Something like when kubectl delete
pod/foo --silent we don't print pod "foo" deleted but only print error
messages?

Yep, only print error messages. When passing --silent you would rely on
the return code to determine whether command succeeded.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/28801/files/deb67df071895d8eb9e41a1ac8c3d46c7fcef768#r70349834,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_px5dVODgN287dOhxlfU8Z9Ey7BUoks5qUsUwgaJpZM4JJz6B
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help text says this hides the waiting for pods running output. Is there other output from the command? It would be more intuitive if --silent hid all output except errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this normally "quiet"? I'm trying to search man on my system for a
rough count of either, but it's taking too long.

On Mon, Jul 11, 2016 at 6:43 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Maybe we should get this in one place first and then come back later and
make it global. I'd like us to refactor the PrinterCommand stuff because
it's not aligned with how we do option structs (ideally we'd create an
option struct that we invoke bind on for the default printer options, and
hide retrieving the printer logic from commands).

On Mon, Jul 11, 2016 at 6:35 PM, Jeff Lowdermilk <notifications@github.com

wrote:

In pkg/kubectl/cmd/run.go
#28801 (comment)
:

@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")

  • cmd.Flags().Bool("silent", false, "If true, hide the 'waiting for pod to be running' message")

What'd other messages to be hidden? Something like when kubectl delete
pod/foo --silent we don't print pod "foo" deleted but only print error
messages?

Yep, only print error messages. When passing --silent you would rely on
the return code to determine whether command succeeded.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/28801/files/deb67df071895d8eb9e41a1ac8c3d46c7fcef768#r70349834,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_px5dVODgN287dOhxlfU8Z9Ey7BUoks5qUsUwgaJpZM4JJz6B
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would worry that "--silent" here might be interpreted to mean "show no
log output, only return an exit code if you can get the pod"

On Mon, Jul 11, 2016 at 6:49 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Isn't this normally "quiet"? I'm trying to search man on my system for a
rough count of either, but it's taking too long.

On Mon, Jul 11, 2016 at 6:43 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Maybe we should get this in one place first and then come back later and
make it global. I'd like us to refactor the PrinterCommand stuff because
it's not aligned with how we do option structs (ideally we'd create an
option struct that we invoke bind on for the default printer options, and
hide retrieving the printer logic from commands).

On Mon, Jul 11, 2016 at 6:35 PM, Jeff Lowdermilk <
notifications@github.com> wrote:

In pkg/kubectl/cmd/run.go
#28801 (comment)
:

@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")

  • cmd.Flags().Bool("silent", false, "If true, hide the 'waiting for pod to be running' message")

What'd other messages to be hidden? Something like when kubectl delete
pod/foo --silent we don't print pod "foo" deleted but only print error
messages?

Yep, only print error messages. When passing --silent you would rely on
the return code to determine whether command succeeded.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/28801/files/deb67df071895d8eb9e41a1ac8c3d46c7fcef768#r70349834,
or mute the thread
https://github.com/notifications/unsubscribe/ABG_px5dVODgN287dOhxlfU8Z9Ey7BUoks5qUsUwgaJpZM4JJz6B
.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton Agreed. Since it'd still generate some "sound", --quiet would make more sense.

@k8s-github-robot k8s-github-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 11, 2016
@janetkuo janetkuo force-pushed the kubectl-run-silent branch from deb67df to 7012fa4 Compare July 12, 2016 00:02
@janetkuo janetkuo changed the title Add --silent to hide the 'waiting for pods to be running' message in kubectl run Add --quiet to hide the 'waiting for pods to be running' message in kubectl run Jul 12, 2016
@janetkuo
Copy link
Member Author

PTAL

@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")
cmd.Flags().Bool("quiet", false, "If true, hide the 'waiting for pod to be running' message")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future proofing, maybe say "only print output from the running pods" or similar?

@janetkuo janetkuo force-pushed the kubectl-run-silent branch from 7012fa4 to 268b93e Compare July 12, 2016 18:57
@@ -117,9 +117,11 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Bool("expose", false, "If true, a public, external service is created for the container(s) which are run")
cmd.Flags().String("service-generator", "service/v2", "The name of the generator to use for creating a service. Only used if --expose is true")
cmd.Flags().String("service-overrides", "", "An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.")
cmd.Flags().Bool("quiet", false, "If true, suppress prompt messages.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the usage of --quiet to If true, suppress prompt messages.

@k8s-bot
Copy link

k8s-bot commented Jul 12, 2016

GCE e2e build/test passed for commit 268b93e.

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 12, 2016

GCE e2e build/test passed for commit 268b93e.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 0efd038 into kubernetes:master Jul 12, 2016
k8s-github-robot pushed a commit that referenced this pull request Sep 14, 2016
Automatic merge from submit-queue

Add test for --quiet flag for kubectl run

This adds a test for the changes introduced in #30247 and #28801.

Ref #28695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants