minimizepower

package
v1.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScoreError int64 = math.MaxInt64
	ScoreMax   int64 = math.MaxInt64 >> 1
)
View Source
const (
	DefaultMetricsCacheTTL            = 30 * time.Second
	DefaultPredictorCacheTTL          = 30 * time.Minute
	DefaultPodUsageAssumption float64 = 0.5
	DefaultCPUUsageFormat             = CPUUsageFormatRaw
)
View Source
const (
	CPUUsageFormatRaw     string = "Raw"
	CPUUsageFormatPercent string = "Percent"
)

Variables

View Source
var (
	Name = "MinimizePower"

	ReasonResourceRequest = "at least one container in the pod must have a requests.cpu or limits.cpu set"
)
View Source
var (
	SchemeGroupVersionV1Internal = schema.GroupVersion{Group: schedconfig.GroupName, Version: runtime.APIVersionInternal}
	SchemeGroupVersionV1B2       = schema.GroupVersion{Group: schedconfig.GroupName, Version: "v1beta2"}
	SchemeGroupVersionV1B3       = schema.GroupVersion{Group: schedconfig.GroupName, Version: "v1beta3"}
	SchemeGroupVersionV1         = schema.GroupVersion{Group: schedconfig.GroupName, Version: "v1"}
)

register all kubescheduler.config.k8s.io APIs

View Source
var (
	AddToScheme = localSchemeBuilder.AddToScheme
)
View Source
var (
	// ScoreBase is the base score for all nodes.
	// This is the lowest score except for special scores (will be replaced to 0,1,...,<ScoreBase)
	ScoreBase int64 = 20
)
View Source
var (
	// ScoreReplaceMap are scores that have special meanings.
	// NormalizeScore will replace them with the mapped values (should be less than ScoreBase).
	ScoreReplaceMap = map[int64]int64{
		ScoreError: 0,
		ScoreMax:   1,
	}
)

Functions

func New

New initializes a new plugin and returns it.

func PodCPURequestOrLimit

func PodCPURequestOrLimit(pod *corev1.Pod) (v float64)

func PowerConsumptions2Scores

func PowerConsumptions2Scores(scores framework.NodeScoreList, baseScore int64, replaceMap map[int64]int64)

Types

type MinimizePower

type MinimizePower struct {
	// contains filtered or unexported fields
}

func (*MinimizePower) Name

func (*MinimizePower) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*MinimizePower) NormalizeScore

func (*MinimizePower) PreFilter

PreFilter rejects a pod if it does not have at least one container that has a CPU request or limit set.

func (*MinimizePower) PreFilterExtensions

func (pl *MinimizePower) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns nil as this plugin does not have PreFilterExtensions.

func (*MinimizePower) Score

func (pl *MinimizePower) Score(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string) (int64, *framework.Status)

Score returns how many watts will be increased by the given pod (lower is better).

This function never returns an error (as errors cause the pod to be rejected). If an error occurs, it is logged and the score is set to ScoreError(math.MaxInt64).

func (*MinimizePower) ScoreExtensions

func (pl *MinimizePower) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions returns a ScoreExtensions interface.

type MinimizePowerArgs

type MinimizePowerArgs struct {
	metav1.TypeMeta `json:",inline"`

	MetricsCacheTTL   metav1.Duration `json:"metricsCacheTTL,omitempty"`
	PredictorCacheTTL metav1.Duration `json:"predictorCacheTTL,omitempty"`

	PodUsageAssumption float64 `json:"podUsageAssumption,omitempty"`

	CPUUsageFormat string `json:"cpuUsageFormat,omitempty"`
}

func (*MinimizePowerArgs) DeepCopy

func (in *MinimizePowerArgs) DeepCopy() *MinimizePowerArgs

func (*MinimizePowerArgs) DeepCopyInto

func (in *MinimizePowerArgs) DeepCopyInto(out *MinimizePowerArgs)

func (*MinimizePowerArgs) DeepCopyObject

func (in *MinimizePowerArgs) DeepCopyObject() runtime.Object

func (*MinimizePowerArgs) Default

func (args *MinimizePowerArgs) Default()

func (*MinimizePowerArgs) Validate

func (args *MinimizePowerArgs) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL