Skip to content

Fix double-encoding of ca cert data in kube context #805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

vuil
Copy link
Contributor

@vuil vuil commented Sep 5, 2024

What this PR does / why we need it

Which issue(s) this PR fixes

When a tanzu CLI context is created with a custom ca cert. The ca cert data was erroneously base64 encoded before being given to the json Marshaler, which base64 encodes all []byte fields anyway.
This leads to invalide ca cert data being stored in the kube context, and the follow errors when used:

Error: Unable to create http client unable to load root certificates: unable to parse bytes as PEM block
Error: Unable to create rest mapper. signk8s.io/dynamicrestmapper states httpClient must not be nil, consider using rest.HTTPClientFor(c) to create a client

Fixes #

Describe testing done for PR

Updated and ran unit tests.
Verified that after the fix that kube clients is able to use the custom ca cert data to validate calls to an endpoint with custom certs

Release note

Properly support the use of custom ca cert data for tanzu type CLI contexts.

Additional information

Special notes for your reviewer

@vuil vuil requested a review from a team as a code owner September 5, 2024 05:00
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@prkalle prkalle left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing it!

@vuil vuil merged commit 800db76 into vmware-tanzu:main Sep 5, 2024
8 checks passed
@marckhouzam marckhouzam added this to the v1.5.0 milestone Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants