Skip to content

feat: add pregenerated certificates support with comprehensive testing#928

Draft
rossigee wants to merge 9 commits into
clastix:masterfrom
rossigee:feature/pregenerated-certificates
Draft

feat: add pregenerated certificates support with comprehensive testing#928
rossigee wants to merge 9 commits into
clastix:masterfrom
rossigee:feature/pregenerated-certificates

Conversation

@rossigee

Copy link
Copy Markdown

This feature allows users to specify existing certificates and keys instead of generating new ones, addressing enterprise security requirements and certificate lifecycle management needs.

Key changes:

  • Add PreGeneratedCertificatesSpec API with CertificateReference and KeyReference types
  • Support for CA, API Server, Kubelet Client, Front Proxy CA/Client, and Service Account certificates
  • Add PublicAPIServerAddress field for DNS-based cluster access
  • Implement PublicControlPlaneAddress() method for cluster-info ConfigMap
  • Add Bootstrap configuration for RBAC and initial manifests
  • Support for internal CA certificates via ConfigMap mounting
  • Extensive test coverage including unit tests and E2E scenarios
  • Update CRDs, samples, charts, and documentation
  • Add validation webhooks and mutual exclusivity checks

This implementation maintains backward compatibility while providing flexibility for certificate management in enterprise environments.

@netlify

netlify Bot commented Aug 29, 2025

Copy link
Copy Markdown

Deploy Preview for kamaji-documentation ready!

Name Link
🔨 Latest commit cdaca2b
🔍 Latest deploy log https://app.netlify.com/projects/kamaji-documentation/deploys/69ef5c5711d0680008919925
😎 Deploy Preview https://deploy-preview-928--kamaji-documentation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@prometherion

Copy link
Copy Markdown
Member

This is absolutely massive and awesome, thanks Ross!

I'll need some time to review it property but this feature unlocks a stale feature request we had for so long time.

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

It would be great to have the e2e being green before planning this to get merged: that would be helpful for avoiding introducing breaking changes.

Comment thread api/v1alpha1/tenantcontrolplane_public_address.go Outdated
Comment thread api/v1alpha1/tenantcontrolplane_types.go
Comment thread api/v1alpha1/tenantcontrolplane_types.go
Comment thread api/v1alpha1/tenantcontrolplane_types.go
Comment thread internal/resources/kubeadm_phases.go
Comment thread internal/resources/kubeadm_phases.go Outdated
Comment on lines +163 to +168
// If bootstrap RBAC is configured, use that instead of default kubeadm behavior
if tcp.Spec.Bootstrap != nil && tcp.Spec.Bootstrap.RBAC != nil && tcp.Spec.Bootstrap.RBAC.Enabled {
return r.createBootstrapRBAC(ctx, c, tcp)
}

// Fallback to original kubeadm behavior for backward compatibility

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.

I like the idea of making toggleable the RBAC setup, but I would avoid having a separate function such as createBootstrapRBAC.

We should make Bootstrap and RBAC enabled by default, with the same defaults as Kubernetes, and try to resuse the underlying kubeadm library for DRY purposes/duplication of code.

@rossigee

rossigee commented Sep 1, 2025

Copy link
Copy Markdown
Author

@prometherion - thanks for the feedback! I've also found some further issues since posting this, so it seems I was a bit premature. I'll put this in draft mode and deal with the remaining bugs, and your comments above first.

@rossigee rossigee marked this pull request as draft September 1, 2025 09:38
@bsctl

bsctl commented Sep 2, 2025

Copy link
Copy Markdown
Member

@rossigee this is great! thank you for contributing to Kamaji!

@rossigee rossigee force-pushed the feature/pregenerated-certificates branch 3 times, most recently from a277c8e to 5754162 Compare October 9, 2025 00:28
@rossigee

rossigee commented Oct 9, 2025

Copy link
Copy Markdown
Author

FTR, I'm trying to break it up into more manageable chunks. Here's a related PR...

#986

This commit adds support for pre-generated certificates and bootstrap
configuration to TenantControlPlane resources.

Key features:
- PreGeneratedCertificates: Allow specifying existing certificates instead of generating new ones
- Bootstrap: Configure initial RBAC setup and init manifests for clusters
- CertificateReference and KeyReference types for certificate management
- RBACBootstrapSpec for RBAC configuration during cluster creation
- BootstrapSpec for initial cluster setup including CNI, GitOps operators, etc.

Includes:
- API types and validation
- Certificate management logic
- Webhook defaults and validation
- Comprehensive test coverage
- Updated CRDs and documentation
Add import for cmp package and fix cmpt.Or to cmp.Or in
tenantcontrolplane_public_address.go to resolve compilation failure.
Update the test to expect 7 patches instead of 6 due to DataStoreUsername
defaulting being added. Also set DataStoreUsername in the 'fields already set'
test to prevent unwanted patches.
…AC creation

- Change RBAC bootstrap to be enabled by default when bootstrap.RBAC is nil
- Filter out 'kubernetes-admin' from additional admin users to avoid duplication
- Ensure RBAC is created for all tenants unless explicitly disabled
- Add default value ['system:masters'] for AdminGroups field
- Update createBootstrapRBAC to default both users and groups
- Follows Kubernetes conventions for standard admin group
- Ensures RBAC bootstrap provides complete default admin access
- Remove unused errors import from bootstraptoken.go
- Fix k8serrors.Wrap to fmt.Errorf in kubeadm_utils.go
- Remove unused endpoint variable in kubeadm_config.go
- Update generated files after rebase
- Remove TenantControlPlaneServiceCIDR and TenantControlPlaneLoadBalancerSourceRanges handlers that were not defined after rebase
…ignature

- Add nil parameter for DataStoreOverrides slice to match upstream function signature
@rossigee rossigee force-pushed the feature/pregenerated-certificates branch from 00a449f to cdaca2b Compare April 27, 2026 12:53
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