Skip to content

Commit 3c51430

Browse files
Jonathan S. Katzjkatz
authored andcommitted
Have pgBackRest and associated jobs respect cluster tolerations
pgBackRest is a close corollary to the PostgreSQL cluster itself and should respect similar tolerations to the PostgreSQL cluster. Future work could break out tolerations specific for pgBackRest, but given the two do need to work in concert, it is prudent to start with this approach. Issue: [ch10146]
1 parent b4059a3 commit 3c51430

File tree

18 files changed

+58
-22
lines changed

18 files changed

+58
-22
lines changed

cmd/pgo-scheduler/scheduler/policy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func (p PolicyJob) Run() {
142142
PGDatabase: p.database,
143143
PGSQLConfigMap: name,
144144
PGUserSecret: p.secret,
145+
Tolerations: util.GetTolerations(cluster.Spec.Tolerations),
145146
}
146147

147148
var doc bytes.Buffer

cmd/pgo-scheduler/scheduler/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ type PolicyTemplate struct {
7070
PGDatabase string
7171
PGUserSecret string
7272
PGSQLConfigMap string
73+
Tolerations string
7374
}

installers/ansible/roles/pgo-operator/files/pgo-configs/backrest-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
],
3030
"securityContext": {{.SecurityContext}},
3131
"serviceAccountName": "pgo-backrest",
32+
{{ if .Tolerations }}
33+
"tolerations": {{ .Tolerations }},
34+
{{ end }}
3235
"containers": [{
3336
"name": "backrest",
3437
"image": "{{.CCPImagePrefix}}/crunchy-pgbackrest:{{.CCPImageTag}}",

installers/ansible/roles/pgo-operator/files/pgo-configs/cluster-bootstrap-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"spec": {
2424
"securityContext": {{.SecurityContext}},
2525
"serviceAccountName": "pgo-pg",
26+
{{ if .Tolerations }}
27+
"tolerations": {{ .Tolerations }},
28+
{{ end }}
2629
"containers": [{
2730
"name": "database",
2831
"image": "{{.CCPImagePrefix}}/{{.CCPImage}}:{{.CCPImageTag}}",

installers/ansible/roles/pgo-operator/files/pgo-configs/pgdump-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
],
3232
"securityContext": {{.SecurityContext}},
3333
"serviceAccountName": "pgo-default",
34+
{{ if .Tolerations }}
35+
"tolerations": {{ .Tolerations }},
36+
{{ end }}
3437
"containers": [{
3538
"name": "pgdump",
3639
"image": "{{.CCPImagePrefix}}/crunchy-postgres-ha:{{.CCPImageTag}}",

installers/ansible/roles/pgo-operator/files/pgo-configs/pgo-backrest-repo-template.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"spec": {
4747
"securityContext": {{.SecurityContext}},
4848
"serviceAccountName": "pgo-default",
49+
{{ if .Tolerations }}
50+
"tolerations": {{ .Tolerations }},
51+
{{ end }}
4952
"containers": [{
5053
"name": "database",
5154
"image": "{{.CCPImagePrefix}}/crunchy-pgbackrest-repo:{{.CCPImageTag}}",

installers/ansible/roles/pgo-operator/files/pgo-configs/pgo.sqlrunner-template.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
},
2222
"spec": {
2323
"serviceAccountName": "pgo-default",
24+
{{ if .Tolerations }}
25+
"tolerations": {{ .Tolerations }},
26+
{{ end }}
2427
"containers": [
2528
{
2629
"name": "sqlrunner",

installers/ansible/roles/pgo-operator/files/pgo-configs/pgrestore-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
],
3232
"securityContext": {{.SecurityContext}},
3333
"serviceAccountName": "pgo-default",
34+
{{ if .Tolerations }}
35+
"tolerations": {{ .Tolerations }},
36+
{{ end }}
3437
"containers": [
3538
{
3639
"name": "pgrestore",

installers/ansible/roles/pgo-operator/files/pgo-configs/rmdata-job.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
},
2222
"spec": {
2323
"serviceAccountName": "pgo-target",
24+
{{ if .Tolerations }}
25+
"tolerations": {{ .Tolerations }},
26+
{{ end }}
2427
"containers": [{
2528
"name": "rmdata",
2629
"image": "{{.PGOImagePrefix}}/pgo-rmdata:{{.PGOImageTag}}",

internal/config/labels.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const (
6060
LABEL_DELETE_BACKUPS = "delete-backups"
6161
LABEL_IS_REPLICA = "is-replica"
6262
LABEL_IS_BACKUP = "is-backup"
63+
LABEL_RM_TOLERATIONS = "rmdata-tolerations"
6364
LABEL_STARTUP = "startup"
6465
LABEL_SHUTDOWN = "shutdown"
6566
)

0 commit comments

Comments
 (0)