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 18, 2024
1 parent 7c7a844 commit d8d35d6
Show file tree
Hide file tree
Showing 10 changed files with 630 additions and 0 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
2 changes: 2 additions & 0 deletions apis/slo/v1alpha1/nodeslo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ type NetworkQOS struct {
type ResourceQOSPolicies struct {
// applied policy for the CPU QoS, default = "groupIdentity"
CPUPolicy *CPUQOSPolicy `json:"cpuPolicy,omitempty"`

NetworkQOS *NetworkQOSCfg `json:"networkQOS,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.

53 changes: 53 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,59 @@ spec:
cpuPolicy:
description: applied policy for the CPU QoS, default = "groupIdentity"
type: string
networkQOS:
properties:
egressLimit:
anyOf:
- type: integer
- type: string
default: 100
description: 'EgressLimit describes the maximum network
bandwidth can be used in the egress direction, unit:
bps(bytes per second), two expressions are supported,int
and string, int: percentage based on total bandwidth,valid
in 0-100 string: a specific network bandwidth value,
eg: 50M.'
x-kubernetes-int-or-string: true
egressRequest:
anyOf:
- type: integer
- type: string
default: 0
description: 'EgressRequest describes the minimum network
bandwidth guaranteed in the egress direction. unit:
bps(bytes per second), two expressions are supported,int
and string, int: percentage based on total bandwidth,valid
in 0-100 string: a specific network bandwidth value,
eg: 50M.'
x-kubernetes-int-or-string: true
enable:
type: boolean
ingressLimit:
anyOf:
- type: integer
- type: string
default: 100
description: 'IngressLimit describes the maximum network
bandwidth can be used in the ingress direction, unit:
bps(bytes per second), two expressions are supported,int
and string, int: percentage based on total bandwidth,valid
in 0-100 string: a specific network bandwidth value,
eg: 50M.'
x-kubernetes-int-or-string: true
ingressRequest:
anyOf:
- type: integer
- type: string
default: 0
description: 'IngressRequest describes the minimum network
bandwidth guaranteed in the ingress direction. unit:
bps(bytes per second), two expressions are supported,int
and string, int: percentage based on total bandwidth,valid
in 0-100 string: a specific network bandwidth value,
eg: 50M.'
x-kubernetes-int-or-string: true
type: object
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 d8d35d6

Please sign in to comment.