Skip to content

Commit

Permalink
koordlet: add net qos plugin
Browse files Browse the repository at this point in the history
Signed-off-by: l1b0k <libokang.dev@gmail.com>
  • Loading branch information
l1b0k committed Feb 19, 2024
1 parent 7c7a844 commit 3fba523
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 2 deletions.
4 changes: 4 additions & 0 deletions apis/extension/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const (
// LabelPodMutatingUpdate is a label key that pods with `pod.koordinator.sh/mutating-update=true` will
// be mutated by Koordinator webhook when updating.
LabelPodMutatingUpdate = PodDomainPrefix + "/mutating-update"

// AnnotationNetworkQOS are used to set bandwidth for Pod. The unit is bps.
// For example, 10M means 10 megabits per second.
AnnotationNetworkQOS = DomainPrefix + "networkQOS"
)

type AggregationType string
Expand Down
12 changes: 12 additions & 0 deletions apis/slo/v1alpha1/nodeslo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ const (
CPUQOSPolicyCoreSched CPUQOSPolicy = "coreSched"
)

type NETQOSPolicy string

const (
// NETQOSPolicyTC indicates implement netqos by tc.
NETQOSPolicyTC NETQOSPolicy = "tc"
// NETQOSPolicyTerwayQos indicates implement netqos by terway-qos.
NETQOSPolicyTerwayQos NETQOSPolicy = "terway-qos"
)

// MemoryQOS enables memory qos features.
type MemoryQOS struct {
// memcg qos
Expand Down Expand Up @@ -243,6 +252,9 @@ type NetworkQOS struct {
type ResourceQOSPolicies struct {
// applied policy for the CPU QoS, default = "groupIdentity"
CPUPolicy *CPUQOSPolicy `json:"cpuPolicy,omitempty"`

// applied policy for the Net QoS, default = "tc"
NETQOSPolicy *NETQOSPolicy `json:"netQOSPolicy,omitempty"`
}

type ResourceQOSStrategy struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/slo/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions config/crd/bases/slo.koordinator.sh_nodeslos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@ spec:
cpuPolicy:
description: applied policy for the CPU QoS, default = "groupIdentity"
type: string
netQOSPolicy:
description: applied policy for the Net QoS, default = "tc"
type: string
type: object
systemClass:
description: ResourceQOS for system pods
Expand Down
8 changes: 8 additions & 0 deletions pkg/koordlet/runtimehooks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/cpuset"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/gpu"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/groupidentity"
"github.com/koordinator-sh/koordinator/pkg/koordlet/runtimehooks/hooks/terwayqos"
"github.com/koordinator-sh/koordinator/pkg/koordlet/util/system"
)

Expand Down Expand Up @@ -73,6 +74,11 @@ const (
// owner: @saintube @zwzhang0107
// alpha: v1.4
CoreSched featuregate.Feature = "CoreSched"

// TerwayQoS enables net QoS feature of koordlet.
// owner: @l1b0k
// alpha: v1.5
TerwayQoS featuregate.Feature = "TerwayQoS"
)

var (
Expand All @@ -83,6 +89,7 @@ var (
BatchResource: {Default: true, PreRelease: featuregate.Beta},
CPUNormalization: {Default: false, PreRelease: featuregate.Alpha},
CoreSched: {Default: false, PreRelease: featuregate.Alpha},
TerwayQoS: {Default: false, PreRelease: featuregate.Alpha},
}

runtimeHookPlugins = map[featuregate.Feature]HookPlugin{
Expand All @@ -92,6 +99,7 @@ var (
BatchResource: batchresource.Object(),
CPUNormalization: cpunormalization.Object(),
CoreSched: coresched.Object(),
TerwayQoS: terwayqos.Object(),
}
)

Expand Down
Loading

0 comments on commit 3fba523

Please sign in to comment.