Skip to content

fix: Remove CABundle from CRD objects if the cert is invalid - #952

Merged
matheuscscp merged 1 commit into
fluxcd:mainfrom
dgunzy:fix-invalid-cabundle-crd-reconciliation
Jun 29, 2025
Merged

matheuscscp merged 1 commit into
fluxcd:mainfrom
dgunzy:fix-invalid-cabundle-crd-reconciliation

Conversation

@dgunzy

@dgunzy dgunzy commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

Fixes #800

Summary

  • Added a new cert_validation.go file in ssa
  • This follows the logic / pattern kubernetes uses here
  • Will decode from base64 and validate the cert
  • Added function removeCaBundleFromCRD to manager_apply.go

Please let me know if there is some feedback, more tests/specific test cases to add, or a different approach.

@dgunzy
dgunzy requested a review from stefanprodan as a code owner June 25, 2025 00:07
@matheuscscp matheuscscp changed the title Fix Remove CABundle from CRDs if the cert is invalid #800 Fix Remove CABundle from CR objects if the cert is invalid #800 Jun 27, 2025
@matheuscscp matheuscscp changed the title Fix Remove CABundle from CR objects if the cert is invalid #800 feat: Remove CABundle from CR objects if the cert is invalid Jun 27, 2025
@matheuscscp matheuscscp changed the title feat: Remove CABundle from CR objects if the cert is invalid feat: Remove CABundle from CRD objects if the cert is invalid Jun 27, 2025
Comment thread ssa/manager_apply.go Resolved
Comment thread ssa/manager_apply.go Resolved
Comment thread ssa/utils/cert_validation.go Resolved
Comment thread ssa/manager_apply_test.go Resolved
Comment thread ssa/manager_apply.go Resolved
Comment thread ssa/utils/cert_validation_test.go Resolved
Comment thread ssa/utils/cert_validation.go Resolved
Comment thread ssa/utils/cert_validation.go Resolved
Comment thread ssa/manager_apply_test.go Resolved
Comment thread ssa/manager_apply_test.go Resolved
Comment thread ssa/testdata/test11.yaml Resolved
Comment thread ssa/manager_diff_test.go Resolved
@matheuscscp matheuscscp changed the title feat: Remove CABundle from CRD objects if the cert is invalid fix: Remove CABundle from CRD objects if the cert is invalid Jun 29, 2025

@matheuscscp matheuscscp 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.

LGTM! 🚀

Thanks very much @dgunzy, please squash so we can merge

@dgunzy

dgunzy commented Jun 29, 2025

Copy link
Copy Markdown
Contributor Author

LGTM! 🚀

Thanks very much @dgunzy, please squash so we can merge

Awesome! Squashed 😄

Comment thread ssa/utils/cert_validation.go Resolved
Starting with Kubernetes 1.31, CRDs with invalid certs in
spec.conversion.webhook.clientConfig.caBundle are rejected by the API.
Validate the bundle and remove the field from SSA patch if validation fails.

Fixes #800

Signed-off-by: Daniel Guns <[email protected]>
@matheuscscp
matheuscscp merged commit 21cbf19 into fluxcd:main Jun 29, 2025
@matheuscscp

Copy link
Copy Markdown
Member

@dgunzy I just released github.com/fluxcd/pkg/ssa v0.49.0, feel free to open PRs in kustomize-controller and flux2 for bumping the ssa version and getting this change in those repos

@dgunzy

dgunzy commented Jun 29, 2025

Copy link
Copy Markdown
Contributor Author

@dgunzy I just released github.com/fluxcd/pkg/ssa v0.49.0, feel free to open PRs in kustomize-controller and flux2 for bumping the ssa version and getting this change in those repos

@matheuscscp Sounds good! I will get those up soon. Thanks!

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.

Remove CABundle from CRDs if the cert is invalid

2 participants