mirror of
https://github.com/outbackdingo/kubernetes.git
synced 2026-02-24 11:57:35 +00:00
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 ```