Skip to content

Commit

Permalink
feat: support cpu provision of aqc
Browse files Browse the repository at this point in the history
Signed-off-by: linzhecheng <[email protected]>
  • Loading branch information
cheney-lin committed Jul 1, 2024
1 parent de2f4ec commit 1dec52f
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,67 @@ spec:
to ensure that shared_cores pods can suppress and preempt
reclaimed_cores pods.
type: boolean
cpuProvisionConfig:
description: optional
properties:
constraints:
items:
properties:
name:
description: ControlKnobName defines available
control knob key for provision policy
type: string
restrictControlKnobMaxLowerGap:
description: RestrictControlKnobMaxUpperGap
is the maximum downward offset value from
the baseline
type: number
restrictControlKnobMaxLowerGapRatio:
description: RestrictControlKnobMaxUpperGap
is the maximum downward offset ratio from
the baseline
type: number
restrictControlKnobMaxUpperGap:
description: RestrictControlKnobMaxUpperGap
is the maximum upward offset value from the
baseline
type: number
restrictControlKnobMaxUpperGapRatio:
description: RestrictControlKnobMaxUpperGap
is the maximum upward offset ratio from the
baseline
type: number
required:
- name
type: object
type: array
indicatorTargets:
items:
properties:
regionType:
description: QoSRegionType declares pre-defined
region types
type: string
targets:
items:
properties:
name:
type: string
target:
type: number
required:
- name
- target
type: object
type: array
required:
- regionType
- targets
type: object
type: array
type: object
required:
- cpuProvisionConfig
type: object
memoryAdvisorConfig:
properties:
Expand Down
32 changes: 32 additions & 0 deletions pkg/apis/config/v1alpha1/adminqos.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/apis/workload/v1alpha1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -131,6 +133,36 @@ type CPUAdvisorConfig struct {
// we will rely on kernel features to ensure that shared_cores pods can suppress and preempt reclaimed_cores pods.
// +optional
AllowSharedCoresOverlapReclaimedCores *bool `json:"allowSharedCoresOverlapReclaimedCores,omitempty"`

// optional
CPUProvisionConfig *CPUProvisionConfig `json:"cpuProvisionConfig"`
}

type RegionIndicators struct {
regionType v1alpha1.QoSRegionType `json:"regionType"`
Targets []IndicatorTargetConfiguration `json:"targets"`
}

type IndicatorTargetConfiguration struct {
Name v1alpha1.ServiceSystemIndicatorName `json:"name"`
Target float64 `json:"target"`
}

type ControlKnobConstraints struct {
Name v1alpha1.ControlKnobName `json:"name"`
// RestrictControlKnobMaxUpperGap is the maximum upward offset value from the baseline
RestrictControlKnobMaxUpperGap *float64 `json:"restrictControlKnobMaxUpperGap,omitempty"`
// RestrictControlKnobMaxUpperGap is the maximum downward offset value from the baseline
RestrictControlKnobMaxLowerGap *float64 `json:"restrictControlKnobMaxLowerGap,omitempty"`
// RestrictControlKnobMaxUpperGap is the maximum upward offset ratio from the baseline
RestrictControlKnobMaxUpperGapRatio *float64 `json:"restrictControlKnobMaxUpperGapRatio,omitempty"`
// RestrictControlKnobMaxUpperGap is the maximum downward offset ratio from the baseline
RestrictControlKnobMaxLowerGapRatio *float64 `json:"restrictControlKnobMaxLowerGapRatio,omitempty"`
}

type CPUProvisionConfig struct {
RegionIndicators []RegionIndicators `json:"indicatorTargets,omitempty"`
Constraints []ControlKnobConstraints `json:"constraints,omitempty"`
}

type MemoryAdvisorConfig struct {
Expand Down
108 changes: 108 additions & 0 deletions pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

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

29 changes: 29 additions & 0 deletions pkg/apis/workload/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,32 @@ type TestExtendedIndicators struct {
type TestIndicators struct {
TestIndicator string `json:"testIndicator"`
}

// QoSRegionType declares pre-defined region types
type QoSRegionType string

const (
// QoSRegionTypeShare for each share pool
QoSRegionTypeShare QoSRegionType = "share"

// QoSRegionTypeIsolation for each isolation pool
QoSRegionTypeIsolation QoSRegionType = "isolation"

// QoSRegionTypeDedicatedNumaExclusive for each dedicated core with numa binding
// and numa exclusive container
QoSRegionTypeDedicatedNumaExclusive QoSRegionType = "dedicated-numa-exclusive"
)

// ControlKnobName defines available control knob key for provision policy
type ControlKnobName string

const (
// ControlKnobNonReclaimedCPURequirement refers to cpu requirement of non-reclaimed workloads, like shared_cores and dedicated_cores
ControlKnobNonReclaimedCPURequirement ControlKnobName = "non-reclaimed-cpu-requirement"

// ControlKnobNonReclaimedCPURequirementUpper refers to the upper cpu size, for isolated pods now
ControlKnobNonReclaimedCPURequirementUpper ControlKnobName = "non-reclaimed-cpu-requirement-upper"

// ControlKnobNonReclaimedCPURequirementLower refers to the lower cpu size, for isolated pods now
ControlKnobNonReclaimedCPURequirementLower ControlKnobName = "non-reclaimed-cpu-requirement-lower"
)
14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

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

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

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

0 comments on commit 1dec52f

Please sign in to comment.