Skip to content

Commit 01a4a14

Browse files
authored
Merge pull request #7 from radondb/develop-pod-PriorityClass
[add]add pod PriorityClass, set default is system-cluster-critical
2 parents 4e8c9ff + 64b1cf1 commit 01a4a14

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

platforms/kubernetes/postgres-operator/deploy/postgresql.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ spec:
4747
- enable_seqscan=on
4848
podspec:
4949
terminationGracePeriodSeconds: 60
50+
# priorityClassName: high-priority
5051
containers:
5152
- image: radondb-postgresql:12.12-v1.0.0
5253
imagePullPolicy: IfNotPresent

platforms/kubernetes/postgres-operator/postgres/constants.py

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
SPEC_ANTIAFFINITY_PODANTIAFFINITYTERM = "podAntiAffinityTerm"
122122
SPEC_ANTIAFFINITY_TOPOLOGYKEY = "topologyKey"
123123

124+
# pod PriorityClass
125+
SPEC_POD_PRIORITY_CLASS = "priorityClassName"
126+
SPEC_POD_PRIORITY_CLASS_SCOPE_NODE = "system-node-critical"
127+
SPEC_POD_PRIORITY_CLASS_SCOPE_CLUSTER = "system-cluster-critical"
128+
124129
# time
125130
SECONDS = 1
126131
MINUTES = SECONDS * 60

platforms/kubernetes/postgres-operator/postgres/handle.py

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@
137137
MINUTES,
138138
HOURS,
139139
DAYS,
140+
SPEC_POD_PRIORITY_CLASS,
141+
SPEC_POD_PRIORITY_CLASS_SCOPE_NODE,
142+
SPEC_POD_PRIORITY_CLASS_SCOPE_CLUSTER,
140143
)
141144

142145
PRIMARY_FORMATION = " --formation primary "
@@ -619,6 +622,8 @@ def create_statefulset(
619622
"serviceName"] = statefulset_name_get_service_name(name)
620623
podspec = podspec_need_copy.copy()
621624
podspec["restartPolicy"] = "Always"
625+
podspec.setdefault(SPEC_POD_PRIORITY_CLASS,
626+
SPEC_POD_PRIORITY_CLASS_SCOPE_CLUSTER)
622627
antiaffinity = antiaffinity_need_copy.copy()
623628
is_required = antiaffinity[
624629
SPEC_ANTIAFFINITY_POLICY] == SPEC_ANTIAFFINITY_REQUIRED

0 commit comments

Comments
 (0)