Skip to content

Remove obsolete pgbackrest SSH code and recovery.signal removal code. #4165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions internal/controller/postgrescluster/pgbackrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,10 @@ func (r *Reconciler) cleanupRepoResources(ctx context.Context,
if !backupsSpecFound {
break
}
// Any resources from before 5.1 that relate to the previously required
// SSH configuration should be deleted.
// TODO(tjmoore4): This can be removed once 5.0 is EOL.
if owned.GetName() != naming.PGBackRestSSHConfig(postgresCluster).Name &&
owned.GetName() != naming.PGBackRestSSHSecret(postgresCluster).Name {
// If a dedicated repo host resource and a dedicated repo host is enabled, then
// add to the slice and do not delete.
ownedNoDelete = append(ownedNoDelete, owned)
delete = false
}
// If a dedicated repo host resource and a dedicated repo host is enabled, then
// add to the slice and do not delete.
ownedNoDelete = append(ownedNoDelete, owned)
delete = false
case hasLabel(naming.LabelPGBackRestRepoVolume):
if !backupsSpecFound {
break
Expand Down
34 changes: 0 additions & 34 deletions internal/naming/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,6 @@ const (
// configmap will be named 'mycluster-pgbackrest-config'
cmNameSuffix = "%s-pgbackrest-config"

// suffix used with postgrescluster name for associated configmap.
// for instance, if the cluster is named 'mycluster', the
// configmap will be named 'mycluster-ssh-config'
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
sshCMNameSuffix = "%s-ssh-config"

// suffix used with postgrescluster name for associated secret.
// for instance, if the cluster is named 'mycluster', the
// secret will be named 'mycluster-ssh'
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
sshSecretNameSuffix = "%s-ssh"

// RestoreConfigCopySuffix is the suffix used for ConfigMap or Secret configuration
// resources needed when restoring from a PostgresCluster data source. If, for
// example, a Secret is named 'mysecret' and is the first item in the configuration
Expand Down Expand Up @@ -516,26 +502,6 @@ func PGBackRestRepoVolume(cluster *v1beta1.PostgresCluster,
}
}

// PGBackRestSSHConfig returns the ObjectMeta for a pgBackRest SSHD ConfigMap
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSSHConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: fmt.Sprintf(sshCMNameSuffix, cluster.GetName()),
Namespace: cluster.GetNamespace(),
}
}

// PGBackRestSSHSecret returns the ObjectMeta for a pgBackRest SSHD Secret
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSSHSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: fmt.Sprintf(sshSecretNameSuffix, cluster.GetName()),
Namespace: cluster.GetNamespace(),
}
}

// PGBackRestSecret returns the ObjectMeta for a pgBackRest Secret
func PGBackRestSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
return metav1.ObjectMeta{
Expand Down
2 changes: 0 additions & 2 deletions internal/naming/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func TestClusterNamesUniqueAndValid(t *testing.T) {
{"PatroniLeaderConfigMap", PatroniLeaderConfigMap(cluster)},
{"PatroniTrigger", PatroniTrigger(cluster)},
{"PGBackRestConfig", PGBackRestConfig(cluster)},
{"PGBackRestSSHConfig", PGBackRestSSHConfig(cluster)},
})
})

Expand Down Expand Up @@ -141,7 +140,6 @@ func TestClusterNamesUniqueAndValid(t *testing.T) {
{"DeprecatedPostgresUserSecret", DeprecatedPostgresUserSecret(cluster)},
{"PostgresTLSSecret", PostgresTLSSecret(cluster)},
{"ReplicationClientCertSecret", ReplicationClientCertSecret(cluster)},
{"PGBackRestSSHSecret", PGBackRestSSHSecret(cluster)},
{"MonitoringUserSecret", MonitoringUserSecret(cluster)},
})

Expand Down
9 changes: 0 additions & 9 deletions internal/postgres/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,6 @@ chmod +x /tmp/pg_rewind_tde.sh
// - https://git.postgresql.org/gitweb/?p=postgresql.git;f=src/bin/pg_basebackup/pg_basebackup.c;hb=REL_13_0#l2621
`safelink "${pgwal_directory}" "${postgres_data_directory}/pg_wal"`,
`results 'wal directory' "$(realpath "${postgres_data_directory}/pg_wal" ||:)"`,

// Early versions of PGO create replicas with a recovery signal file.
// Patroni also creates a standby signal file before starting Postgres,
// causing Postgres to remove only one, the standby. Remove the extra
// signal file now, if it exists, and let Patroni manage the standby
// signal file instead.
// - https://git.postgresql.org/gitweb/?p=postgresql.git;f=src/backend/access/transam/xlog.c;hb=REL_12_0#l5318
// TODO(cbandy): Remove this after 5.0 is EOL.
`rm -f "${postgres_data_directory}/recovery.signal"`,
}, "\n")

return append([]string{"bash", "-ceu", "--", script, "startup"}, args...)
Expand Down
1 change: 0 additions & 1 deletion internal/postgres/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ initContainers:
touch "${postgres_data_directory}/postgresql.conf"
safelink "${pgwal_directory}" "${postgres_data_directory}/pg_wal"
results 'wal directory' "$(realpath "${postgres_data_directory}/pg_wal" ||:)"
rm -f "${postgres_data_directory}/recovery.signal"
- startup
- "11"
- /pgdata/pg11_wal
Expand Down
Loading