Put etcd and Patroni's API on TLS, and move a running cluster there in maintenance mode
Members' etcd speaks TLS to peers and clients with a certificate from the cluster's authority and asks clients for one; Patroni reaches it with the member's certificate and serves its API over TLS. A running plain-HTTP cluster is moved with Patroni paused, so PostgreSQL serves throughout: Patroni's lease-free keys are carried over to the new etcd. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fed8c75c6c
commit
191c65e3db
12 files changed
+730
-105
No files matched your search
@@ -196,6 +196,12 @@ func newServerCmd() *cobra.Command {
|
||||
// Patroni. One host is a single PostgreSQL, which has none.
|
||||
if addr, err := storepkg.ResolveAddress(cfg.Auth.Store); err == nil && storepkg.IsPostgres(addr) {
|
||||
if hosts, _, _, err := storepkg.SplitPostgres(strings.TrimSpace(addr)); err == nil && len(hosts) > 1 {
|
||||
if cfg.AgentTLS.CA != "" {
|
||||
// Members' APIs, once on TLS, verified against it.
|
||||
if err := pgha.SetRESTCA(cfg.AgentTLS.CA); err != nil {
|
||||
log.Warn("the store's API cannot be verified", "err", err)
|
||||
}
|
||||
}
|
||||
storeHA = pgha.NewCollector(hosts)
|
||||
if err := rt.RegisterMetrics(storeHA); err != nil {
|
||||
return err
|
||||
|
||||
@@ -352,6 +352,7 @@ func (sa *serverAdd) storeAccess(ctx context.Context) error {
|
||||
if b, err := os.ReadFile(patroniRestFile(sa.etcDir)); err == nil { //nolint:gosec // our own secret
|
||||
rest = strings.TrimSpace(string(b))
|
||||
}
|
||||
_ = pgha.SetRESTCA(filepath.Join(sa.etcDir, "ca.pem"))
|
||||
changed, err := pgha.AllowClient(ctx, hosts, sa.ip, rest)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user