Skip to content

Restores display of object status when displaying helm status - #7785

Merged
mattfarina merged 1 commit into
helm:dev-v2from
mattfarina:fix-6896
Mar 20, 2020
Merged

mattfarina merged 1 commit into
helm:dev-v2from
mattfarina:fix-6896

Conversation

@mattfarina

Copy link
Copy Markdown
Collaborator

Changes to the Kubernetes API server and kubectl libraries caused
the status to no longer display when helm status was run for a
release. This change restores the status display.

Generation of the tables for display was optionally moved server
side. A request for the data as a table is made and a kubectl
printer for tables can display this data. Kubectl uses this setup and
the structure here closely resembles kubectl. kubectl is still
able to display objects as tables from prior to server side
printing. Server side printing is able to handle non-core
resources like CRDs.

Note, an extra request is made because table responses cannot be
easily transformed into Go objects for Kubernetes types to work
with. There is one request to get the resources for display in
a table and a second request to get the resources to lookup the
related pods. The related pods are now requested as a table as
well for display purposes.

This is likely part of the larger trend to move features like
this server side so that more libraries in more languages can
get to the feature.

The fix only works for Kubernetes 1.15 and newer. This is when
the table functionality was added to the api server. Kubernetes
supports the latest 3 minor versions meaning kubectl does the
same. It only needs to support back to 1.15 now for table
display. In Kubernetes 1.14 kubectl can still display the table
information using different printing methods.

Closes #6896

If someone knows how to fix this without using server side printing I would appreciate knowing as it would enable support to 1.14 and older versions of Kubernetes.

@mattfarina mattfarina added bug Categorizes issue or PR as related to a bug. v2.x Issues and Pull Requests related to the major version v2 labels Mar 19, 2020
@mattfarina mattfarina added this to the 2.16.4 milestone Mar 19, 2020
@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 19, 2020
@bacongobbler

Copy link
Copy Markdown
Member

Taking this for a spin and trying to sift through the Kubernetes codebase to see if there's a better way.

@bacongobbler bacongobbler left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After banging my head against kubectl print flags for a few hours, I could not find any backwards-compatible solutions that worked without server-side printing.

LGTM.

Changes to the Kubernetes API server and kubectl libraries caused
the status to no longer display when helm status was run for a
release. This change restores the status display.

Generation of the tables for display was moved server
side. A request for the data as a table is made and a kubectl
printer for tables can display this data. Kubectl uses this setup and
the structure here closely resembles kubectl. kubectl is still
able to display objects as tables from prior to server side
printing but only prints limited information.

Note, an extra request is made because table responses cannot be
easily transformed into Go objects for Kubernetes types to work
with. There is one request to get the resources for display in
a table and a second request to get the resources to lookup the
related pods. The related pods are now requested as a table as
well for display purposes.

This is likely part of the larger trend to move features like
this server side so that more libraries in more languages can
get to the feature.

Closes helm#6896

Signed-off-by: Matt Farina <[email protected]>
@mattfarina

Copy link
Copy Markdown
Collaborator Author

Note, the latest change also fixes sorting and versions of Kubernetes 1.14 and older.

Comment thread pkg/kube/client.go
func transformRequests(req *rest.Request) {

// The request headers are for both the v1 and v1beta1 versions of the table
// as Kubernetes 1.14 and older used the beta version.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🎉

@mattfarina

Copy link
Copy Markdown
Collaborator Author

Thanks for the reviews. This was a hairy problem.

@mattfarina
mattfarina merged commit baa0a3f into helm:dev-v2 Mar 20, 2020
@mattfarina
mattfarina deleted the fix-6896 branch March 20, 2020 16:45
@mattfarina mattfarina added the needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. label Mar 20, 2020
@mattfarina mattfarina added the picked Indicates that a PR has been cherry-picked into the next release candidate. label Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. picked Indicates that a PR has been cherry-picked into the next release candidate. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. v2.x Issues and Pull Requests related to the major version v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants