Documentation
¶
Index ¶
- Constants
- Variables
- func NewHighNodeUtilization(ctx context.Context, genericArgs runtime.Object, handle frameworktypes.Handle) (frameworktypes.Plugin, error)
- func NewLowNodeUtilization(ctx context.Context, genericArgs runtime.Object, handle frameworktypes.Handle) (frameworktypes.Plugin, error)
- func NodeUsageFromPrometheusMetrics(ctx context.Context, promClient promapi.Client, promQuery string) (map[string]map[v1.ResourceName]*resource.Quantity, error)
- func RegisterDefaults(scheme *runtime.Scheme) error
- func ResourceUsageToResourceThreshold(usages, totals api.ReferencedResourceList) api.ResourceThresholds
- func SetDefaults_HighNodeUtilizationArgs(obj runtime.Object)
- func SetDefaults_LowNodeUtilizationArgs(obj runtime.Object)
- func ValidateHighNodeUtilizationArgs(obj runtime.Object) error
- func ValidateLowNodeUtilizationArgs(obj runtime.Object) error
- type EvictionMode
- type HighNodeUtilization
- type HighNodeUtilizationArgs
- type LowNodeUtilization
- type LowNodeUtilizationArgs
- type MetricsUtilization
- type NodeInfo
- type NodeUsage
- type Prometheus
- type UsageClientType
Constants ¶
const ( // MetricResource is a special resource name we use to keep track of a // metric obtained from a third party entity. MetricResource = v1.ResourceName("MetricResource") // MinResourcePercentage is the minimum value of a resource's percentage MinResourcePercentage = 0 // MaxResourcePercentage is the maximum value of a resource's percentage MaxResourcePercentage = 100 )
const HighNodeUtilizationPluginName = "HighNodeUtilization"
const LowNodeUtilizationPluginName = "LowNodeUtilization"
Variables ¶
var ( SchemeBuilder = runtime.NewSchemeBuilder() AddToScheme = localSchemeBuilder.AddToScheme )
Functions ¶
func NewHighNodeUtilization ¶
func NewHighNodeUtilization( ctx context.Context, genericArgs runtime.Object, handle frameworktypes.Handle, ) (frameworktypes.Plugin, error)
NewHighNodeUtilization builds plugin from its arguments while passing a handle.
func NewLowNodeUtilization ¶
func NewLowNodeUtilization( ctx context.Context, genericArgs runtime.Object, handle frameworktypes.Handle, ) (frameworktypes.Plugin, error)
NewLowNodeUtilization builds plugin from its arguments while passing a handle. this plugin aims to move workload from overutilized nodes to underutilized nodes.
func NodeUsageFromPrometheusMetrics ¶ added in v0.33.0
func RegisterDefaults ¶ added in v0.26.0
RegisterDefaults adds defaulters functions to the given scheme. Public to allow building arbitrary schemes. All generated defaulters are covering - they call all nested defaulters.
func ResourceUsageToResourceThreshold ¶ added in v0.33.0
func ResourceUsageToResourceThreshold( usages, totals api.ReferencedResourceList, ) api.ResourceThresholds
ResourceUsage2ResourceThreshold is an implementation of a Normalizer that converts a set of resource usages and totals into percentage. This function operates on Quantity Value() for all the resources except CPU, where it uses MilliValue().
func SetDefaults_HighNodeUtilizationArgs ¶ added in v0.26.0
SetDefaults_HighNodeUtilizationArgs TODO: the final default values would be discussed in community
func SetDefaults_LowNodeUtilizationArgs ¶ added in v0.26.0
SetDefaults_LowNodeUtilizationArgs TODO: the final default values would be discussed in community
func ValidateHighNodeUtilizationArgs ¶ added in v0.26.0
func ValidateLowNodeUtilizationArgs ¶ added in v0.26.0
Types ¶
type EvictionMode ¶ added in v0.33.0
type EvictionMode string
EvictionMode describe a mode of eviction. See the list below for the available modes.
const ( // EvictionModeOnlyThresholdingResources makes the descheduler evict // only pods that have a resource request defined for any of the user // provided thresholds. If the pod does not request the resource, it // will not be evicted. EvictionModeOnlyThresholdingResources EvictionMode = "OnlyThresholdingResources" )
type HighNodeUtilization ¶
type HighNodeUtilization struct {
// contains filtered or unexported fields
}
HighNodeUtilization evicts pods from under utilized nodes so that scheduler can schedule according to its plugin. Note that CPU/Memory requests are used to calculate nodes' utilization and not the actual resource usage.
func (*HighNodeUtilization) Balance ¶
func (h *HighNodeUtilization) Balance(ctx context.Context, nodes []*v1.Node) *frameworktypes.Status
Balance holds the main logic of the plugin. It evicts pods from under utilized nodes. The goal here is to concentrate pods in fewer nodes so that less nodes are used.
func (*HighNodeUtilization) Name ¶
func (h *HighNodeUtilization) Name() string
Name retrieves the plugin name.
type HighNodeUtilizationArgs ¶ added in v0.26.0
type HighNodeUtilizationArgs struct {
metav1.TypeMeta `json:",inline"`
Thresholds api.ResourceThresholds `json:"thresholds"`
NumberOfNodes int `json:"numberOfNodes,omitempty"`
// EvictionModes is a set of modes to be taken into account when the
// descheduler evicts pods. For example the mode
// `OnlyThresholdingResources` can be used to make sure the descheduler
// only evicts pods who have resource requests for the defined
// thresholds.
EvictionModes []EvictionMode `json:"evictionModes,omitempty"`
// Naming this one differently since namespaces are still
// considered while considering resources used by pods
// but then filtered out before eviction
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces,omitempty"`
}
func (*HighNodeUtilizationArgs) DeepCopy ¶ added in v0.26.0
func (in *HighNodeUtilizationArgs) DeepCopy() *HighNodeUtilizationArgs
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HighNodeUtilizationArgs.
func (*HighNodeUtilizationArgs) DeepCopyInto ¶ added in v0.26.0
func (in *HighNodeUtilizationArgs) DeepCopyInto(out *HighNodeUtilizationArgs)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*HighNodeUtilizationArgs) DeepCopyObject ¶ added in v0.26.0
func (in *HighNodeUtilizationArgs) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type LowNodeUtilization ¶
type LowNodeUtilization struct {
// contains filtered or unexported fields
}
LowNodeUtilization evicts pods from overutilized nodes to underutilized nodes. Note that CPU/Memory requests are used to calculate nodes' utilization and not the actual resource usage.
func (*LowNodeUtilization) Balance ¶
func (l *LowNodeUtilization) Balance(ctx context.Context, nodes []*v1.Node) *frameworktypes.Status
Balance holds the main logic of the plugin. It evicts pods from over utilized nodes to under utilized nodes. The goal here is to evenly distribute pods across nodes.
func (*LowNodeUtilization) Name ¶
func (l *LowNodeUtilization) Name() string
Name retrieves the plugin name.
type LowNodeUtilizationArgs ¶ added in v0.26.0
type LowNodeUtilizationArgs struct {
metav1.TypeMeta `json:",inline"`
UseDeviationThresholds bool `json:"useDeviationThresholds,omitempty"`
Thresholds api.ResourceThresholds `json:"thresholds"`
TargetThresholds api.ResourceThresholds `json:"targetThresholds"`
NumberOfNodes int `json:"numberOfNodes,omitempty"`
MetricsUtilization *MetricsUtilization `json:"metricsUtilization,omitempty"`
// Naming this one differently since namespaces are still
// considered while considering resources used by pods
// but then filtered out before eviction
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces,omitempty"`
// evictionLimits limits the number of evictions per domain. E.g. node, namespace, total.
EvictionLimits *api.EvictionLimits `json:"evictionLimits,omitempty"`
}
func (*LowNodeUtilizationArgs) DeepCopy ¶ added in v0.26.0
func (in *LowNodeUtilizationArgs) DeepCopy() *LowNodeUtilizationArgs
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LowNodeUtilizationArgs.
func (*LowNodeUtilizationArgs) DeepCopyInto ¶ added in v0.26.0
func (in *LowNodeUtilizationArgs) DeepCopyInto(out *LowNodeUtilizationArgs)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*LowNodeUtilizationArgs) DeepCopyObject ¶ added in v0.26.0
func (in *LowNodeUtilizationArgs) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type MetricsUtilization ¶ added in v0.32.0
type MetricsUtilization struct {
// metricsServer enables metrics from a kubernetes metrics server.
// Please see https://kubernetes-sigs.github.io/metrics-server/ for more.
// Deprecated. Use Source instead.
MetricsServer bool `json:"metricsServer,omitempty"`
// source enables the plugin to consume metrics from a metrics source.
// Currently only KubernetesMetrics available.
Source api.MetricsSource `json:"source,omitempty"`
// prometheus enables metrics collection through a prometheus query.
Prometheus *Prometheus `json:"prometheus,omitempty"`
}
MetricsUtilization allow to consume actual resource utilization from metrics +k8s:deepcopy-gen=true
func (*MetricsUtilization) DeepCopy ¶ added in v0.33.0
func (in *MetricsUtilization) DeepCopy() *MetricsUtilization
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsUtilization.
func (*MetricsUtilization) DeepCopyInto ¶ added in v0.33.0
func (in *MetricsUtilization) DeepCopyInto(out *MetricsUtilization)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeInfo ¶
type NodeInfo struct {
NodeUsage
// contains filtered or unexported fields
}
NodeInfo is an entity we use to gather information about a given node. here we have its resource usage as well as the amount of available resources. we use this struct to carry information around and to make it easier to process.
type NodeUsage ¶
type NodeUsage struct {
// contains filtered or unexported fields
}
NodeUsage stores a node's info, pods on it, thresholds and its resource usage.
type Prometheus ¶ added in v0.33.0
type Prometheus struct {
// query returning a vector of samples, each sample labeled with `instance`
// corresponding to a node name with each sample value as a real number
// in <0; 1> interval.
Query string `json:"query,omitempty"`
}
type UsageClientType ¶ added in v0.33.0
type UsageClientType int