Skip to content

Commit 9c18a2d

Browse files
nmarukovichhors
andauthored
K8SPG-725 add resources block to repoHost in CR (#1107)
* add resources to repoHost * add repoHost resources to the test --------- Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 12d7fc4 commit 9c18a2d

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

deploy/cr.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ spec:
383383
# repo3-path: /pgbackrest/postgres-operator/cluster1-multi-repo/repo3
384384
# repo4-path: /pgbackrest/postgres-operator/cluster1-multi-repo/repo4
385385
repoHost:
386+
# resources:
387+
# limits:
388+
# cpu: 200m
389+
# memory: 128Mi
386390
affinity:
387391
podAntiAffinity:
388392
preferredDuringSchedulingIgnoredDuringExecution:

e2e-tests/tests/init-deploy/01-assert.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,52 @@ metadata:
1717
name: init-deploy
1818
controller: true
1919
blockOwnerDeletion: true
20+
spec:
21+
serviceName: init-deploy-pods
22+
template:
23+
metadata:
24+
annotations:
25+
test-annotation: test
26+
spec:
27+
containers:
28+
- command:
29+
- pgbackrest
30+
- server
31+
name: pgbackrest
32+
resources:
33+
limits:
34+
cpu: 200m
35+
memory: 128Mi
36+
- command:
37+
- bash
38+
- -ceu
39+
- --
40+
- |-
41+
monitor() {
42+
exec {fd}<> <(:||:)
43+
until read -r -t 5 -u "${fd}"; do
44+
if
45+
[[ "${filename}" -nt "/proc/self/fd/${fd}" ]] &&
46+
pkill -HUP --exact --parent=0 pgbackrest
47+
then
48+
exec {fd}>&- && exec {fd}<> <(:||:)
49+
stat --dereference --format='Loaded configuration dated %y' "${filename}"
50+
elif
51+
{ [[ "${directory}" -nt "/proc/self/fd/${fd}" ]] ||
52+
[[ "${authority}" -nt "/proc/self/fd/${fd}" ]]
53+
} &&
54+
pkill -HUP --exact --parent=0 pgbackrest
55+
then
56+
exec {fd}>&- && exec {fd}<> <(:||:)
57+
stat --format='Loaded certificates dated %y' "${directory}"
58+
fi
59+
done
60+
}; export directory="$1" authority="$2" filename="$3"; export -f monitor; exec -a "$0" bash -ceu monitor
61+
- pgbackrest-config
62+
- /etc/pgbackrest/server
63+
- /etc/pgbackrest/conf.d/~postgres-operator/tls-ca.crt
64+
- /etc/pgbackrest/conf.d/~postgres-operator_server.conf
65+
name: pgbackrest-config
2066
status:
2167
observedGeneration: 1
2268
replicas: 1

e2e-tests/tests/init-deploy/01-create-cluster.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ commands:
1111
get_cr \
1212
| yq '.spec.metadata.labels.test-label = "test"' \
1313
| yq '.spec.metadata.annotations.test-annotation = "test"' \
14+
| yq '.spec.backups.pgbackrest.repoHost.resources.limits.cpu = "200m"' \
15+
| yq '.spec.backups.pgbackrest.repoHost.resources.limits.memory = "128Mi"' \
1416
| kubectl -n "${NAMESPACE}" apply -f -

0 commit comments

Comments
 (0)