-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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 dry-run flag to auth reconcile #64458
Add dry-run flag to auth reconcile #64458
Conversation
/assign @deads2k See if you agree with the flag names. @mrogers950 probably need to update completions. |
pkg/kubectl/cmd/auth/reconcile.go
Outdated
@@ -87,6 +90,9 @@ func NewCmdReconcile(f cmdutil.Factory, streams genericclioptions.IOStreams) *co | |||
o.PrintFlags.AddFlags(cmd) | |||
|
|||
cmdutil.AddFilenameOptionFlags(cmd, o.FilenameOptions, "identifying the resource to reconcile.") | |||
cmd.Flags().BoolVar(&o.DryRun, "dry-run", false, "If true, display results but do not submit changes") |
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 am wondering if printing needs to account for this 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.
I am wondering if printing needs to account for this somehow.
I don't think that printers have dry run as a first level option. This the the domain of the command which is controlling behavior. The only printing side-effect is the name printer string which is already configurable.
@juanvallejo and @soltysh since we already litigated this once.
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.
Yup, we've agreed that printers don't have to do anything with dry-run, it's command specific.
/ok-to-test |
9087305
to
64a387c
Compare
@enj updated to account for a dry run printout |
60c3209
to
dc342ef
Compare
/lgtm |
pkg/kubectl/cmd/auth/reconcile.go
Outdated
@@ -87,6 +89,7 @@ func NewCmdReconcile(f cmdutil.Factory, streams genericclioptions.IOStreams) *co | |||
o.PrintFlags.AddFlags(cmd) | |||
|
|||
cmdutil.AddFilenameOptionFlags(cmd, o.FilenameOptions, "identifying the resource to reconcile.") | |||
cmd.Flags().BoolVar(&o.DryRun, "dry-run", false, "If true, display results but do not submit changes") |
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.
default value (third arg) should be o.DryRun
pkg/kubectl/cmd/auth/reconcile.go
Outdated
@@ -47,6 +47,8 @@ type ReconcileOptions struct { | |||
PrintObject printers.ResourcePrinterFunc | |||
|
|||
genericclioptions.IOStreams | |||
|
|||
DryRun bool |
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.
Move up with other flags that get bound (near the top).
Minor comments, but I'd like to see the the default value change /approve holding so the default value can change. @enj feel free to remove hold after update. |
dc342ef
to
1dcdd2b
Compare
@deads2k updated with those changes |
Comments addressed. /hold cancel |
pkg/kubectl/cmd/auth/reconcile.go
Outdated
@@ -128,6 +130,9 @@ func (o *ReconcileOptions) Complete(cmd *cobra.Command, f cmdutil.Factory, args | |||
return err | |||
} | |||
|
|||
if o.DryRun { | |||
o.PrintFlags = genericclioptions.NewPrintFlags("not reconciled (dry run)").WithTypeSetter(scheme.Scheme) |
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.
Normally, we set the print flags once, and if we need to account for a dry run message, we use the Complete method in the printflags struct: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/set/set_env.go#L219-L225
Signed-off-by: Matt Rogers <mrogers@redhat.com>
1dcdd2b
to
20cd94d
Compare
/lgtm Retagging. |
@juanvallejo thanks, updated |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, enj, mrogers950 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 |
/retest |
1 similar comment
/retest |
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 as well
[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process Pull Request Labels
|
Automatic merge from submit-queue (batch tested with PRs 64322, 64210, 64458, 64232, 64370). If you want to cherry-pick this change to another branch, please follow the instructions here. |
/assign @juanvallejo
cc @enj