Documentation ¶
Index ¶
- func GenerateMemoryContainerAllocationMeta(req *pluginapi.ResourceRequest, qosLevel string) commonstate.AllocationMeta
- type AllocationInfo
- type ContainerEntries
- type MemoryPluginCheckpoint
- type NUMANodeMap
- func GenerateMemoryStateFromPodEntries(machineInfo *info.MachineInfo, podEntries PodEntries, ...) (NUMANodeMap, error)
- func GenerateResourceState(machineInfo *info.MachineInfo, reserved map[v1.ResourceName]map[int]uint64, ...) (NUMANodeMap, error)
- func GenerateResourceStateFromPodEntries(machineInfo *info.MachineInfo, podEntries PodEntries, ...) (NUMANodeMap, error)
- type NUMANodeResourcesMap
- type NUMANodeState
- func (ns *NUMANodeState) Clone() *NUMANodeState
- func (ns *NUMANodeState) HasDedicatedNUMABindingAndNUMAExclusivePods() bool
- func (ns *NUMANodeState) HasSharedOrDedicatedNUMABindingPods() bool
- func (ns *NUMANodeState) SetAllocationInfo(podUID string, containerName string, allocationInfo *AllocationInfo)
- func (ns *NUMANodeState) String() string
- type PodEntries
- type PodResourceEntries
- type ReadonlyState
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMemoryContainerAllocationMeta ¶ added in v0.5.12
func GenerateMemoryContainerAllocationMeta(req *pluginapi.ResourceRequest, qosLevel string) commonstate.AllocationMeta
GenerateMemoryContainerAllocationMeta generates allocation metadata specifically for a memory resource request. This function is a wrapper around GenerateGenericContainerAllocationMeta, but it automatically computes the owner pool name using a QoS level and a specific annotation from the request. Parameters: - req: The resource request for memory, containing information about the pod and container. - qosLevel: The QoS (Quality of Service) level for the container. Returns: - A pointer to a commonstate.AllocationMeta struct generated based on the memory-specific logic.
Types ¶
type AllocationInfo ¶
type AllocationInfo struct { commonstate.AllocationMeta `json:",inline"` AggregatedQuantity uint64 `json:"aggregated_quantity"` NumaAllocationResult machine.CPUSet `json:"numa_allocation_result,omitempty"` // keyed by numa node id, value is assignment for the pod in corresponding NUMA node TopologyAwareAllocations map[int]uint64 `json:"topology_aware_allocations"` // keyed by control knob names referred in memoryadvisor package ExtraControlKnobInfo map[string]commonstate.ControlKnobInfo `json:"extra_control_knob_info"` }
func (*AllocationInfo) Clone ¶
func (ai *AllocationInfo) Clone() *AllocationInfo
func (*AllocationInfo) GetResourceAllocation ¶ added in v0.3.0
func (ai *AllocationInfo) GetResourceAllocation() (*pluginapi.ResourceAllocation, error)
GetResourceAllocation transforms resource allocation information into *pluginapi.ResourceAllocation
func (*AllocationInfo) String ¶
func (ai *AllocationInfo) String() string
type ContainerEntries ¶
type ContainerEntries map[string]*AllocationInfo // Keyed by container name
type MemoryPluginCheckpoint ¶
type MemoryPluginCheckpoint struct { PolicyName string `json:"policyName"` MachineState NUMANodeResourcesMap `json:"machineState"` PodResourceEntries PodResourceEntries `json:"pod_resource_entries"` SocketTopology map[int]string `json:"socket_topology,omitempty"` Checksum checksum.Checksum `json:"checksum"` }
func NewMemoryPluginCheckpoint ¶
func NewMemoryPluginCheckpoint() *MemoryPluginCheckpoint
func (*MemoryPluginCheckpoint) MarshalCheckpoint ¶
func (cp *MemoryPluginCheckpoint) MarshalCheckpoint() ([]byte, error)
MarshalCheckpoint returns marshaled checkpoint
func (*MemoryPluginCheckpoint) UnmarshalCheckpoint ¶
func (cp *MemoryPluginCheckpoint) UnmarshalCheckpoint(blob []byte) error
UnmarshalCheckpoint tries to unmarshal passed bytes to checkpoint
func (*MemoryPluginCheckpoint) VerifyChecksum ¶
func (cp *MemoryPluginCheckpoint) VerifyChecksum() error
VerifyChecksum verifies that current checksum of checkpoint is valid
type NUMANodeMap ¶
type NUMANodeMap map[int]*NUMANodeState // keyed by numa node id
func GenerateMemoryStateFromPodEntries ¶ added in v0.2.0
func GenerateMemoryStateFromPodEntries(machineInfo *info.MachineInfo, podEntries PodEntries, reserved map[v1.ResourceName]map[int]uint64, ) (NUMANodeMap, error)
GenerateMemoryStateFromPodEntries returns NUMANodeMap for memory based on machine info and reserved resources along with existed pod entries
func GenerateResourceState ¶ added in v0.2.0
func GenerateResourceState(machineInfo *info.MachineInfo, reserved map[v1.ResourceName]map[int]uint64, resourceName v1.ResourceName) (NUMANodeMap, error)
GenerateResourceState returns NUMANodeMap for given resource based on machine info and reserved resources
func GenerateResourceStateFromPodEntries ¶ added in v0.2.0
func GenerateResourceStateFromPodEntries(machineInfo *info.MachineInfo, podEntries PodEntries, reserved map[v1.ResourceName]map[int]uint64, resourceName v1.ResourceName, ) (NUMANodeMap, error)
GenerateResourceStateFromPodEntries returns NUMANodeMap for given resource based on machine info and reserved resources along with existed pod entries
func (NUMANodeMap) BytesPerNUMA ¶ added in v0.2.0
func (nm NUMANodeMap) BytesPerNUMA() (uint64, error)
BytesPerNUMA is a helper function to parse memory capacity at per numa level
func (NUMANodeMap) Clone ¶
func (nm NUMANodeMap) Clone() NUMANodeMap
func (NUMANodeMap) GetNUMANodesWithoutDedicatedNUMABindingAndNUMAExclusivePods ¶ added in v0.5.12
func (nm NUMANodeMap) GetNUMANodesWithoutDedicatedNUMABindingAndNUMAExclusivePods() machine.CPUSet
GetNUMANodesWithoutDedicatedNUMABindingAndNUMAExclusivePods returns a set of numa nodes; for those numa nodes, they all don't contain dedicated with numa-binding and numa-exclusive pods
func (NUMANodeMap) GetNUMANodesWithoutSharedOrDedicatedNUMABindingPods ¶ added in v0.5.12
func (nm NUMANodeMap) GetNUMANodesWithoutSharedOrDedicatedNUMABindingPods() machine.CPUSet
GetNUMANodesWithoutSharedOrDedicatedNUMABindingPods returns a set of numa nodes; for those numa nodes, they all don't contain shared or dedicated numa-binding pods
type NUMANodeResourcesMap ¶
type NUMANodeResourcesMap map[v1.ResourceName]NUMANodeMap // keyed by resource name
func GenerateMachineState ¶ added in v0.2.0
func GenerateMachineState(machineInfo *info.MachineInfo, reserved map[v1.ResourceName]map[int]uint64) (NUMANodeResourcesMap, error)
GenerateMachineState returns NUMANodeResourcesMap based on machine info and reserved resources
func GenerateMachineStateFromPodEntries ¶ added in v0.2.0
func GenerateMachineStateFromPodEntries(machineInfo *info.MachineInfo, podResourceEntries PodResourceEntries, reserved map[v1.ResourceName]map[int]uint64, ) (NUMANodeResourcesMap, error)
GenerateMachineStateFromPodEntries returns NUMANodeResourcesMap based on machine info and reserved resources (along with existed pod entries)
func (NUMANodeResourcesMap) Clone ¶
func (nrm NUMANodeResourcesMap) Clone() NUMANodeResourcesMap
func (NUMANodeResourcesMap) String ¶
func (nrm NUMANodeResourcesMap) String() string
type NUMANodeState ¶
type NUMANodeState struct { TotalMemSize uint64 `json:"total"` SystemReserved uint64 `json:"systemReserved"` Allocatable uint64 `json:"allocatable"` Allocated uint64 `json:"Allocated"` Free uint64 `json:"free"` PodEntries PodEntries `json:"pod_entries"` }
NUMANodeState records the amount of memory per numa node (in bytes)
func (*NUMANodeState) Clone ¶
func (ns *NUMANodeState) Clone() *NUMANodeState
func (*NUMANodeState) HasDedicatedNUMABindingAndNUMAExclusivePods ¶ added in v0.5.12
func (ns *NUMANodeState) HasDedicatedNUMABindingAndNUMAExclusivePods() bool
HasDedicatedNUMABindingAndNUMAExclusivePods returns true if any AllocationInfo in this NUMANodeState is for dedicated with numa-binding and numa-exclusive
func (*NUMANodeState) HasSharedOrDedicatedNUMABindingPods ¶ added in v0.5.12
func (ns *NUMANodeState) HasSharedOrDedicatedNUMABindingPods() bool
HasSharedOrDedicatedNUMABindingPods returns true if any AllocationInfo in this NUMANodeState is for shared or dedicated numa-binding
func (*NUMANodeState) SetAllocationInfo ¶
func (ns *NUMANodeState) SetAllocationInfo(podUID string, containerName string, allocationInfo *AllocationInfo)
SetAllocationInfo adds a new AllocationInfo (for pod/container pairs) into the given NUMANodeState
func (*NUMANodeState) String ¶
func (ns *NUMANodeState) String() string
type PodEntries ¶
type PodEntries map[string]ContainerEntries // Keyed by pod UID
func (PodEntries) Clone ¶
func (pe PodEntries) Clone() PodEntries
func (PodEntries) GetMainContainerAllocation ¶ added in v0.2.0
func (pe PodEntries) GetMainContainerAllocation(podUID string) (*AllocationInfo, bool)
GetMainContainerAllocation returns AllocationInfo that belongs the main container for this pod
type PodResourceEntries ¶
type PodResourceEntries map[v1.ResourceName]PodEntries // Keyed by resource name
func (PodResourceEntries) Clone ¶
func (pre PodResourceEntries) Clone() PodResourceEntries
func (PodResourceEntries) String ¶
func (pre PodResourceEntries) String() string
type ReadonlyState ¶
type ReadonlyState interface { GetMachineInfo() *info.MachineInfo GetReservedMemory() map[v1.ResourceName]map[int]uint64 // contains filtered or unexported methods }
ReadonlyState interface only provides methods for tracking pod assignments
type State ¶
type State interface { ReadonlyState // contains filtered or unexported methods }
State interface provides methods for tracking and setting pod assignments
func NewCheckpointState ¶
func NewCheckpointState(stateDir, checkpointName, policyName string, topology *machine.CPUTopology, machineInfo *info.MachineInfo, reservedMemory map[v1.ResourceName]map[int]uint64, skipStateCorruption bool, ) (State, error)
func NewMemoryPluginState ¶
func NewMemoryPluginState(topology *machine.CPUTopology, machineInfo *info.MachineInfo, reservedMemory map[v1.ResourceName]map[int]uint64) (State, error)