Merge pull request #61477 from soltysh/server_print_default

Automatic merge from submit-queue (batch tested with PRs 61842, 61477, 61777). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Turn server-print on by default in kubectl

**What this PR does / why we need it**:
#55637 introduced `-experimental-server-print` that enabled users to opt-in to user server-side printing. This is a followup which enables this functionality by default, with the ability to fallback not to do it with `--server-print=false`. 

/assign @smarterclayton @juanvallejo 

**Release note**:
```release-note
Enable server-side print in kubectl by default, with the ability to turn it off with --server-print=false
```
This commit is contained in:
Kubernetes Submit Queue
2018-03-28 15:57:09 -07:00
committed by GitHub
2 changed files with 20 additions and 13 deletions

View File

@@ -122,7 +122,7 @@ var (
const (
useOpenAPIPrintColumnFlagLabel = "use-openapi-print-columns"
useServerPrintColumns = "experimental-server-print"
useServerPrintColumns = "server-print"
)
// NewGetOptions returns a GetOptions with default chunk size 500.
@@ -202,6 +202,13 @@ func (options *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args
}
options.Sort = len(isSorting) > 0
// TODO (soltysh): currently we don't support sorting and custom columns
// with server side print. So in these cases force the old behavior.
outputOption := cmd.Flags().Lookup("output").Value.String()
if options.Sort && outputOption == "custom-columns" {
options.ServerPrint = false
}
options.IncludeUninitialized = cmdutil.ShouldIncludeUninitialized(cmd, false)
switch {
@@ -727,7 +734,7 @@ func addOpenAPIPrintColumnFlags(cmd *cobra.Command) {
}
func addServerPrintColumnFlags(cmd *cobra.Command) {
cmd.Flags().Bool(useServerPrintColumns, false, "If true, have the server return the appropriate table output. Supports extension APIs and CRD. Experimental.")
cmd.Flags().Bool(useServerPrintColumns, true, "If true, have the server return the appropriate table output. Supports extension APIs and CRDs.")
}
func shouldGetNewPrinterForMapping(printer printers.ResourcePrinter, lastMapping, mapping *meta.RESTMapping) bool {