Skip to content

Commit

Permalink
koord-manager: support manually configured default cpu normalization …
Browse files Browse the repository at this point in the history
…settings

In some dedicated clusters, we don't need complex CPU models;
instead, we prefer manually configured default CPU normalization settings for greater flexibility.

Signed-off-by: yangfeiyu <yangfeiyu20102011@163.com>
  • Loading branch information
yangfeiyu20102011 authored and yangfeiyu committed Jul 9, 2024
1 parent 448015c commit 74ef689
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apis/configuration/slo_controller_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ type CPUNormalizationStrategy struct {
// Enable defines whether the cpu normalization is enabled.
// If set to false, the node cpu normalization ratio will be removed.
Enable *bool `json:"enable,omitempty"`
// DefaultRatio defines the default cpu normalization.
DefaultRatio *float64 `json:"defaultRatio,omitempty"`
// RatioModel defines the cpu normalization ratio of each CPU model.
// It maps the CPUModel of BasicInfo into the ratios.
RatioModel map[string]ModelRatioCfg `json:"ratioModel,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions apis/configuration/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,14 @@ func (p *Plugin) Calculate(_ *configuration.ColocationStrategy, node *corev1.Nod

ratio, err := getCPUNormalizationRatioFromModel(basicInfo, strategy)
if err != nil {
return nil, fmt.Errorf("failed to get ratio in cpu normalization calculation, err: %s", err)
if strategy.DefaultRatio != nil {
klog.V(6).Infof("get no cpu ratio from model, use the default ratio %v for node %s", *strategy.DefaultRatio, node.Name)
ratio = *strategy.DefaultRatio
} else {
return nil, fmt.Errorf("failed to get ratio in cpu normalization calculation, err: %s", err)
}
}

if err = isCPUNormalizationRatioValid(ratio); err != nil {
return nil, fmt.Errorf("failed to validate ratio in cpu normalization calculation, ratio %v, err: %s", ratio, err)
}
Expand Down

0 comments on commit 74ef689

Please sign in to comment.