Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base type, runtimecomponent type and utils with PriorityClassName #626

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/v1/runtimecomponent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ type RuntimeComponentSpec struct {

// +operator-sdk:csv:customresourcedefinitions:order=26,type=spec,displayName="Topology Spread Constraints"
TopologySpreadConstraints *RuntimeComponentTopologySpreadConstraints `json:"topologySpreadConstraints,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=27,type=spec,displayName="Priority Class Name"
PriorityClassName *string `json:"priorityClassName,omitempty"`
}

// Defines the topology spread constraints
Expand Down Expand Up @@ -703,6 +706,13 @@ func (cr *RuntimeComponent) GetDeployment() common.BaseComponentDeployment {
return cr.Spec.Deployment
}

func (cr *RuntimeComponent) GetPriorityClassName() *string {
if cr.Spec.PriorityClassName == nil {
return nil
}
return cr.Spec.PriorityClassName
}

// GetDeploymentStrategy returns deployment strategy struct
func (cr *RuntimeComponentDeployment) GetDeploymentUpdateStrategy() *appsv1.DeploymentStrategy {
return cr.UpdateStrategy
Expand Down
1 change: 1 addition & 0 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,5 @@ type BaseComponent interface {
GetTopologySpreadConstraints() BaseComponentTopologySpreadConstraints
GetSecurityContext() *corev1.SecurityContext
GetManageTLS() *bool
GetPriorityClassName() *string
}
6 changes: 6 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,12 @@ func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) {
}
}
pts.Spec.AutomountServiceAccountToken = &mount

if ba.GetPriorityClassName() != nil {
pts.Spec.PriorityClassName = *ba.GetPriorityClassName()
} else {
pts.Spec.PriorityClassName = ""
}
}

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