Skip to content

Fix improper use of Table request/response to k8s API - #11720

Merged
mattfarina merged 1 commit into
helm:mainfrom
mattfarina:fix-11712
Jan 13, 2023
Merged

mattfarina merged 1 commit into
helm:mainfrom
mattfarina:fix-11712

Conversation

@mattfarina

Copy link
Copy Markdown
Collaborator

A change was made that when validation was turned off the Kubernetes packages were building objects as a Table type. This was done for display purposes. When details about the objects was going to be printed as part of #10912.

This broke rollback, and possibly other functionality, as a Table type was returned in some cases that needed the regular object. This caused things to break silently.

The fix involved adding in a new Function (and interface) to query for tables instead of the objects themselves. There was not a clean way to add it to the existing function that covered all cases.

A second problem was noticed along the way. When data was output via status as YAML or JSON it was in the form of a table rather than the objects themselves. This did not reflect expectations and did not match the functionality in kubectl. The code was updated to return a table when that was presented and the objects when they are being output for YAML or JSON. The API also supports this handling to SDK users can replicate this functionality.

API changes made here were never released. The functions were developed for this release of Helm and only ever appeared in an RC. In this case, they can be changed.

Note, extensive testing is not covered by this PR as our testing system doesn't have the ability to cover this :(. The additional testing needs can be covered in follow-up pull requests.

Fixes #11712

What this PR does / why we need it: There is a regression in 3.11.0-rc.1 that needs to be fixed before release

Special notes for your reviewer:

Two things:

  1. The lack of specific testing has to do with limitations of the testing system for things like this. That is additional future work we need to do.
  2. The API changes presented here are to things that have never been released so they are ok to do.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Fixes helm#11712

A change was made that when validation was turned off the Kubernetes
packages were building objects as a Table type. This was done for
display purposes. When details about the objects was going to be
printed as part of helm#10912.

This broke rollback, and possibly other functionality, as a Table
type was returned in some cases that needed the regular object.
This caused things to break silently.

The fix involved adding in a new Function (and interface) to
query for tables instead of the objects themselves. There was not
a clean way to add it to the existing function that covered all
cases.

A second problem was noticed along the way. When data was output
via status as YAML or JSON it was in the form of a table rather
than the objects themselves. This did not reflect expectations
and did not match the functionality in kubectl. The code was
updated to return a table when that was presented and the objects
when they are being output for YAML or JSON. The API also supports
this handling to SDK users can replicate this functionality.

API changes made here were never released. The functions were
developed for this release of Helm and only ever appeared in an
RC. In this case, they can be changed.

Signed-off-by: Matt Farina <[email protected]>
@mattfarina mattfarina added this to the 3.11.0 milestone Jan 12, 2023
@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 12, 2023

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed PR addresses issues with resources being clobbered as part of a rollback

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mattfarina Code reviewed, looks good. I need to do some manual testing. Will get to it shortly.

@hickeyma hickeyma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested and fixes the rollback problem. Nice fix, thanks @mattfarina. Good to merge.

@mattfarina
mattfarina merged commit 76157c6 into helm:main Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken Helm Rollback Command in v3.11.0-rc.1

3 participants