Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeCacheHandlerWrapper ¶
func MakeCacheHandlerWrapper() *handlerWrapper
Types ¶
type CacheHandler ¶
type CacheHandler interface { ComponentName() string SchedulerType() string SubCluster() string SwitchType() framework.SwitchType // TODO: Revisit this and split the judgment section on whether storage needs to be enabled. IsStoreEnabled(string) bool PodAssumedTTL() time.Duration Period() time.Duration ReservationTTL() time.Duration StopCh() <-chan struct{} Mutex() *sync.RWMutex PodLister() corelister.PodLister PvcLister() corelister.PersistentVolumeClaimLister PodInformer() coreinformers.PodInformer // GetNodeInfo return the NodeInfo before NodeStore handle the event. GetNodeInfo(string) framework.NodeInfo // GetPodState return the PodState before PodStore handle the event. GetPodState(string) (*framework.CachePodState, bool) SetNodeHandler(NodeHandler) SetPodHandler(PodHandler) PodOp(pod *v1.Pod, isAdd bool, skippedStores sets.String) error SetPodOpFunc(PodOpFunc) }
type ClusterEventsHandler ¶
type ClusterEventsHandler interface { // AddPod either confirms a pod if it's assumed, or adds it back if it's expired. // If added back, the pod's information would be added again. AddPod(pod *v1.Pod) error // UpdatePod removes oldPod's information and adds newPod's information. UpdatePod(oldPod, newPod *v1.Pod) error // DeletePod removes a pod. The pod's information would be subtracted from assigned node. DeletePod(pod *v1.Pod) error // AddNode adds overall information about node. AddNode(node *v1.Node) error // UpdateNode updates overall information about node. UpdateNode(oldNode, newNode *v1.Node) error // DeleteNode removes overall information about node. DeleteNode(node *v1.Node) error // AddNMNode adds overall information about nmnode. AddNMNode(nmNode *nodev1alpha1.NMNode) error // UpdateNMNode updates overall information about nmnode. UpdateNMNode(oldNMNode, newNMNode *nodev1alpha1.NMNode) error // DeleteNMNode removes overall information about nmnode. DeleteNMNode(nmNode *nodev1alpha1.NMNode) error // AddCNR adds custom resource information about node AddCNR(cnr *katalystv1alpha1.CustomNodeResource) error // UpdateCNR updates custom resource information about node. UpdateCNR(oldCNR, newCNR *katalystv1alpha1.CustomNodeResource) error // RemoveCNR removes custom resource information about node. DeleteCNR(cnr *katalystv1alpha1.CustomNodeResource) error // AddPodGroup adds overall information about pod group. AddPodGroup(podGroup *schedulingv1a1.PodGroup) error // UpdatePodGroup update information about pod group. UpdatePodGroup(oldPodGroup, newPodGroup *schedulingv1a1.PodGroup) error // DeletePodGroup remove overall information about pod group. DeletePodGroup(podGroup *schedulingv1a1.PodGroup) error AddPDB(pdb *policy.PodDisruptionBudget) error UpdatePDB(oldPdb, newPdb *policy.PodDisruptionBudget) error DeletePDB(pdb *policy.PodDisruptionBudget) error AddOwner(ownerType, key string, labels map[string]string) error UpdateOwner(ownerType, key string, oldLabels, newLabels map[string]string) error DeleteOwner(ownerType, key string) error AddMovement(movement *schedulingv1a1.Movement) error UpdateMovement(oldMovement, newMovement *schedulingv1a1.Movement) error DeleteMovement(movement *schedulingv1a1.Movement) error AddReservation(request *schedulingv1a1.Reservation) error UpdateReservation(oldRequest, newRequest *schedulingv1a1.Reservation) error DeleteReservation(request *schedulingv1a1.Reservation) error }
ClusterEventsHandler collects pods' information and provides node-level aggregated information. It's intended for generic scheduler to do efficient lookup. Cache's operations are pod centric. It does incremental updates based on pod events. Pod events are sent via network. We don't have guaranteed delivery of all events: We use Reflector to list and watch from remote. Reflector might be slow and do a relist, which would lead to missing events.
State Machine of a pod's events in scheduler's cache:
+-------------------------------------------+ +----+ | Add | | | | | | | Update + Assume Add v v |
Initial +--------> Assumed +------------+---> Added <--+
^ + + | + | | | | | | | | Add | | Remove | | | | | | | | + | +----------------+ +-----------> Expired +----> Deleted Forget Expire
Note that an assumed pod can expire, because if we haven't received Add event notifying us for a while, there might be some problems, and we shouldn't keep the pod in cache anymore.
Note that "Initial", "Expired", and "Deleted" pods do not actually exist in cache. Based on existing use cases, we are making the following assumptions:
- No pod would be assumed twice
- A pod could be added without going through scheduler. In this case, we will see Add but not Assume event.
- If a pod wasn't added, it wouldn't be removed or updated.
- Both "Expired" and "Deleted" are valid end states. In case of some problems, e.g. network issue, a pod might have changed its state (e.g. added and deleted) without delivering notification to the cache.
type NodeHandler ¶
type PodHandler ¶
type PodHandler func(string) (*framework.CachePodState, bool)