@@ -565,104 +565,14 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
565565 readOnly: true
566566- name: other
567567 resources: {}
568- - command:
569- - pgbackrest
570- - server
571- livenessProbe:
572- exec:
573- command:
574- - pgbackrest
575- - server-ping
576- name: pgbackrest
577- resources: {}
578- securityContext:
579- allowPrivilegeEscalation: false
580- capabilities:
581- drop:
582- - ALL
583- privileged: false
584- readOnlyRootFilesystem: true
585- runAsNonRoot: true
586- seccompProfile:
587- type: RuntimeDefault
588- volumeMounts:
589- - mountPath: /etc/pgbackrest/server
590- name: pgbackrest-server
591- readOnly: true
592- - mountPath: /pgdata
593- name: postgres-data
594- - mountPath: /pgwal
595- name: postgres-wal
596- - mountPath: /etc/pgbackrest/conf.d
597- name: pgbackrest-config
598- readOnly: true
599- - command:
600- - bash
601- - -ceu
602- - --
603- - |-
604- monitor() {
605- exec {fd}<> <(:||:)
606- until read -r -t 5 -u "${fd}"; do
607- if
608- [[ "${filename}" -nt "/proc/self/fd/${fd}" ]] &&
609- pkill -HUP --exact --parent=0 pgbackrest
610- then
611- exec {fd}>&- && exec {fd}<> <(:||:)
612- stat --dereference --format='Loaded configuration dated %y' "${filename}"
613- elif
614- { [[ "${directory}" -nt "/proc/self/fd/${fd}" ]] ||
615- [[ "${authority}" -nt "/proc/self/fd/${fd}" ]]
616- } &&
617- pkill -HUP --exact --parent=0 pgbackrest
618- then
619- exec {fd}>&- && exec {fd}<> <(:||:)
620- stat --format='Loaded certificates dated %y' "${directory}"
621- fi
622- done
623- }; export directory="$1" authority="$2" filename="$3"; export -f monitor; exec -a "$0" bash -ceu monitor
624- - pgbackrest-config
625- - /etc/pgbackrest/server
626- - /etc/pgbackrest/conf.d/~postgres-operator/tls-ca.crt
627- - /etc/pgbackrest/conf.d/~postgres-operator_server.conf
628- name: pgbackrest-config
629- resources: {}
630- securityContext:
631- allowPrivilegeEscalation: false
632- capabilities:
633- drop:
634- - ALL
635- privileged: false
636- readOnlyRootFilesystem: true
637- runAsNonRoot: true
638- seccompProfile:
639- type: RuntimeDefault
640- volumeMounts:
641- - mountPath: /etc/pgbackrest/server
642- name: pgbackrest-server
643- readOnly: true
644- - mountPath: /etc/pgbackrest/conf.d
645- name: pgbackrest-config
646- readOnly: true
647568` ))
648569
649- // Instance configuration files with certificates.
570+ // Instance configuration files but no certificates.
650571// Other volumes are ignored.
651572assert .Assert (t , cmp .MarshalMatches (out .Volumes , `
652573- name: other
653574- name: postgres-data
654575- name: postgres-wal
655- - name: pgbackrest-server
656- projected:
657- sources:
658- - secret:
659- items:
660- - key: pgbackrest-server.crt
661- path: server-tls.crt
662- - key: pgbackrest-server.key
663- mode: 384
664- path: server-tls.key
665- name: some-secret
666576- name: pgbackrest-config
667577 projected:
668578 sources:
@@ -672,19 +582,7 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
672582 path: pgbackrest_instance.conf
673583 - key: config-hash
674584 path: config-hash
675- - key: pgbackrest-server.conf
676- path: ~postgres-operator_server.conf
677585 name: hippo-pgbackrest-config
678- - secret:
679- items:
680- - key: pgbackrest.ca-roots
681- path: ~postgres-operator/tls-ca.crt
682- - key: pgbackrest-client.crt
683- path: ~postgres-operator/client-tls.crt
684- - key: pgbackrest-client.key
685- mode: 384
686- path: ~postgres-operator/client-tls.key
687- name: hippo-pgbackrest
688586` ))
689587})
690588
@@ -733,6 +631,7 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
733631 mode: 384
734632 path: ~postgres-operator/client-tls.key
735633 name: hippo-pgbackrest
634+ optional: true
736635` ))
737636}
738637
0 commit comments