Documentation ¶
Index ¶
- Constants
- func NodeCanBeBalanced(node *corev1.Node) bool
- type Controller
- func (plc *Controller) OnAddNag(nag *assignmentsv1alpha1.NodeAssignmentGroup)
- func (plc *Controller) OnAddNode(node *corev1.Node)
- func (plc *Controller) OnAddPod(pod *corev1.Pod)
- func (plc *Controller) OnDeleteNag(nag *assignmentsv1alpha1.NodeAssignmentGroup)
- func (plc *Controller) OnDeleteNode(node *corev1.Node)
- func (plc *Controller) OnDeletePod(pod *corev1.Pod)
- func (plc *Controller) OnUpdateNag(oldNag *assignmentsv1alpha1.NodeAssignmentGroup, ...)
- func (plc *Controller) OnUpdateNode(oldNode *corev1.Node, newNode *corev1.Node)
- func (plc *Controller) OnUpdatePod(oldPod *corev1.Pod, newPod *corev1.Pod)
- func (plc *Controller) ProcessPackLeftNagsForNode(node *corev1.Node)
- func (plc *Controller) ProcessPodNags(pod *corev1.Pod)
- func (plc *Controller) Run()
- type Manager
- func (m *Manager) CleanAllNodes(nag *assignmentsv1alpha1.NodeAssignmentGroup) error
- func (m *Manager) CleanUnassignedNodes(nag *assignmentsv1alpha1.NodeAssignmentGroup)
- func (m *Manager) NodeHasPackLeftAssignment(node *corev1.Node, nag *assignmentsv1alpha1.NodeAssignmentGroup) bool
- func (m *Manager) NodeHasPackLeftAttributes(node *corev1.Node, nag *assignmentsv1alpha1.NodeAssignmentGroup) bool
- func (m *Manager) RebalanceNag(nag *assignmentsv1alpha1.NodeAssignmentGroup, metric *prometheus.GaugeVec)
- func (m *Manager) RemoveFinalizer(nag *assignmentsv1alpha1.NodeAssignmentGroup) error
Constants ¶
const (
PackLeftFinalizer string = "packleft.nag.finalizer.kube-valet.io"
)
Variables ¶
This section is empty.
Functions ¶
func NodeCanBeBalanced ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages events for pods, nodes, and nags and rebalances pack left strategies on the nag
func NewController ¶
func NewController(nagIndex cache.Indexer, nodeIndex cache.Indexer, podIndex cache.Indexer, kubeClient kubernetes.Interface, valetClient valet.Interface, threadiness int, stopChannel chan struct{}) *Controller
NewController creates a new packleft.Controller
func (*Controller) OnAddNag ¶
func (plc *Controller) OnAddNag(nag *assignmentsv1alpha1.NodeAssignmentGroup)
OnAddNag when a nag is added rebalance it
func (*Controller) OnAddNode ¶
func (plc *Controller) OnAddNode(node *corev1.Node)
OnAddNode when a node is added, queue a process of all nags
func (*Controller) OnAddPod ¶
func (plc *Controller) OnAddPod(pod *corev1.Pod)
OnAddPod when a pod is added rebalance the nag that points to the node the pod is running on If the pod is brand new then it may not be on a node yet and the process must be triggered on pod update
func (*Controller) OnDeleteNag ¶
func (plc *Controller) OnDeleteNag(nag *assignmentsv1alpha1.NodeAssignmentGroup)
OnDeleteNag when a nag is deleted clean up all the nodes to make sure they don't have taints from this nag clean up the finalizer
func (*Controller) OnDeleteNode ¶
func (plc *Controller) OnDeleteNode(node *corev1.Node)
OnDeleteNode when a node is deleted rebalance the nags that used to point to it
func (*Controller) OnDeletePod ¶
func (plc *Controller) OnDeletePod(pod *corev1.Pod)
OnDeletePod when a pod is deleted rebalance tha nag that points to the node the pod is running on
func (*Controller) OnUpdateNag ¶
func (plc *Controller) OnUpdateNag(oldNag *assignmentsv1alpha1.NodeAssignmentGroup, newNag *assignmentsv1alpha1.NodeAssignmentGroup)
OnUpdateNag when a nag is updated rebalance it
func (*Controller) OnUpdateNode ¶
func (plc *Controller) OnUpdateNode(oldNode *corev1.Node, newNode *corev1.Node)
OnUpdateNode when a node is updated rebalance all the nags that point to it
func (*Controller) OnUpdatePod ¶
func (plc *Controller) OnUpdatePod(oldPod *corev1.Pod, newPod *corev1.Pod)
OnUpdatePod processes pod updates for PackLeft. The rebalance is only triggered if the NodeName changes this typically happens when a pod is first scheduled onto a node
func (*Controller) ProcessPackLeftNagsForNode ¶
func (plc *Controller) ProcessPackLeftNagsForNode(node *corev1.Node)
ProcessPackLeftNagsForNode takes a node and queues a process for all nags that target it.
func (*Controller) ProcessPodNags ¶
func (plc *Controller) ProcessPodNags(pod *corev1.Pod)
ProcessPodNags finds all the nags associated with a pod and queues a process of them.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager mangaes interactions with nags and the nodes they point to
func NewManager ¶
func NewManager(nagIndex cache.Indexer, nodeIndex cache.Indexer, podIndex cache.Indexer, kubeClient kubernetes.Interface, valetClient valet.Interface) *Manager
NewManager creates a new manager
func (*Manager) CleanAllNodes ¶
func (m *Manager) CleanAllNodes(nag *assignmentsv1alpha1.NodeAssignmentGroup) error
CleanAllNodes clears all attributes for a pack left nag from all nodes
func (*Manager) CleanUnassignedNodes ¶
func (m *Manager) CleanUnassignedNodes(nag *assignmentsv1alpha1.NodeAssignmentGroup)
CleanUnassignedNodes remove taints from nodes that are not assigned to a a packleft assignment
func (*Manager) NodeHasPackLeftAssignment ¶
func (m *Manager) NodeHasPackLeftAssignment(node *corev1.Node, nag *assignmentsv1alpha1.NodeAssignmentGroup) bool
NodeHasPackLeftAssignment check if node is assigned to an assignment that is set to pack left
func (*Manager) NodeHasPackLeftAttributes ¶
func (m *Manager) NodeHasPackLeftAttributes(node *corev1.Node, nag *assignmentsv1alpha1.NodeAssignmentGroup) bool
NodeHasPackLeftAttributes checks to see if the given node has any labels or taints that have come from a given nag
func (*Manager) RebalanceNag ¶
func (m *Manager) RebalanceNag(nag *assignmentsv1alpha1.NodeAssignmentGroup, metric *prometheus.GaugeVec)
RebalanceNag rebalance nodes that are assigned to pack left assignments in a given nag
func (*Manager) RemoveFinalizer ¶
func (m *Manager) RemoveFinalizer(nag *assignmentsv1alpha1.NodeAssignmentGroup) error