Skip to content

Commit 572f3f6

Browse files
authored
Add priorityClassName as an optional configuration (#1105)
* Add priorityClassName as an optional configuration * Edit CHANGELOG.md for the priorityClassName configuration * Reformat the /install/crds.yaml file for the priorityClassName field * Reformat the /config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml file for the priorityClassName field
1 parent aebe394 commit 572f3f6

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
# [Unreleased](https://github.com/cockroachdb/cockroach-operator/compare/v2.18.1...master)
9+
* Added the priorityClassName configuration
910

1011
# [v2.18.1](https://github.com/cockroachdb/cockroach-operator/compare/v2.18.0...v2.18.1)
1112
* Added support for openshift 4.19

apis/v1alpha1/cluster_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ type CrdbClusterSpec struct {
9999
// Default: ""
100100
// +optional
101101
CockroachDBVersion string `json:"cockroachDBVersion,omitempty"`
102+
// (Optional) PriorityClassName sets the priority class of pods
103+
// Default: ""
104+
// +optional
105+
PriorityClassName string `json:"priorityClassName,omitempty"`
102106
// (Optional) PodEnvVariables is a slice of environment variables that are added to the pods
103107
// Default: (empty list)
104108
// +optional

config/crd/bases/crdb.cockroachlabs.com_crdbclusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,10 @@ spec:
13621362
- name
13631363
type: object
13641364
type: array
1365+
priorityClassName:
1366+
description: '(Optional) PriorityClassName sets the priority class
1367+
of pods Default: ""'
1368+
type: string
13651369
resources:
13661370
description: '(Optional) Database container resource limits. Any container
13671371
limits can be specified. Default: (not specified)'

install/crds.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,10 @@ spec:
13601360
- name
13611361
type: object
13621362
type: array
1363+
priorityClassName:
1364+
description: '(Optional) PriorityClassName sets the priority class
1365+
of pods Default: ""'
1366+
type: string
13631367
resources:
13641368
description: '(Optional) Database container resource limits. Any container
13651369
limits can be specified. Default: (not specified)'

pkg/resource/job.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ func (b JobBuilder) buildPodTemplate() corev1.PodTemplateSpec {
121121
pod.Spec.ImagePullSecrets = []corev1.LocalObjectReference{local}
122122
}
123123

124+
if b.Spec().PriorityClassName != "" {
125+
pod.Spec.PriorityClassName = b.Spec().PriorityClassName
126+
}
127+
124128
return pod
125129
}
126130

pkg/resource/statefulset.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ func (b StatefulSetBuilder) makePodTemplate() corev1.PodTemplateSpec {
245245
pod.Spec.ImagePullSecrets = []corev1.LocalObjectReference{local}
246246
}
247247

248+
if b.Spec().PriorityClassName != "" {
249+
pod.Spec.PriorityClassName = b.Spec().PriorityClassName
250+
}
251+
248252
return pod
249253
}
250254

0 commit comments

Comments
 (0)