Documentation ¶
Index ¶
- func BuildNodeInfoForNode(node *apiv1.Node, scheduledPods []*apiv1.Pod, daemonsets []*appsv1.DaemonSet, ...) (*framework.NodeInfo, errors.AutoscalerError)
- func GetPodsToMove(nodeInfo *framework.NodeInfo, deleteOptions options.NodeDeleteOptions, ...) (pods []*apiv1.Pod, daemonSetPods []*apiv1.Pod, blockingPod *drain.BlockingPod, ...)
- type NodeToBeRemoved
- type RemovalSimulator
- func (r *RemovalSimulator) DropOldHints()
- func (r *RemovalSimulator) FindEmptyNodesToRemove(candidates []string, timestamp time.Time) []string
- func (r *RemovalSimulator) FindNodesToRemove(candidates []string, destinations []string, timestamp time.Time, ...) (nodesToRemove []NodeToBeRemoved, unremovableNodes []*UnremovableNode)
- func (r *RemovalSimulator) SimulateNodeRemoval(nodeName string, destinationMap map[string]bool, timestamp time.Time, ...) (*NodeToBeRemoved, *UnremovableNode)
- type UnremovableNode
- type UnremovableReason
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildNodeInfoForNode ¶
func BuildNodeInfoForNode(node *apiv1.Node, scheduledPods []*apiv1.Pod, daemonsets []*appsv1.DaemonSet, forceDaemonSets bool) (*framework.NodeInfo, errors.AutoscalerError)
BuildNodeInfoForNode build a NodeInfo structure for the given node as if the node was just created.
func GetPodsToMove ¶
func GetPodsToMove(nodeInfo *framework.NodeInfo, deleteOptions options.NodeDeleteOptions, drainabilityRules rules.Rules, listers kube_util.ListerRegistry, remainingPdbTracker pdb.RemainingPdbTracker, timestamp time.Time) (pods []*apiv1.Pod, daemonSetPods []*apiv1.Pod, blockingPod *drain.BlockingPod, err error)
GetPodsToMove returns a list of pods that should be moved elsewhere and a list of DaemonSet pods that should be evicted if the node is drained. Raises error if there is an unreplicated pod. Based on kubectl drain code. If listers is nil it makes an assumption that RC, DS, Jobs and RS were deleted along with their pods (no abandoned pods with dangling created-by annotation). If listers is not nil it checks whether RC, DS, Jobs and RS that created these pods still exist.
Types ¶
type NodeToBeRemoved ¶
type NodeToBeRemoved struct { // Node to be removed. Node *apiv1.Node // IsRisky indicates that node has high chance to fail during removal. IsRisky bool // PodsToReschedule contains pods on the node that should be rescheduled elsewhere. PodsToReschedule []*apiv1.Pod DaemonSetPods []*apiv1.Pod }
NodeToBeRemoved contain information about a node that can be removed.
type RemovalSimulator ¶
type RemovalSimulator struct {
// contains filtered or unexported fields
}
RemovalSimulator is a helper object for simulating node removal scenarios.
func NewRemovalSimulator ¶
func NewRemovalSimulator(listers kube_util.ListerRegistry, clusterSnapshot clustersnapshot.ClusterSnapshot, predicateChecker predicatechecker.PredicateChecker, deleteOptions options.NodeDeleteOptions, drainabilityRules rules.Rules, persistSuccessfulSimulations bool) *RemovalSimulator
NewRemovalSimulator returns a new RemovalSimulator.
func (*RemovalSimulator) DropOldHints ¶
func (r *RemovalSimulator) DropOldHints()
DropOldHints drops old scheduling hints.
func (*RemovalSimulator) FindEmptyNodesToRemove ¶
func (r *RemovalSimulator) FindEmptyNodesToRemove(candidates []string, timestamp time.Time) []string
FindEmptyNodesToRemove finds empty nodes that can be removed.
func (*RemovalSimulator) FindNodesToRemove ¶
func (r *RemovalSimulator) FindNodesToRemove( candidates []string, destinations []string, timestamp time.Time, remainingPdbTracker pdb.RemainingPdbTracker, ) (nodesToRemove []NodeToBeRemoved, unremovableNodes []*UnremovableNode)
FindNodesToRemove finds nodes that can be removed.
func (*RemovalSimulator) SimulateNodeRemoval ¶
func (r *RemovalSimulator) SimulateNodeRemoval( nodeName string, destinationMap map[string]bool, timestamp time.Time, remainingPdbTracker pdb.RemainingPdbTracker, ) (*NodeToBeRemoved, *UnremovableNode)
SimulateNodeRemoval simulates removing a node from the cluster to check whether it is possible to move its pods. Depending on the outcome, exactly one of (NodeToBeRemoved, UnremovableNode) will be populated in the return value, the other will be nil.
type UnremovableNode ¶
type UnremovableNode struct { Node *apiv1.Node Reason UnremovableReason BlockingPod *drain.BlockingPod }
UnremovableNode represents a node that can't be removed by CA.
type UnremovableReason ¶
type UnremovableReason int
UnremovableReason represents a reason why a node can't be removed by CA.
const ( // NoReason - sanity check, this should never be set explicitly. If this is found in the wild, it means that it was // implicitly initialized and might indicate a bug. NoReason UnremovableReason = iota // ScaleDownDisabledAnnotation - node can't be removed because it has a "scale down disabled" annotation. ScaleDownDisabledAnnotation // ScaleDownUnreadyDisabled - node can't be removed because it is unready and scale down is disabled for unready nodes. ScaleDownUnreadyDisabled // NotAutoscaled - node can't be removed because it doesn't belong to an autoscaled node group. NotAutoscaled // NotUnneededLongEnough - node can't be removed because it wasn't unneeded for long enough. NotUnneededLongEnough // NotUnreadyLongEnough - node can't be removed because it wasn't unready for long enough. NotUnreadyLongEnough // NodeGroupMinSizeReached - node can't be removed because its node group is at its minimal size already. NodeGroupMinSizeReached // NodeGroupMaxDeletionCountReached - node can't be removed because max node count to be removed value set in planner reached NodeGroupMaxDeletionCountReached // AtomicScaleDownFailed - node can't be removed as node group has ZeroOrMaxNodeScaling enabled and number of nodes to remove are not equal to target size AtomicScaleDownFailed // MinimalResourceLimitExceeded - node can't be removed because it would violate cluster-wide minimal resource limits. MinimalResourceLimitExceeded // CurrentlyBeingDeleted - node can't be removed because it's already in the process of being deleted. CurrentlyBeingDeleted // NotUnderutilized - node can't be removed because it's not underutilized. NotUnderutilized // NotUnneededOtherReason - node can't be removed because it's not marked as unneeded for other reasons (e.g. it wasn't inspected at all in a given autoscaler loop). NotUnneededOtherReason // RecentlyUnremovable - node can't be removed because it was recently found to be unremovable. RecentlyUnremovable // NoPlaceToMovePods - node can't be removed because there's no place to move its pods to. NoPlaceToMovePods // BlockedByPod - node can't be removed because a pod running on it can't be moved. The reason why should be in BlockingPod. BlockedByPod // UnexpectedError - node can't be removed because of an unexpected error. UnexpectedError )