Documentation ¶
Index ¶
- Constants
- func GetContainerAsyncWorkName(podUID, containerName, topic string) string
- func GetCoresReservedForSystem(conf *config.Configuration, machineInfo *machine.KatalystMachineInfo, ...) (machine.CPUSet, error)
- func GetHintsFromExtraStateFile(podName, resourceName, extraHintsStateFileAbsPath string) (map[string]*pluginapi.ListOfTopologyHints, error)
- func GetKatalystQoSLevelFromResourceReq(qosConf *generic.QoSConfiguration, req *pluginapi.ResourceRequest) (qosLevel string, err error)
- func GetNUMANodesCountToFitCPUReq(cpuReq int, cpuTopology *machine.CPUTopology) (int, int, error)
- func GetNUMANodesCountToFitMemoryReq(memoryReq, bytesPerNUMA uint64, numaCount int) (int, uint64, error)
- func GetQuantityFromResourceReq(req *pluginapi.ResourceRequest) (int, error)
- func GetTopologyAwareQuantityFromAssignments(assignments map[int]machine.CPUSet) []*pluginapi.TopologyAwareQuantity
- func GetTopologyAwareQuantityFromAssignmentsSize(assignments map[int]uint64) []*pluginapi.TopologyAwareQuantity
- func HintToIntArray(hint *pluginapi.TopologyHint) []int
- func IsDebugPod(podAnnotations map[string]string, podDebugAnnoKeys []string) bool
- func PackAllocationResponse(allocationInfo *state.AllocationInfo, resourceName, ociPropertyName string, ...) (*pluginapi.ResourceAllocationResponse, error)
- func PackResourceHintsResponse(req *pluginapi.ResourceRequest, resourceName string, ...) (*pluginapi.ResourceHintsResponse, error)
- func RegenerateHints(allocationInfo *state.AllocationInfo, reqInt int) map[string]*pluginapi.ListOfTopologyHints
- type AllocationHandler
- type HintHandler
Constants ¶
const ( // common metrics for all types of qrm plugins MetricNameHeartBeat = "heartbeat" MetricNameAllocateFailed = "alloc_failed" MetricNameGetTopologyHintsFailed = "get_topology_hints_failed" MetricNameRemovePodFailed = "remove_pod_failed" MetricNameLWAdvisorServerFailed = "lw_advisor_server_failed" MetricNameHandleAdvisorRespCalled = "handle_advisor_resp_called" MetricNameHandleAdvisorRespFailed = "handle_advisor_resp_failed" MetricNameLWRecvStuck = "lw_recv_stuck" // metrics for cpu plugin MetricNamePoolSize = "pool_size" MetricNameRealStateInvalid = "real_state_invalid" MetricNameCPUSetInvalid = "cpuset_invalid" MetricNameCPUSetOverlap = "cpuset_overlap" // metrics for memory plugin MetricNameMemSetInvalid = "memset_invalid" MetricNameMemSetOverlap = "memset_overlap" MetricNameNodeMemsetInvalid = "node_memset_invalid" MetricNameMemoryHandleAdvisorContainerEntryFailed = "memory_handle_advisor_container_entry_failed" MetricNameMemoryHandleAdvisorExtraEntryFailed = "memory_handle_advisor_extra_entry_failed" MetricNameMemoryHandleAdvisorMemoryLimit = "memory_handle_advisor_memory_limit" MetricNameMemoryHandleAdvisorDropCache = "memory_handle_advisor_drop_cache" MetricNameMemoryHandleAdvisorCPUSetMems = "memory_handle_advisor_cpuset_mems" )
const ( OCIPropertyNameCPUSetCPUs = "CpusetCpus" OCIPropertyNameCPUSetMems = "CpusetMems" OCIPropertyNameMemoryLimitInBytes = "MemoryLimitInBytes" )
those are OCI property names to be used by QRM plugins
const QRMPluginPolicyTagName = "policy"
const QRMTimeFormat = "2006-01-02 15:04:05.999999999 -0700 MST"
Variables ¶
This section is empty.
Functions ¶
func GetContainerAsyncWorkName ¶ added in v0.3.0
func GetCoresReservedForSystem ¶ added in v0.3.0
func GetCoresReservedForSystem(conf *config.Configuration, machineInfo *machine.KatalystMachineInfo, allCPUs machine.CPUSet) (machine.CPUSet, error)
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 ¶
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
IsDebugPod returns true if the pod annotations show up any configurable debug key
func PackAllocationResponse ¶ added in v0.3.0
func PackAllocationResponse(allocationInfo *state.AllocationInfo, resourceName, ociPropertyName string, isNodeResource, isScalarResource bool, req *pluginapi.ResourceRequest) (*pluginapi.ResourceAllocationResponse, error)
PackAllocationResponse fills pluginapi.ResourceAllocationResponse with information from AllocationInfo and pluginapi.ResourceRequest
func PackResourceHintsResponse ¶
func PackResourceHintsResponse(req *pluginapi.ResourceRequest, resourceName string, resourceHints map[string]*pluginapi.ListOfTopologyHints) (*pluginapi.ResourceHintsResponse, error)
PackResourceHintsResponse returns the standard QRM ResourceHintsResponse
func RegenerateHints ¶ added in v0.3.0
func RegenerateHints(allocationInfo *state.AllocationInfo, reqInt int) map[string]*pluginapi.ListOfTopologyHints
RegenerateHints regenerates hints for container that'd already been allocated cpu, and regenerateHints will assemble hints based on already-existed AllocationInfo, without any calculation logics at all
Types ¶
type AllocationHandler ¶
type AllocationHandler func(context.Context, *pluginapi.ResourceRequest) (*pluginapi.ResourceAllocationResponse, error)
AllocationHandler and HintHandler are used as standard functions for qrm plugins to acquire resource allocation/hint info
type HintHandler ¶
type HintHandler func(context.Context, *pluginapi.ResourceRequest) (*pluginapi.ResourceHintsResponse, error)