Documentation ¶
Index ¶
- Variables
- func InitializeClusterSnapshotOrDie(snapshot ClusterSnapshot, nodes []apiv1.Node, pods []apiv1.Pod)
- type BasicClusterSnapshot
- func (snapshot *BasicClusterSnapshot) AddNode(node *apiv1.Node) error
- func (snapshot *BasicClusterSnapshot) AddNodeWithPods(node *apiv1.Node, pods []*apiv1.Pod) error
- func (snapshot *BasicClusterSnapshot) AddNodes(nodes []*apiv1.Node) error
- func (snapshot *BasicClusterSnapshot) AddPod(pod *apiv1.Pod, nodeName string) error
- func (snapshot *BasicClusterSnapshot) Clear()
- func (snapshot *BasicClusterSnapshot) Commit() error
- func (snapshot *BasicClusterSnapshot) Fork()
- func (snapshot *BasicClusterSnapshot) IsPVCUsedByPods(key string) bool
- func (snapshot *BasicClusterSnapshot) NodeInfos() schedulerframework.NodeInfoLister
- func (snapshot *BasicClusterSnapshot) RemoveNode(nodeName string) error
- func (snapshot *BasicClusterSnapshot) RemovePod(namespace, podName, nodeName string) error
- func (snapshot *BasicClusterSnapshot) Revert()
- func (snapshot *BasicClusterSnapshot) StorageInfos() schedulerframework.StorageInfoLister
- type ClusterSnapshot
Constants ¶
This section is empty.
Variables ¶
var ErrNodeNotFound = errors.New("node not found")
ErrNodeNotFound means that a node wasn't found in the snapshot.
Functions ¶
func InitializeClusterSnapshotOrDie ¶
func InitializeClusterSnapshotOrDie( snapshot ClusterSnapshot, nodes []apiv1.Node, pods []apiv1.Pod)
Types ¶
type BasicClusterSnapshot ¶
type BasicClusterSnapshot struct {
// contains filtered or unexported fields
}
BasicClusterSnapshot is simple, reference implementation of ClusterSnapshot. It is inefficient. But hopefully bug-free and good for initial testing.
func NewBasicClusterSnapshot ¶
func NewBasicClusterSnapshot() *BasicClusterSnapshot
NewBasicClusterSnapshot creates instances of BasicClusterSnapshot.
func (*BasicClusterSnapshot) AddNode ¶
func (snapshot *BasicClusterSnapshot) AddNode(node *apiv1.Node) error
AddNode adds node to the snapshot.
func (*BasicClusterSnapshot) AddNodeWithPods ¶
AddNodeWithPods adds a node and set of pods to be scheduled to this node to the snapshot.
func (*BasicClusterSnapshot) AddNodes ¶
func (snapshot *BasicClusterSnapshot) AddNodes(nodes []*apiv1.Node) error
AddNodes adds nodes in batch to the snapshot.
func (*BasicClusterSnapshot) AddPod ¶
func (snapshot *BasicClusterSnapshot) AddPod(pod *apiv1.Pod, nodeName string) error
AddPod adds pod to the snapshot and schedules it to given node.
func (*BasicClusterSnapshot) Clear ¶
func (snapshot *BasicClusterSnapshot) Clear()
Clear reset cluster snapshot to empty, unforked state
func (*BasicClusterSnapshot) Commit ¶
func (snapshot *BasicClusterSnapshot) Commit() error
Commit commits changes done after forking.
func (*BasicClusterSnapshot) Fork ¶
func (snapshot *BasicClusterSnapshot) Fork()
Fork creates a fork of snapshot state. All modifications can later be reverted to moment of forking via Revert()
func (*BasicClusterSnapshot) IsPVCUsedByPods ¶
func (snapshot *BasicClusterSnapshot) IsPVCUsedByPods(key string) bool
IsPVCUsedByPods returns if the pvc is used by any pod
func (*BasicClusterSnapshot) NodeInfos ¶
func (snapshot *BasicClusterSnapshot) NodeInfos() schedulerframework.NodeInfoLister
NodeInfos exposes snapshot as NodeInfoLister.
func (*BasicClusterSnapshot) RemoveNode ¶
func (snapshot *BasicClusterSnapshot) RemoveNode(nodeName string) error
RemoveNode removes nodes (and pods scheduled to it) from the snapshot.
func (*BasicClusterSnapshot) RemovePod ¶
func (snapshot *BasicClusterSnapshot) RemovePod(namespace, podName, nodeName string) error
RemovePod removes pod from the snapshot.
func (*BasicClusterSnapshot) Revert ¶
func (snapshot *BasicClusterSnapshot) Revert()
Revert reverts snapshot state to moment of forking.
func (*BasicClusterSnapshot) StorageInfos ¶
func (snapshot *BasicClusterSnapshot) StorageInfos() schedulerframework.StorageInfoLister
StorageInfos exposes snapshot as StorageInfoLister.
type ClusterSnapshot ¶
type ClusterSnapshot interface { schedulerframework.SharedLister // AddNode adds node to the snapshot. AddNode(node *apiv1.Node) error // AddNodes adds nodes to the snapshot. AddNodes(nodes []*apiv1.Node) error // RemoveNode removes nodes (and pods scheduled to it) from the snapshot. RemoveNode(nodeName string) error // AddPod adds pod to the snapshot and schedules it to given node. AddPod(pod *apiv1.Pod, nodeName string) error // RemovePod removes pod from the snapshot. RemovePod(namespace string, podName string, nodeName string) error // AddNodeWithPods adds a node and set of pods to be scheduled to this node to the snapshot. AddNodeWithPods(node *apiv1.Node, pods []*apiv1.Pod) error // IsPVCUsedByPods returns if the pvc is used by any pod, key = <namespace>/<pvc_name> IsPVCUsedByPods(key string) bool // Fork creates a fork of snapshot state. All modifications can later be reverted to moment of forking via Revert(). // Use WithForkedSnapshot() helper function instead if possible. Fork() // Revert reverts snapshot state to moment of forking. Revert() // Commit commits changes done after forking. Commit() error // Clear reset cluster snapshot to empty, unforked state. Clear() }
ClusterSnapshot is abstraction of cluster state used for predicate simulations. It exposes mutation methods and can be viewed as scheduler's SharedLister.