Skip to content

Commit 2a21cc4

Browse files
sdudoladovSergey Dudoladov
and
Sergey Dudoladov
authored
Compare Postgres pod priority on Sync (#1144)
* compare Postgres pod priority on Sync Co-authored-by: Sergey Dudoladov <[email protected]>
1 parent ab95eaa commit 2a21cc4

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ script:
2020
- hack/verify-codegen.sh
2121
- travis_wait 20 go test -race -covermode atomic -coverprofile=profile.cov ./pkg/... -v
2222
- goveralls -coverprofile=profile.cov -service=travis-ci -v
23-
- make e2e
23+
- travis_wait 20 make e2e

delivery.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ version: "2017-09-20"
22
pipeline:
33
- id: build-postgres-operator
44
type: script
5+
vm: large
6+
cache:
7+
paths:
8+
- /go/pkg/mod
59
commands:
610
- desc: 'Update'
711
cmd: |

manifests/configmap.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ data:
8585
pod_service_account_name: "postgres-pod"
8686
# pod_service_account_role_binding_definition: ""
8787
pod_terminate_grace_period: 5m
88+
# pod_priority_class_name: "postgres-pod-priority"
8889
# postgres_superuser_teams: "postgres_superusers"
8990
# protected_role_names: "admin"
9091
ready_wait_interval: 3s
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: scheduling.k8s.io/v1
2+
description: 'This priority class must be used only for databases controlled by the
3+
Postgres operator'
4+
kind: PriorityClass
5+
metadata:
6+
labels:
7+
application: postgres-operator
8+
name: postgres-pod-priority
9+
preemptionPolicy: PreemptLowerPriority
10+
globalDefault: false
11+
value: 1000000

pkg/cluster/cluster.go

+9
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,15 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa
459459
}
460460
}
461461

462+
// we assume any change in priority happens by rolling out a new priority class
463+
// changing the priority value in an existing class is not supproted
464+
if c.Statefulset.Spec.Template.Spec.PriorityClassName != statefulSet.Spec.Template.Spec.PriorityClassName {
465+
match = false
466+
needsReplace = true
467+
needsRollUpdate = true
468+
reasons = append(reasons, "new statefulset's pod priority class in spec doesn't match the current one")
469+
}
470+
462471
// lazy Spilo update: modify the image in the statefulset itself but let its pods run with the old image
463472
// until they are re-created for other reasons, for example node rotation
464473
if c.OpConfig.EnableLazySpiloUpgrade && !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.Containers[0].Image, statefulSet.Spec.Template.Spec.Containers[0].Image) {

0 commit comments

Comments
 (0)