helpers

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateCPU             = "UpdateCPU"
	UpdateMemory          = "UpdateMemory"
	UpdateCgroups         = "UpdateCgroups" // update cgroups excluding the options already stated above
	UpdateSystemConfig    = "UpdateSystemConfig"
	UpdateResctrlSchemata = "UpdateResctrlSchemata" // update resctrl l3 cat schemata
	UpdateResctrlTasks    = "UpdateResctrlTasks"    // update resctrl tasks

	EvictPodByNodeMemoryUsage   = "EvictPodByNodeMemoryUsage"
	EvictPodByBECPUSatisfaction = "EvictPodByBECPUSatisfaction"

	AdjustBEByNodeCPUUsage = "AdjustBEByNodeCPUUsage"

	EvictPodSuccess = "evictPodSuccess"
	EvictPodFail    = "evictPodFail"
)

Variables

This section is empty.

Functions

func CalculateFilterPodsUsed added in v1.4.0

func CalculateFilterPodsUsed(nodeUsed float64, nodeReserved float64,
	podMetas []*statesinformer.PodMeta, podUsedMap map[string]float64,
	hostApps []slov1alpha1.HostApplicationSpec, hostAppMetrics map[string]float64,
	podFilterFn func(*corev1.Pod) bool,
	hostAppFilterFn func(*slov1alpha1.HostApplicationSpec) bool) (float64, float64, float64)

CalculateFilterPodsUsed calculates the sum used of filtered pods and hostApps. It returns the sum used of the filtered pods, the sum used of the filtered hostApps and the system used. If hostApps not passed, the hostApps part will be counted into the system used.

e.g. To calculate non-BE used,

  • filterPodsUsed := sum(podUsed[i] if f_pod(pod[i]))
  • filterHostAppUsed := sum(hostAppUsed[i] if f_hostApp(hostApp[i]))
  • systemdUsed := max(nodeReserved, nodeUsed - sum(podUsed[i]) - sum(hostAppUsed[i]))

func CollectAllHostAppMetrics added in v1.4.0

func CollectAllHostAppMetrics(hostApps []slov1alpha1.HostApplicationSpec, metricCache metriccache.MetricCache,
	queryParam metriccache.QueryParam, metricResource metriccache.MetricResource) map[string]float64

func CollectAllHostAppMetricsLast added in v1.4.0

func CollectAllHostAppMetricsLast(hostApps []slov1alpha1.HostApplicationSpec, metricCache metriccache.MetricCache,
	metricResource metriccache.MetricResource, metricCollectInterval time.Duration) map[string]float64

func CollectAllPodMetrics

func CollectAllPodMetrics(statesInformer statesinformer.StatesInformer, metricCache metriccache.MetricCache,
	queryParam metriccache.QueryParam, metricResource metriccache.MetricResource) map[string]float64

func CollectAllPodMetricsLast

func CollectAllPodMetricsLast(statesInformer statesinformer.StatesInformer, metricCache metriccache.MetricCache,
	metricResource metriccache.MetricResource, metricCollectInterval time.Duration) map[string]float64

func CollectContainerResMetricLast

func CollectContainerResMetricLast(metricCache metriccache.MetricCache, queryMeta metriccache.MetricMeta,
	metricCollectInterval time.Duration) (float64, error)

func CollectContainerThrottledMetric

func CollectContainerThrottledMetric(metricCache metriccache.MetricCache, containerID *string,
	metricCollectInterval time.Duration) (metriccache.AggregateResult, error)

func CollectNodeMetrics

func CollectNodeMetrics(metricCache metriccache.MetricCache, start, end time.Time, queryMeta metriccache.MetricMeta) (metriccache.AggregateResult, error)

func CollectPodMetric

func CollectPodMetric(metricCache metriccache.MetricCache, queryMeta metriccache.MetricMeta, start, end time.Time) (metriccache.AggregateResult, error)

func CollectPodMetricLast

func CollectPodMetricLast(metricCache metriccache.MetricCache, queryMeta metriccache.MetricMeta,
	metricCollectInterval time.Duration) (float64, error)

func CollectorNodeMetricLast

func CollectorNodeMetricLast(metricCache metriccache.MetricCache, queryMeta metriccache.MetricMeta, metricCollectInterval time.Duration) (float64, error)

func GenerateQueryParamsAvg

func GenerateQueryParamsAvg(windowDuration time.Duration) *metriccache.QueryParam

func GenerateQueryParamsLast

func GenerateQueryParamsLast(windowDuration time.Duration) *metriccache.QueryParam

func GetKubeQoSResourceQoSByQoSClass

func GetKubeQoSResourceQoSByQoSClass(qosClass corev1.PodQOSClass, strategy *slov1alpha1.ResourceQOSStrategy) *slov1alpha1.ResourceQOS

GetKubeQoSResourceQoSByQoSClass gets pod config by mapping kube qos into koordinator qos. https://koordinator.sh/docs/core-concepts/qos/#koordinator-qos-vs-kubernetes-qos

func GetNodeResourceReserved added in v1.4.0

func GetNodeResourceReserved(node *corev1.Node) corev1.ResourceList

func GetPodResourceQoSByQoSClass

func GetPodResourceQoSByQoSClass(pod *corev1.Pod, strategy *slov1alpha1.ResourceQOSStrategy) *slov1alpha1.ResourceQOS

func KillContainers

func KillContainers(pod *corev1.Pod, message string)

KillContainers kills containers inside the pod

func NonBEHostAppFilter added in v1.4.0

func NonBEHostAppFilter(hostAppSpec *slov1alpha1.HostApplicationSpec) bool

func NonBEPodFilter added in v1.4.0

func NonBEPodFilter(pod *corev1.Pod) bool

func NoneHostAppHighPriority added in v1.4.0

func NoneHostAppHighPriority(_ *slov1alpha1.HostApplicationSpec) bool

func NonePodHighPriority added in v1.4.0

func NonePodHighPriority(_ *corev1.Pod) bool

func NotBatchOrFreePodFilter added in v1.4.0

func NotBatchOrFreePodFilter(pod *corev1.Pod) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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