Files
kubernetes/pkg/printers
Kubernetes Submit Queue 9f4b851e91 Merge pull request #56629 from luksa/fix_custom_column_alignment
Automatic merge from submit-queue. 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>.

Fix bad column alignment when using custom columns from OpenAPI schema

Columns printed by `kubectl get` weren't aligned properly when they were coming from the OpenAPI schema. 

This was caused by `CustomColumnPrinter.PrintObj`, which was creating a new `tabwriter.Writer` instead of re-using the tabwriter received through the `out` method parameter (basically, a tabwriter was writing to another tabwriter). Because the PrintObj flushed the tabwriter after writing each individual line, the column widths would reset.

**What this PR does / why we need it**:
This PR fixes the bad column alignment.

**Which issue(s) this PR fixes** 
Fixes #56282 

**Special notes for your reviewer**:
I've aligned how `CustomColumnPrinter.PrintObj` handles tabwriter with how `HumanReadablePrinter.PrintObj` does it (see https://github.com/kubernetes/kubernetes/blob/master/pkg/printers/humanreadable.go#L299-L303)

**Release note**:
```release-note
Fixed column alignment when kubectl get is used with custom columns from OpenAPI schema
```
2018-04-05 09:56:41 -07:00
..
2018-02-02 14:00:45 -05:00
2018-04-03 13:59:35 -04:00
2017-05-31 13:02:23 +05:30
2017-05-31 13:02:23 +05:30
2018-03-26 10:00:45 -04:00
2017-03-07 22:28:27 -05:00
2018-04-03 13:59:35 -04:00
2018-03-27 18:11:01 -04:00