Skip to content

Commit 00672a7

Browse files
committed
Add PriorityClassName to RC types, CustomizePodSpec, and BaseComponent interface
Added getter
1 parent 27cdcb5 commit 00672a7

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

api/v1/runtimecomponent_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ type RuntimeComponentSpec struct {
168168
// The list of hostnames and IPs that will be injected into the application pod's hosts file
169169
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Host Aliases"
170170
HostAliases *[]corev1.HostAlias `json:"hostAliases,omitempty"`
171+
172+
// Name of the PriorityClass for the pod.
173+
// +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Priority Class Name"
174+
PriorityClassName *string `json:"priorityClassName,omitempty"`
171175
}
172176

173177
// Defines the DNS
@@ -1107,6 +1111,10 @@ func (cr *RuntimeComponent) GetHostAliases() *[]corev1.HostAlias {
11071111
return cr.Spec.HostAliases
11081112
}
11091113

1114+
func (cr *RuntimeComponent) GetPriorityClassName() *string {
1115+
return cr.Spec.PriorityClassName
1116+
}
1117+
11101118
// Initialize the RuntimeComponent instance
11111119
func (cr *RuntimeComponent) Initialize() {
11121120
if cr.Spec.PullPolicy == nil {

common/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ type BaseComponent interface {
264264
GetDNS() BaseComponentDNS
265265
GetDisableTopologyRouting() *bool
266266
GetHostAliases() *[]corev1.HostAlias
267+
GetPriorityClassName() *string
267268
}

utils/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,10 @@ func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) {
767767
}
768768

769769
pts.Spec.Tolerations = ba.GetTolerations()
770+
771+
if ba.GetPriorityClassName() != nil {
772+
pts.Spec.PriorityClassName = *ba.GetPriorityClassName()
773+
}
770774
}
771775

772776
// Initialize an empty TopologySpreadConstraints list and optionally prefers scheduling across zones/hosts for pods with podMatchLabels

0 commit comments

Comments
 (0)