Skip to content

Commit

Permalink
refactor kcnr custom node taint
Browse files Browse the repository at this point in the history
  • Loading branch information
luomingmeng committed Dec 3, 2024
1 parent ae613a8 commit 0958576
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,41 @@ spec:
type: object
type: array
taints:
description: customized taint for katalyst, which may affect partial
tasks
description: Taints customized taints for katalyst, which affect pod
scheduling based on their QoS levels and the specified taint's QoS
level.
items:
description: Taint wraps standard Kubernetes Taint with QoSLevel.
properties:
effect:
description: Required. The effect of the taint on pods that
do not tolerate the taint. Valid effects are NoScheduleForReclaimedTasks.
do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule
and NoExecute.
type: string
key:
description: Required. The taint key to be applied to a node.
type: string
qosLevel:
description: QoSLevel specifies the QoS level of pods that this
taint applies to.
enum:
- reclaimed_cores
- shared_cores
- dedicated_cores
- system_cores
type: string
timeAdded:
description: TimeAdded represents the time at which the taint
was added. It is only written for NoExecute taints.
format: date-time
type: string
value:
description: Required. The taint value corresponding to the
taint key.
description: The taint value corresponding to the taint key.
type: string
required:
- effect
- key
- qosLevel
type: object
type: array
type: object
Expand Down
34 changes: 12 additions & 22 deletions pkg/apis/node/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/kubewharf/katalyst-api/pkg/consts"
)

// +genclient
Expand Down Expand Up @@ -49,33 +51,21 @@ type CustomNodeResourceSpec struct {
// +optional
NodeResourceProperties []*Property `json:"nodeResourceProperties,omitempty"`

// customized taint for katalyst, which may affect partial tasks
// Taints customized taint for katalyst, which affect pod scheduling
// based on their QoS levels and the specified taint's QoS level.
// +optional
Taints []*Taint `json:"taints,omitempty"`
Taints []Taint `json:"taints,omitempty"`
}

// Taint wraps standard Kubernetes Taint with QoSLevel.
type Taint struct {
// Required. The taint key to be applied to a node.
Key string `json:"key,omitempty"`
// Required. The taint value corresponding to the taint key.
// +optional
Value string `json:"value,omitempty"`
// Required. The effect of the taint on pods
// that do not tolerate the taint.
// Valid effects are NoScheduleForReclaimedTasks.
Effect TaintEffect `json:"effect,omitempty"`
}
// Taint is standard Kubernetes Taint
v1.Taint `json:",inline"`

type TaintEffect string

const (
// TaintEffectNoScheduleForReclaimedTasks
// Do not allow new pods using reclaimed resources to schedule onto the node unless they tolerate the taint,
// but allow all pods submitted to Kubelet without going through the scheduler
// to start, and allow all already-running pods to continue running.
// Enforced by the scheduler.
TaintEffectNoScheduleForReclaimedTasks TaintEffect = "NoScheduleForReclaimedTasks"
)
// QoSLevel specifies the QoS level of pods that this taint applies to.
// +kubebuilder:validation:Enum=reclaimed_cores;shared_cores;dedicated_cores;system_cores
QoSLevel consts.QoSLevel `json:"qosLevel"`
}

type Property struct {
// property name
Expand Down
9 changes: 3 additions & 6 deletions pkg/apis/node/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0958576

Please sign in to comment.