Skip to content

[Feature]: Separate CA and leaf certificate lifetimes for operator-managed PKI #11121

Description

@baurmatt

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

CloudNativePG currently exposes a single operator-wide CERTIFICATE_DURATION that applies equally to self-managed CAs and leaf certificates. As a result, the cluster CA rotates on the same cadence as server, replication, and client leaf certificates. This increases the frequency of trust-anchor rotation even though CA certificates are typically expected to be longer lived than leaves.

The current shared-duration model creates operational coupling in the reconciliation flow:

There is no clear documented rationale in code comments, issue #1691, or PR #3686 for keeping CA and leaf lifetimes identical. The code appears to have adopted a single shared knob as an implementation simplification rather than an explicit PKI design decision.

Allowing the CA to have a separate lifetime would reduce unnecessary CA rotation while preserving short-lived leaf certificates and the current automated renewal model.

Describe the solution you'd like

Introduce distinct duration settings:

  • CA_CERTIFICATE_DURATION: lifetime of generated root/derived CA certificates
  • CERTIFICATE_DURATION: lifetime of generated non-CA certificates (preserve existing meaning for leaf certificates)

Compatibility and migration:

  • Preserve backward compatibility by keeping current behavior when CA_CERTIFICATE_DURATION is unset.
  • If only CERTIFICATE_DURATION is set, behavior remains exactly as today.
  • If CA_CERTIFICATE_DURATION is set, self-managed CA certificates should use that value while leaf certificates continue to use CERTIFICATE_DURATION.
  • Existing clusters should continue to reconcile safely without requiring users to recreate secrets.

Describe alternatives you've considered

Switch to user-provided certificates e.g. maintained by Cert-Manager.

Additional context

I've researched and partly created this issue with help of AI.

Backport?

Yes

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    triage
    on Jul 3, 2026
  2. baurmatt commented on Jul 5, 2026

    @baurmatt
    ContributorAuthor

    @Utkarsh-sharma47 Was your commented meant for another issue? I fail to see the connection to my feature request.

  3. Utkarsh-sharma47 commented on Jul 5, 2026

    @Utkarsh-sharma47
    Contributor

    Sorry, that comment was intended for a different issue . I posted it here by mistake.

  4. added
    enhancement 🪄
    and removed
    triage
    on Sep 24, 2026
  5. added this to the Now milestone on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement 🪄no-stale

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions