Skip to content

Commit cad965e

Browse files
committed
Remove permanent dedicated repo host and make archiving to cloud repos go through pg instance. This essentially reverts commit cfa2839.
Clean up some markdown files. Add test case for pgbackrest conf files when cloud repo present but no dedicated repo host present.
1 parent c420aef commit cad965e

File tree

14 files changed

+361
-259
lines changed

14 files changed

+361
-259
lines changed

internal/controller/postgrescluster/instance.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,10 @@ func addPGBackRestToInstancePodSpec(
13701370
ctx context.Context, cluster *v1beta1.PostgresCluster,
13711371
instanceCertificates *corev1.Secret, instancePod *corev1.PodSpec,
13721372
) {
1373-
pgbackrest.AddServerToInstancePod(ctx, cluster, instancePod,
1374-
instanceCertificates.Name)
1373+
if pgbackrest.RepoHostVolumeDefined(cluster) {
1374+
pgbackrest.AddServerToInstancePod(ctx, cluster, instancePod,
1375+
instanceCertificates.Name)
1376+
}
13751377

13761378
pgbackrest.AddConfigToInstancePod(cluster, instancePod)
13771379
}

internal/controller/postgrescluster/instance_test.go

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -567,104 +567,14 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
567567
readOnly: true
568568
- name: other
569569
resources: {}
570-
- command:
571-
- pgbackrest
572-
- server
573-
livenessProbe:
574-
exec:
575-
command:
576-
- pgbackrest
577-
- server-ping
578-
name: pgbackrest
579-
resources: {}
580-
securityContext:
581-
allowPrivilegeEscalation: false
582-
capabilities:
583-
drop:
584-
- ALL
585-
privileged: false
586-
readOnlyRootFilesystem: true
587-
runAsNonRoot: true
588-
seccompProfile:
589-
type: RuntimeDefault
590-
volumeMounts:
591-
- mountPath: /etc/pgbackrest/server
592-
name: pgbackrest-server
593-
readOnly: true
594-
- mountPath: /pgdata
595-
name: postgres-data
596-
- mountPath: /pgwal
597-
name: postgres-wal
598-
- mountPath: /etc/pgbackrest/conf.d
599-
name: pgbackrest-config
600-
readOnly: true
601-
- command:
602-
- bash
603-
- -ceu
604-
- --
605-
- |-
606-
monitor() {
607-
exec {fd}<> <(:||:)
608-
until read -r -t 5 -u "${fd}"; do
609-
if
610-
[[ "${filename}" -nt "/proc/self/fd/${fd}" ]] &&
611-
pkill -HUP --exact --parent=0 pgbackrest
612-
then
613-
exec {fd}>&- && exec {fd}<> <(:||:)
614-
stat --dereference --format='Loaded configuration dated %y' "${filename}"
615-
elif
616-
{ [[ "${directory}" -nt "/proc/self/fd/${fd}" ]] ||
617-
[[ "${authority}" -nt "/proc/self/fd/${fd}" ]]
618-
} &&
619-
pkill -HUP --exact --parent=0 pgbackrest
620-
then
621-
exec {fd}>&- && exec {fd}<> <(:||:)
622-
stat --format='Loaded certificates dated %y' "${directory}"
623-
fi
624-
done
625-
}; export directory="$1" authority="$2" filename="$3"; export -f monitor; exec -a "$0" bash -ceu monitor
626-
- pgbackrest-config
627-
- /etc/pgbackrest/server
628-
- /etc/pgbackrest/conf.d/~postgres-operator/tls-ca.crt
629-
- /etc/pgbackrest/conf.d/~postgres-operator_server.conf
630-
name: pgbackrest-config
631-
resources: {}
632-
securityContext:
633-
allowPrivilegeEscalation: false
634-
capabilities:
635-
drop:
636-
- ALL
637-
privileged: false
638-
readOnlyRootFilesystem: true
639-
runAsNonRoot: true
640-
seccompProfile:
641-
type: RuntimeDefault
642-
volumeMounts:
643-
- mountPath: /etc/pgbackrest/server
644-
name: pgbackrest-server
645-
readOnly: true
646-
- mountPath: /etc/pgbackrest/conf.d
647-
name: pgbackrest-config
648-
readOnly: true
649570
`))
650571

651-
// Instance configuration files with certificates.
572+
// Instance configuration files but no certificates.
652573
// Other volumes are ignored.
653574
assert.Assert(t, cmp.MarshalMatches(out.Volumes, `
654575
- name: other
655576
- name: postgres-data
656577
- name: postgres-wal
657-
- name: pgbackrest-server
658-
projected:
659-
sources:
660-
- secret:
661-
items:
662-
- key: pgbackrest-server.crt
663-
path: server-tls.crt
664-
- key: pgbackrest-server.key
665-
mode: 384
666-
path: server-tls.key
667-
name: some-secret
668578
- name: pgbackrest-config
669579
projected:
670580
sources:
@@ -674,19 +584,7 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
674584
path: pgbackrest_instance.conf
675585
- key: config-hash
676586
path: config-hash
677-
- key: pgbackrest-server.conf
678-
path: ~postgres-operator_server.conf
679587
name: hippo-pgbackrest-config
680-
- secret:
681-
items:
682-
- key: pgbackrest.ca-roots
683-
path: ~postgres-operator/tls-ca.crt
684-
- key: pgbackrest-client.crt
685-
path: ~postgres-operator/client-tls.crt
686-
- key: pgbackrest-client.key
687-
mode: 384
688-
path: ~postgres-operator/client-tls.key
689-
name: hippo-pgbackrest
690588
`))
691589
})
692590

@@ -735,6 +633,7 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
735633
mode: 384
736634
path: ~postgres-operator/client-tls.key
737635
name: hippo-pgbackrest
636+
optional: true
738637
`))
739638
}
740639

0 commit comments

Comments
 (0)