Skip to content

Commit ca071ee

Browse files
committed
Add PriorityClassName to RC types, CustomizePodSpec, and BaseComponent interface
Added getter
1 parent 16a098a commit ca071ee

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
@@ -163,6 +163,10 @@ type RuntimeComponentSpec struct {
163163
// DNS settings for the pod.
164164
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="DNS"
165165
DNS *RuntimeComponentDNS `json:"dns,omitempty"`
166+
167+
// Name of the PriorityClass for the pod.
168+
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Priority Class Name"
169+
PriorityClassName *string `json:"priorityClassName,omitempty"`
166170
}
167171

168172
// Defines the DNS
@@ -1072,6 +1076,10 @@ func (cr *RuntimeComponentTopologySpreadConstraints) GetDisableOperatorDefaults(
10721076
return cr.DisableOperatorDefaults
10731077
}
10741078

1079+
func (cr *RuntimeComponent) GetPriorityClassName() *string {
1080+
return cr.Spec.PriorityClassName
1081+
}
1082+
10751083
// Initialize the RuntimeComponent instance
10761084
func (cr *RuntimeComponent) Initialize() {
10771085
if cr.Spec.PullPolicy == nil {

common/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,5 @@ type BaseComponent interface {
260260
GetDisableServiceLinks() *bool
261261
GetTolerations() []corev1.Toleration
262262
GetDNS() BaseComponentDNS
263+
GetPriorityClassName() *string
263264
}

utils/utils.go

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

787787
pts.Spec.Tolerations = ba.GetTolerations()
788+
789+
if ba.GetPriorityClassName() != nil {
790+
pts.Spec.PriorityClassName = *ba.GetPriorityClassName()
791+
}
788792
}
789793

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

0 commit comments

Comments
 (0)