Skip to content

Consider chart-minted CA for postgres via CNPG serverCASecret/serverTLSSecret #3295

Description

Context

The CA extraction controller (#3286) needs a per-engine name-fallback, because neither CloudNativePG nor Percona PSMDB will apply a custom label to the CA Secret they create themselves. Verified against the shipped versions: CNPG 1.27.1 has spec.inheritedMetadata, but internal/controller/cluster_pki.go never calls SetInheritedData(), so the PKI secrets silently opt out of it while the credential secrets opt in; PSMDB 1.22.0 builds its cert-manager Certificate in code without ever setting SecretTemplate, exposes no field naming the CA Secret, and reconciles away any out-of-band patch through its percona.com/last-config-hash mechanism.

The alternative, for postgres only

CNPG supports bringing your own CA and server certificate through spec.certificates.serverCASecret and serverTLSSecret. The postgres chart could mint both with cert-manager — stamping internal.cozystack.io/publish-ca-cert: "true" via Certificate.spec.secretTemplate.labels — and hand them to the operator. Postgres would then sit on the same pure label-driven path as nats and qdrant, with no entry in the controller's fallback config.

Why this is a follow-up and not part of the first convergence

The fallback mechanism has to exist regardless. PSMDB has no path at all, so converting postgres does not let us delete the fallback — it only removes one entry from its configuration. The clean-contract argument is therefore much weaker than it first appears: the contract is already two-legged because of mongodb.

Against that, the conversion is a real change. It moves postgres from operator-managed PKI to chart-managed PKI, which raises a migration question for existing clusters. It also cannot be done by half: serverCASecret alone is insufficient, because a cert-manager CA Secret carries tls.key rather than ca.key, so serverTLSSecret must be supplied alongside it — this is CNPG's documented pairing, not a workaround. And because DefaultServerCaSecretSuffix and ClientCaSecretSuffix are both -ca, CNPG still generates its own <cluster>-ca for client certificates when clientCASecret is unset, so the operator-minted key-bearing Secret keeps existing as an internal artifact either way.

The field semantics above come from the CRD schema, upstream documentation and source constants. This path has not been exercised end-to-end on a cluster.

Decision

Revisit once the controller and the postgres convergence have landed and the real cost of the fallback is known. If the fallback turns out to be cheap and boring, this stays closed as unnecessary.

Part of #2811. Follow-up to #3286.

Activity

  1. added
    kind/featureCategorizes issue or PR as related to a new feature
    priority/backlogGeneral backlog priority. Lower than priority/important-longterm
    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)
    triage/acceptedIndicates an issue is ready to be actively worked on
    area/platformIssues or PRs related to platform infrastructure (bundle, flux, talos, installer)
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)area/platformIssues or PRs related to platform infrastructure (bundle, flux, talos, installer)kind/featureCategorizes issue or PR as related to a new featurepriority/backlogGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions