util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Index

Constants

View Source
const (
	MetricNameAllocateByCPUAdvisorServerCalled = "alloc_by_cpu_advisor_server_called"
	MetricNameIsolatedPodNum                   = "isolated_pod_num"
	MetricNamePoolSize                         = "pool_size"
	MetricNameAllocateByCPUAdvisorServerFailed = "alloc_by_cpu_advisor_server_failed"
	MetricNameAllocateFailed                   = "alloc_failed"
	MetricNameGetTopologyHintsFailed           = "get_topology_hints_failed"
	MetricNameRemovePodFailed                  = "remove_pod_failed"
	MetricNameLWCPUAdvisorServerFailed         = "lw_cpu_advisor_server_failed"
	MetricNameHeartBeat                        = "heartbeat"
	MetricNameRealStateInvalid                 = "real_state_invalid"
	MetricNameCPUSetInvalid                    = "cpuset_invalid"
	MetricNameCPUSetOverlap                    = "cpuset_overlap"
	MetricNameMemSetInvalid                    = "memset_invalid"
	MetricNameMemSetOverlap                    = "memset_overlap"
	MetricNameNodeMemsetInvalid                = "node_memset_invalid"
)
View Source
const (
	OCIPropertyNameCPUSetCPUs = "CpusetCpus"
	OCIPropertyNameCPUSetMems = "CpusetMems"
)

those are OCI property names to be used by QRM plugins

View Source
const QRMPluginPolicyTagName = "policy"
View Source
const QRMTimeFormat = "2006-01-02 15:04:05.999999999 -0700 MST"

Variables

This section is empty.

Functions

func GetHintsFromExtraStateFile

func GetHintsFromExtraStateFile(podName, resourceName, extraHintsStateFileAbsPath string) (map[string]*pluginapi.ListOfTopologyHints, error)

GetHintsFromExtraStateFile if you want to specify cpuset.mems for specific pods (eg. for existing pods) when switching to katalyst the first time, you can provide an extra hints state file with content like below:

{
	"memoryEntries": {
		"dp-18a916b04c-bdc9d5fd9-8m7vr-0": "0-1",
		"dp-18a916b04c-bdc9d5fd9-h9tgp-0": "5,7",
		"dp-47320a8d77-f46d6cbc7-5r27s-0": "2-3",
		"dp-d7e988f508-5f66655c5-8n2tf-0": "4,6"
	},
}

func GetKatalystQoSLevelFromResourceReq

func GetKatalystQoSLevelFromResourceReq(qosConf *generic.QoSConfiguration, req *pluginapi.ResourceRequest) (qosLevel string, err error)

GetKatalystQoSLevelFromResourceReq retrieves QoS Level for a given request

func GetNUMANodesCountToFitCPUReq

func GetNUMANodesCountToFitCPUReq(cpuReq int, cpuTopology *machine.CPUTopology) (int, int, error)

GetNUMANodesCountToFitCPUReq is used to calculate the amount of numa nodes we need if we try to allocate cpu cores among them, assuming that all numa nodes contain the same cpu capacity

func GetNUMANodesCountToFitMemoryReq

func GetNUMANodesCountToFitMemoryReq(memoryReq, bytesPerNUMA uint64, numaCount int) (int, uint64, error)

GetNUMANodesCountToFitMemoryReq is used to calculate the amount of numa nodes we need if we try to allocate memory among them, assuming that all numa nodes contain the same memory capacity

func GetQuantityFromResourceReq added in v0.2.0

func GetQuantityFromResourceReq(req *pluginapi.ResourceRequest) (int, error)

GetQuantityFromResourceReq parses resources quantity into value, since pods with reclaimed_cores and un-reclaimed_cores have different representations, we may to adapt to both cases.

func GetTopologyAwareQuantityFromAssignments

func GetTopologyAwareQuantityFromAssignments(assignments map[int]machine.CPUSet) []*pluginapi.TopologyAwareQuantity

GetTopologyAwareQuantityFromAssignments returns TopologyAwareQuantity based on assignments

func GetTopologyAwareQuantityFromAssignmentsSize

func GetTopologyAwareQuantityFromAssignmentsSize(assignments map[int]uint64) []*pluginapi.TopologyAwareQuantity

GetTopologyAwareQuantityFromAssignmentsSize returns TopologyAwareQuantity based on assignments, and assignments will use resource size (instead of resource struct)

func HintToIntArray

func HintToIntArray(hint *pluginapi.TopologyHint) []int

HintToIntArray transforms TopologyHint to int slices

func IsDebugPod added in v0.2.0

func IsDebugPod(podAnnotations map[string]string, podDebugAnnoKeys []string) bool

IsDebugPod returns true if the pod annotations show up any configurable debug key

func PackResourceHintsResponse

func PackResourceHintsResponse(req *pluginapi.ResourceRequest, resourceName string,
	resourceHints map[string]*pluginapi.ListOfTopologyHints) (*pluginapi.ResourceHintsResponse, error)

PackResourceHintsResponse returns the standard QRM ResourceHintsResponse

Types

type AllocationHandler

AllocationHandler and HintHandler are used as standard functions for qrm plugins to acquire resource allocation/hint info

Jump to

Keyboard shortcuts

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