Documentation
¶
Index ¶
- Constants
- Variables
- func AssumedPodCPUUsage(pod *corev1.Pod, assumedCPUUsageRate float64) (v float64)
- func New(_ runtime.Object, fh framework.Handle) (framework.Plugin, error)
- func PodCPULimit(pod *corev1.Pod) (v float64)
- func PodCPURequest(pod *corev1.Pod) (v float64)
- func PodCPUUsage(podMetrics *metricsv1beta1.PodMetrics) (v float64)
- func PowerConsumptions2Scores(scores framework.NodeScoreList)
- type MinimizePower
- func (pl *MinimizePower) AssumedCPUUsage(ctx context.Context, node *corev1.Node, ...) (before float64, after float64)
- func (*MinimizePower) Name() string
- func (pl *MinimizePower) NormalizeScore(_ context.Context, _ *framework.CycleState, pod *corev1.Pod, ...) *framework.Status
- func (pl *MinimizePower) Score(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, ...) (int64, *framework.Status)
- func (pl *MinimizePower) ScoreExtensions() framework.ScoreExtensions
Constants ¶
View Source
const ( // AssumedCPUUsageRate sets Pod CPU usage to (limits.cpu * AssumedCPUUsageRate) if requests.cpu is empty. AssumedCPUUsageRate = 0.85 // LowerLimitCPUUsageRate sets the lowest Pod CPU usage to (limits.cpu * LowerLimitCPUUsageRate) for the score calculation. LowerLimitCPUUsageRate = 0.50 // MetricsCacheTTL is the expiration time of the metrics cache. MetricsCacheTTL = 15 * time.Second // PredictorCacheTTL is the expiration time of the predictor cache. PredictorCacheTTL = 15 * time.Second )
Variables ¶
View Source
var (
Name = "MinimizePower"
)
Functions ¶
func AssumedPodCPUUsage ¶
AssumedPodCPUUsage assumes the total CPU usage by the given Pod.
ContainerCPUUsage = requests.cpu || limits.cpu * assumedCPUUsageRate PodCPUUsage = [sum(ContainerCPUUsage(c)) for c in spec.containers] Ignore Pods with no requests.cpu and limits.cpu
func PodCPULimit ¶
func PodCPURequest ¶
func PodCPUUsage ¶
func PodCPUUsage(podMetrics *metricsv1beta1.PodMetrics) (v float64)
func PowerConsumptions2Scores ¶
func PowerConsumptions2Scores(scores framework.NodeScoreList)
Types ¶
type MinimizePower ¶
type MinimizePower struct {
// contains filtered or unexported fields
}
func (*MinimizePower) AssumedCPUUsage ¶
func (pl *MinimizePower) AssumedCPUUsage(ctx context.Context, node *corev1.Node, nodeMetrics *metricsv1beta1.NodeMetrics, nodePods []*corev1.Pod, nodePodsMetricses []*metricsv1beta1.PodMetrics, pod *corev1.Pod, assumedCPUUsageRate float64, lowerLimitCPUUsageRate float64, ) (before float64, after float64)
AssumedCPUUsage assumes the CPU usage increment by allocating the given Pod.
- Node CPU usage may be greater than 1.0.
- Containers are ignored when it has empty requests.cpu and empty limit.cpu.
- assumedCPUUsageRate is used when a container has empty requests.cpu and non-empty limits.cpu.
- lowerLimitCPUUsageRate is the lower limit CPU usage rate of a pod.
func (*MinimizePower) Name ¶
func (*MinimizePower) Name() string
Name returns name of the plugin. It is used in logs, etc.
func (*MinimizePower) NormalizeScore ¶
func (pl *MinimizePower) NormalizeScore(_ context.Context, _ *framework.CycleState, pod *corev1.Pod, scores framework.NodeScoreList) *framework.Status
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 math.MaxInt64.
func (*MinimizePower) ScoreExtensions ¶
func (pl *MinimizePower) ScoreExtensions() framework.ScoreExtensions
ScoreExtensions returns a ScoreExtensions interface.
Click to show internal directories.
Click to hide internal directories.