Skip to content

remote-config postgres: add --client-cert-duration flag - #849

Open
souravbiswassanto wants to merge 1 commit into
masterfrom
client-cert-duration
Open

souravbiswassanto wants to merge 1 commit into
masterfrom
client-cert-duration

Conversation

@souravbiswassanto

Copy link
Copy Markdown
Member

Problem

The client certificate that kubectl dba remote-config postgres generates is applied to the replica cluster as a static Secret that nothing renews, and the replica copies it into /tls/certs/remote only at pod start. When it expires the replica can no longer connect to the source. Its lifetime was not configurable:

  • cert-manager path: inherited from the source's client certificate (cert-manager default 90d)
  • --ca-cert path: hard-coded 1 year

Change

New flag --client-cert-duration (e.g. 87600h for 10 years):

  • cert-manager path: overrides the Certificate duration; an inherited renewBefore that no longer fits is dropped (cert-manager rejects renewBefore >= duration).
  • --ca-cert path: overrides the 1y default validity.
  • Both paths: the local-CA leaf is clamped to the CA's NotAfter (with a warning). With cert-manager the issuer may still cap the duration.
  • Default behaviour is unchanged when the flag is omitted.

Tests

go test ./pkg/remote_replica/ — added tests for an explicit 10y validity and for clamping an explicit validity to the CA expiry.

Not tested against a live cluster.

Lets the client certificate generated for a remote replica live longer
than the cert-manager default (90d) or the 1y local-CA default, e.g.
--client-cert-duration=87600h. The value overrides the Certificate
duration on the cert-manager path and the validity on the --ca-cert
path; it is still clamped to the signing CA's NotAfter.

Signed-off-by: souravbiswassanto <saurov@appscode.com>
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.

1 participant