Documentation ¶
Index ¶
- Constants
- type EvictionQueue
- type EvictionStrategy
- type EvictionStrategyImpl
- func (e *EvictionStrategyImpl) CandidateSort(rpList RuledEvictPodList)
- func (e *EvictionStrategyImpl) CandidateValidate(rp *RuledEvictPod) bool
- func (e *EvictionStrategyImpl) CompareEvictionResource(s1, s2 interface{}) int
- func (e *EvictionStrategyImpl) CompareKatalystQoS(s1, s2 interface{}) int
- func (e *EvictionStrategyImpl) ComparePodName(s1, s2 interface{}) int
- func (e *EvictionStrategyImpl) ComparePriority(s1, s2 interface{}) int
- type FIFOEvictionQueue
- type RuledEvictPod
- type RuledEvictPodList
Constants ¶
const ( EvictionScopeForce = "force" EvictionScopeSoft = "soft" EvictionScopeMemory = "memory" EvictionScopeCPU = "cpu" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictionQueue ¶
type EvictionQueue interface { // Add EvictPods into queue, whether to perform sorting logic should be added here; // and the parameter "override" will decide whether we should withdraw all // candidate EvictPods that don't appear in the given pod list Add(rpList RuledEvictPodList, override bool) // Withdraw withdraws EvictPods from candidate list if exists Withdraw(rpList RuledEvictPodList) // Pop EvictPods for eviction Pop() RuledEvictPodList // List returns all EvictPods in this queue (without deleting) List() RuledEvictPodList }
EvictionQueue aims to build a queue for eviction EvictPods, based on this queue, eviction manager can use it to perform more efficient logics, e.g. rate limiter, priority-based sorting strategy, eviction withdraw and so on
func NewFIFOEvictionQueue ¶
func NewFIFOEvictionQueue(limited int) EvictionQueue
type EvictionStrategy ¶
type EvictionStrategy interface { // CandidateSort defines the eviction priority among different EvictPods CandidateSort(rpList RuledEvictPodList) // CandidateValidate defines whether the given pod is permitted for // eviction since some specific EvictPods should always keep running. CandidateValidate(rp *RuledEvictPod) bool }
func NewEvictionStrategyImpl ¶
func NewEvictionStrategyImpl(conf *pkgconfig.Configuration) EvictionStrategy
type EvictionStrategyImpl ¶
type EvictionStrategyImpl struct {
// contains filtered or unexported fields
}
func (*EvictionStrategyImpl) CandidateSort ¶
func (e *EvictionStrategyImpl) CandidateSort(rpList RuledEvictPodList)
CandidateSort defines the sorting rules will be as below - katalyst QoS: none-reclaimed > reclaimed - pod priority - predefined resource priority: e.g. memory > cpu > ... - pod names
func (*EvictionStrategyImpl) CandidateValidate ¶
func (e *EvictionStrategyImpl) CandidateValidate(rp *RuledEvictPod) bool
CandidateValidate will try to filter out EvictPods from eviction - EvictPods with katalyst SystemQoS - EvictPods marked as critical
func (*EvictionStrategyImpl) CompareEvictionResource ¶
func (e *EvictionStrategyImpl) CompareEvictionResource(s1, s2 interface{}) int
CompareEvictionResource compares the eviction scope defined in each plugin
func (*EvictionStrategyImpl) CompareKatalystQoS ¶
func (e *EvictionStrategyImpl) CompareKatalystQoS(s1, s2 interface{}) int
CompareKatalystQoS compares KatalystQoS for EvictPods, if we failed to parse qos level for a pod, we will consider it as none-reclaimed pod.
func (*EvictionStrategyImpl) ComparePodName ¶
func (e *EvictionStrategyImpl) ComparePodName(s1, s2 interface{}) int
func (*EvictionStrategyImpl) ComparePriority ¶
func (e *EvictionStrategyImpl) ComparePriority(s1, s2 interface{}) int
ComparePriority compares pod priority for EvictPods, if any pod doesn't have nominated priority, it will always be inferior to those with priority nominated.
type FIFOEvictionQueue ¶
FIFOEvictionQueue is the default implementation for EvictionQueue; it will use the FIFO strategy for one batch of EvictPods (sort for those EvictPods in the same way though), and support to pop a limited amount of EvictPods when pop is triggered.
func (*FIFOEvictionQueue) Add ¶
func (f *FIFOEvictionQueue) Add(rpList RuledEvictPodList, override bool)
func (*FIFOEvictionQueue) List ¶
func (f *FIFOEvictionQueue) List() RuledEvictPodList
func (*FIFOEvictionQueue) Pop ¶
func (f *FIFOEvictionQueue) Pop() RuledEvictPodList
func (*FIFOEvictionQueue) Withdraw ¶
func (f *FIFOEvictionQueue) Withdraw(rpList RuledEvictPodList)
type RuledEvictPod ¶
RuledEvictPod wraps pod in a new struct to get more useful information to help with eviction rules.
type RuledEvictPodList ¶
type RuledEvictPodList []*RuledEvictPod
func (RuledEvictPodList) GetSource ¶
func (rpList RuledEvictPodList) GetSource(index int) interface{}
func (RuledEvictPodList) Len ¶
func (rpList RuledEvictPodList) Len() int
func (RuledEvictPodList) SetSource ¶
func (rpList RuledEvictPodList) SetSource(index int, s interface{})