Documentation
¶
Index ¶
Constants ¶
const (
NetBandwidthImplicitAnnotationKey = "resource.katalyst.kubewharf.io/net_bandwidth_implicit"
)
Variables ¶
This section is empty.
Functions ¶
func NewNetworkPluginState ¶
func NewNetworkPluginState(conf *qrm.QRMPluginsConfiguration, machineInfo *info.MachineInfo, nics []machine.InterfaceInfo, reservedBandwidth map[string]uint32) (*networkPluginState, error)
Types ¶
type AllocationInfo ¶
type AllocationInfo struct {
commonstate.AllocationMeta `json:",inline"`
Egress uint32 `json:"egress"`
Ingress uint32 `json:"ingress"`
Identifier string `json:"identifier"`
NSName string `json:"ns_name"`
IfName string `json:"if_name"` // we do not support cross-nic bandwidth
NumaNodes machine.CPUSet `json:"numa_node"` // associated numa nodes of the socket connecting to the selected NIC
NetClassID string `json:"net_class_id"`
}
func (*AllocationInfo) Clone ¶
func (ai *AllocationInfo) Clone() *AllocationInfo
func (*AllocationInfo) GetRequestedEgress ¶ added in v0.5.21
func (ai *AllocationInfo) GetRequestedEgress() (uint32, error)
func (*AllocationInfo) String ¶
func (ai *AllocationInfo) String() string
type BandwidthInfo ¶
type BandwidthInfo struct {
// Actual line speed of a NIC. E.g. a 25Gbps NIC's max bandwidth is around 23.5Gbps
// It's configurable. Its value = NIC line speed x configured CapacityRate
Capacity uint32
// Reserved bandwidth on this NIC (e.g. for system components or high priority tasks)
// For the sake of safety, we generally keep an overflow buffer and do not allocate all bandwidth to tasks
// Thus, both reservations should be set slightly larger than the actual required amount
SysReservation uint32
Reservation uint32
Allocatable uint32
Allocated uint32
Free uint32
}
type ContainerEntries ¶
type ContainerEntries map[string]*AllocationInfo // Keyed by container name
type NICMap ¶
func GenerateMachineState ¶
func GenerateMachineState(conf *qrm.QRMPluginsConfiguration, nics []machine.InterfaceInfo, reservation map[string]uint32) (NICMap, error)
GenerateMachineState returns NICResourcesMap based on machine info and reserved resources
func GenerateMachineStateFromPodEntries ¶
func GenerateMachineStateFromPodEntries(conf *qrm.QRMPluginsConfiguration, nics []machine.InterfaceInfo, podEntries PodEntries, reservation map[string]uint32, ) (NICMap, error)
GenerateMachineStateFromPodEntries returns NICMap for bandwidth based on machine info and reserved resources along with existed pod entries
func (NICMap) EgressBandwidthPerNIC ¶
EgressBandwidthPerNIC is a helper function to parse egress bandwidth per NIC
func (NICMap) IngressBandwidthPerNIC ¶
IngressBandwidthPerNIC is a helper function to parse egress bandwidth per NIC
type NICState ¶
type NICState struct {
EgressState BandwidthInfo `json:"egress_state"`
IngressState BandwidthInfo `json:"ingress_state"`
PodEntries PodEntries `json:"pod_entries"`
}
NICState indicates the status of a NIC, including the capacity/reservation/allocation (in Mbps)
func (*NICState) SetAllocationInfo ¶
func (ns *NICState) SetAllocationInfo(podUID string, containerName string, allocationInfo *AllocationInfo)
SetAllocationInfo adds a new AllocationInfo (for pod/container pairs) into the given NICState
type NetworkPluginCheckpoint ¶
type NetworkPluginCheckpoint struct {
PolicyName string `json:"policyName"`
MachineState NICMap `json:"machineState"`
PodEntries PodEntries `json:"pod_entries"`
Checksum checksum.Checksum `json:"checksum"`
}
func NewNetworkPluginCheckpoint ¶
func NewNetworkPluginCheckpoint() *NetworkPluginCheckpoint
func (*NetworkPluginCheckpoint) MarshalCheckpoint ¶
func (cp *NetworkPluginCheckpoint) MarshalCheckpoint() ([]byte, error)
MarshalCheckpoint returns marshaled checkpoint
func (*NetworkPluginCheckpoint) UnmarshalCheckpoint ¶
func (cp *NetworkPluginCheckpoint) UnmarshalCheckpoint(blob []byte) error
UnmarshalCheckpoint tries to unmarshal passed bytes to checkpoint
func (*NetworkPluginCheckpoint) VerifyChecksum ¶
func (cp *NetworkPluginCheckpoint) VerifyChecksum() error
VerifyChecksum verifies that current checksum of checkpoint is valid
type PodEntries ¶
type PodEntries map[string]ContainerEntries // Keyed by pod UID
func (PodEntries) Clone ¶
func (pe PodEntries) Clone() PodEntries
func (PodEntries) GetMainContainerAllocation ¶
func (pe PodEntries) GetMainContainerAllocation(podUID string) (*AllocationInfo, bool)
GetMainContainerAllocation returns AllocationInfo that belongs the main container for this pod
func (PodEntries) String ¶
func (pe PodEntries) String() string
type ReadonlyState ¶
type ReadonlyState interface {
GetMachineInfo() *info.MachineInfo
GetEnabledNICs() []machine.InterfaceInfo
GetReservedBandwidth() map[string]uint32
// 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(conf *qrm.QRMPluginsConfiguration, stateDir, checkpointName, policyName string, machineInfo *info.MachineInfo, nics []machine.InterfaceInfo, reservedBandwidth map[string]uint32, skipStateCorruption bool, ) (State, error)