Skip to content

Commit cdc6795

Browse files
committed
Remove obsolete pgbackrest SSH code and recovery.signal removal code.
1 parent 7383f6b commit cdc6795

File tree

5 files changed

+4
-56
lines changed

5 files changed

+4
-56
lines changed

internal/controller/postgrescluster/pgbackrest.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,10 @@ func (r *Reconciler) cleanupRepoResources(ctx context.Context,
318318
if !backupsSpecFound {
319319
break
320320
}
321-
// Any resources from before 5.1 that relate to the previously required
322-
// SSH configuration should be deleted.
323-
// TODO(tjmoore4): This can be removed once 5.0 is EOL.
324-
if owned.GetName() != naming.PGBackRestSSHConfig(postgresCluster).Name &&
325-
owned.GetName() != naming.PGBackRestSSHSecret(postgresCluster).Name {
326-
// If a dedicated repo host resource and a dedicated repo host is enabled, then
327-
// add to the slice and do not delete.
328-
ownedNoDelete = append(ownedNoDelete, owned)
329-
delete = false
330-
}
321+
// If a dedicated repo host resource and a dedicated repo host is enabled, then
322+
// add to the slice and do not delete.
323+
ownedNoDelete = append(ownedNoDelete, owned)
324+
delete = false
331325
case hasLabel(naming.LabelPGBackRestRepoVolume):
332326
if !backupsSpecFound {
333327
break

internal/naming/names.go

-34
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,6 @@ const (
166166
// configmap will be named 'mycluster-pgbackrest-config'
167167
cmNameSuffix = "%s-pgbackrest-config"
168168

169-
// suffix used with postgrescluster name for associated configmap.
170-
// for instance, if the cluster is named 'mycluster', the
171-
// configmap will be named 'mycluster-ssh-config'
172-
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
173-
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
174-
sshCMNameSuffix = "%s-ssh-config"
175-
176-
// suffix used with postgrescluster name for associated secret.
177-
// for instance, if the cluster is named 'mycluster', the
178-
// secret will be named 'mycluster-ssh'
179-
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
180-
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
181-
sshSecretNameSuffix = "%s-ssh"
182-
183169
// RestoreConfigCopySuffix is the suffix used for ConfigMap or Secret configuration
184170
// resources needed when restoring from a PostgresCluster data source. If, for
185171
// example, a Secret is named 'mysecret' and is the first item in the configuration
@@ -516,26 +502,6 @@ func PGBackRestRepoVolume(cluster *v1beta1.PostgresCluster,
516502
}
517503
}
518504

519-
// PGBackRestSSHConfig returns the ObjectMeta for a pgBackRest SSHD ConfigMap
520-
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
521-
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
522-
func PGBackRestSSHConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
523-
return metav1.ObjectMeta{
524-
Name: fmt.Sprintf(sshCMNameSuffix, cluster.GetName()),
525-
Namespace: cluster.GetNamespace(),
526-
}
527-
}
528-
529-
// PGBackRestSSHSecret returns the ObjectMeta for a pgBackRest SSHD Secret
530-
// Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization.
531-
// TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
532-
func PGBackRestSSHSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
533-
return metav1.ObjectMeta{
534-
Name: fmt.Sprintf(sshSecretNameSuffix, cluster.GetName()),
535-
Namespace: cluster.GetNamespace(),
536-
}
537-
}
538-
539505
// PGBackRestSecret returns the ObjectMeta for a pgBackRest Secret
540506
func PGBackRestSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta {
541507
return metav1.ObjectMeta{

internal/naming/names_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ func TestClusterNamesUniqueAndValid(t *testing.T) {
8888
{"PatroniLeaderConfigMap", PatroniLeaderConfigMap(cluster)},
8989
{"PatroniTrigger", PatroniTrigger(cluster)},
9090
{"PGBackRestConfig", PGBackRestConfig(cluster)},
91-
{"PGBackRestSSHConfig", PGBackRestSSHConfig(cluster)},
9291
})
9392
})
9493

@@ -141,7 +140,6 @@ func TestClusterNamesUniqueAndValid(t *testing.T) {
141140
{"DeprecatedPostgresUserSecret", DeprecatedPostgresUserSecret(cluster)},
142141
{"PostgresTLSSecret", PostgresTLSSecret(cluster)},
143142
{"ReplicationClientCertSecret", ReplicationClientCertSecret(cluster)},
144-
{"PGBackRestSSHSecret", PGBackRestSSHSecret(cluster)},
145143
{"MonitoringUserSecret", MonitoringUserSecret(cluster)},
146144
})
147145

internal/postgres/config.go

-9
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,6 @@ chmod +x /tmp/pg_rewind_tde.sh
425425
// - https://git.postgresql.org/gitweb/?p=postgresql.git;f=src/bin/pg_basebackup/pg_basebackup.c;hb=REL_13_0#l2621
426426
`safelink "${pgwal_directory}" "${postgres_data_directory}/pg_wal"`,
427427
`results 'wal directory' "$(realpath "${postgres_data_directory}/pg_wal" ||:)"`,
428-
429-
// Early versions of PGO create replicas with a recovery signal file.
430-
// Patroni also creates a standby signal file before starting Postgres,
431-
// causing Postgres to remove only one, the standby. Remove the extra
432-
// signal file now, if it exists, and let Patroni manage the standby
433-
// signal file instead.
434-
// - https://git.postgresql.org/gitweb/?p=postgresql.git;f=src/backend/access/transam/xlog.c;hb=REL_12_0#l5318
435-
// TODO(cbandy): Remove this after 5.0 is EOL.
436-
`rm -f "${postgres_data_directory}/recovery.signal"`,
437428
}, "\n")
438429

439430
return append([]string{"bash", "-ceu", "--", script, "startup"}, args...)

internal/postgres/reconcile_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ initContainers:
285285
touch "${postgres_data_directory}/postgresql.conf"
286286
safelink "${pgwal_directory}" "${postgres_data_directory}/pg_wal"
287287
results 'wal directory' "$(realpath "${postgres_data_directory}/pg_wal" ||:)"
288-
rm -f "${postgres_data_directory}/recovery.signal"
289288
- startup
290289
- "11"
291290
- /pgdata/pg11_wal

0 commit comments

Comments
 (0)