Documentation
¶
Overview ¶
Package controllers is the package that contains the core logic on pods and nodes simulation.
Index ¶
- func NewStagesFromYaml(data []byte) ([]*internalversion.Stage, error)
- type Config
- type Controller
- type Lifecycle
- type LifecycleStage
- type NodeController
- func (c *NodeController) DeleteNode(ctx context.Context, node *corev1.Node) error
- func (c *NodeController) FinalizersModify(ctx context.Context, node *corev1.Node, ...) error
- func (c *NodeController) Has(nodeName string) bool
- func (c *NodeController) ListNodes(ctx context.Context, ch chan<- *corev1.Node, opt metav1.ListOptions) error
- func (c *NodeController) LockNode(ctx context.Context, node *corev1.Node) error
- func (c *NodeController) LockNodes(ctx context.Context, nodes <-chan *corev1.Node)
- func (c *NodeController) Size() int
- func (c *NodeController) Start(ctx context.Context) error
- func (c *NodeController) WatchNodes(ctx context.Context, ch chan<- *corev1.Node, opt metav1.ListOptions) error
- type NodeControllerConfig
- type PodController
- func (c *PodController) DeletePod(ctx context.Context, pod *corev1.Pod) error
- func (c *PodController) FinalizersModify(ctx context.Context, pod *corev1.Pod, ...) error
- func (c *PodController) ListPods(ctx context.Context, ch chan<- *corev1.Pod, opt metav1.ListOptions) error
- func (c *PodController) LockPod(ctx context.Context, pod *corev1.Pod) error
- func (c *PodController) LockPods(ctx context.Context, pods <-chan *corev1.Pod)
- func (c *PodController) LockPodsOnNode(ctx context.Context, nodeName string) error
- func (c *PodController) Start(ctx context.Context) error
- func (c *PodController) WatchPods(ctx context.Context, lockChan chan<- *corev1.Pod, opt metav1.ListOptions) error
- type PodControllerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStagesFromYaml ¶
func NewStagesFromYaml(data []byte) ([]*internalversion.Stage, error)
Types ¶
type Config ¶
type Config struct { EnableCNI bool ClientSet kubernetes.Interface ManageAllNodes bool ManageNodesWithAnnotationSelector string ManageNodesWithLabelSelector string DisregardStatusWithAnnotationSelector string DisregardStatusWithLabelSelector string CIDR string NodeIP string NodeName string NodePort int PodStages []*internalversion.Stage NodeStages []*internalversion.Stage }
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a fake kubelet implementation that can be used to test
func NewController ¶
func NewController(conf Config) (*Controller, error)
NewController creates a new fake kubelet controller
type Lifecycle ¶
type Lifecycle []*LifecycleStage
func NewLifecycle ¶
func NewLifecycle(stages []*internalversion.Stage) (Lifecycle, error)
type LifecycleStage ¶
type LifecycleStage struct {
// contains filtered or unexported fields
}
func (*LifecycleStage) Name ¶
func (s *LifecycleStage) Name() string
func (*LifecycleStage) Next ¶
func (s *LifecycleStage) Next() *internalversion.StageNext
type NodeController ¶
type NodeController struct {
// contains filtered or unexported fields
}
NodeController is a fake nodes implementation that can be used to test
func NewNodeController ¶
func NewNodeController(conf NodeControllerConfig) (*NodeController, error)
NewNodeController creates a new fake nodes controller
func (*NodeController) DeleteNode ¶
DeleteNode deletes a node
func (*NodeController) FinalizersModify ¶
func (c *NodeController) FinalizersModify(ctx context.Context, node *corev1.Node, finalizers *internalversion.StageFinalizers) error
func (*NodeController) Has ¶
func (c *NodeController) Has(nodeName string) bool
func (*NodeController) ListNodes ¶
func (c *NodeController) ListNodes(ctx context.Context, ch chan<- *corev1.Node, opt metav1.ListOptions) error
ListNodes list nodes put into the channel
func (*NodeController) LockNodes ¶
func (c *NodeController) LockNodes(ctx context.Context, nodes <-chan *corev1.Node)
LockNodes locks a nodes from the channel
func (*NodeController) Size ¶
func (c *NodeController) Size() int
func (*NodeController) Start ¶
func (c *NodeController) Start(ctx context.Context) error
Start starts the fake nodes controller if nodeSelectorFunc is not nil, it will use it to determine if the node should be managed
func (*NodeController) WatchNodes ¶
func (c *NodeController) WatchNodes(ctx context.Context, ch chan<- *corev1.Node, opt metav1.ListOptions) error
WatchNodes watch nodes put into the channel
type NodeControllerConfig ¶
type NodeControllerConfig struct { ClientSet kubernetes.Interface NodeSelectorFunc func(node *corev1.Node) bool LockPodsOnNodeFunc func(ctx context.Context, nodeName string) error DisregardStatusWithAnnotationSelector string DisregardStatusWithLabelSelector string ManageNodesWithAnnotationSelector string ManageNodesWithLabelSelector string NodeIP string NodeName string NodePort int Stages []*internalversion.Stage LockNodeParallelism int FuncMap template.FuncMap Recorder record.EventRecorder }
NodeControllerConfig is the configuration for the NodeController
type PodController ¶
type PodController struct {
// contains filtered or unexported fields
}
PodController is a fake pods implementation that can be used to test
func NewPodController ¶
func NewPodController(conf PodControllerConfig) (*PodController, error)
NewPodController creates a new fake pods controller
func (*PodController) FinalizersModify ¶
func (c *PodController) FinalizersModify(ctx context.Context, pod *corev1.Pod, finalizers *internalversion.StageFinalizers) error
func (*PodController) ListPods ¶
func (c *PodController) ListPods(ctx context.Context, ch chan<- *corev1.Pod, opt metav1.ListOptions) error
ListPods list pods put into the channel
func (*PodController) LockPods ¶
func (c *PodController) LockPods(ctx context.Context, pods <-chan *corev1.Pod)
LockPods locks a pods from the channel
func (*PodController) LockPodsOnNode ¶
func (c *PodController) LockPodsOnNode(ctx context.Context, nodeName string) error
LockPodsOnNode locks pods on the node
func (*PodController) Start ¶
func (c *PodController) Start(ctx context.Context) error
Start starts the fake pod controller It will modify the pods status to we want
func (*PodController) WatchPods ¶
func (c *PodController) WatchPods(ctx context.Context, lockChan chan<- *corev1.Pod, opt metav1.ListOptions) error
WatchPods watch pods put into the channel
type PodControllerConfig ¶
type PodControllerConfig struct { EnableCNI bool ClientSet kubernetes.Interface DisregardStatusWithAnnotationSelector string DisregardStatusWithLabelSelector string NodeIP string CIDR string NodeHasFunc func(nodeName string) bool Stages []*internalversion.Stage LockPodParallelism int FuncMap template.FuncMap Recorder record.EventRecorder }
PodControllerConfig is the configuration for the PodController