Skip to content

fix: Invalid caBundle encoding (double base64) - #1064

Merged
kimpenhaus merged 1 commit into
dotnet:mainfrom
danihengeveld:fix/invalid-ca-bundle-encoding
Mar 12, 2026
Merged

kimpenhaus merged 1 commit into
dotnet:mainfrom
danihengeveld:fix/invalid-ca-bundle-encoding

Conversation

@danihengeveld

Copy link
Copy Markdown
Contributor

The explicit Convert.ToBase64String() and then back to byte[] results in a double base64 encoded caBundle.

This results in the following problems at deploy time:

Warning   FailedCreate        replicaset/***-operator-5d9577b5d9   Error creating: Internal error occurred: failed calling webhook "mutate.pod.v1": could not get REST client: unable to load root certificates: unable to parse bytes as PEM block

Kubernetes client already automatically base64 encodes a byte[] when serializing. So no need to do it manually.

Kubernetes client automatically base64 encodes a `byte[]` when serializing.
Copilot AI review requested due to automatic review settings March 12, 2026 08:26

Copilot AI 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.

Pull request overview

Fixes webhook/CRD caBundle generation in the CLI operator scaffolding by removing an unintended double-base64 encoding step, ensuring Kubernetes receives PEM bytes and can correctly parse the CA bundle.

Changes:

  • Remove manual Convert.ToBase64String(...) when constructing caBundle.
  • Pass raw PEM bytes (as byte[]) to webhook and CRD generators so the Kubernetes client handles base64 serialization correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@kimpenhaus
kimpenhaus merged commit 655277f into dotnet:main Mar 12, 2026
6 of 7 checks passed
@kimpenhaus

Copy link
Copy Markdown
Collaborator

@danihengeveld thanks for fixing this 👍🏼

@danihengeveld
danihengeveld deleted the fix/invalid-ca-bundle-encoding branch March 12, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants