Documentation
¶
Index ¶
- func GenerateSerialNumber(n int, minLen int, fun func(string) bool)
- type Config
- type Controller
- type Logger
- type NodeController
- func (c *NodeController) CreateNode(ctx context.Context, nodeName string) error
- func (c *NodeController) Has(nodeName string) bool
- func (c *NodeController) KeepNodeHeartbeat(ctx context.Context)
- func (c *NodeController) ListNodes(ctx context.Context, ch chan<- string, opt metav1.ListOptions) error
- func (c *NodeController) LockNode(ctx context.Context, nodeName string) (*corev1.Node, error)
- func (c *NodeController) LockNodes(ctx context.Context, nodes <-chan string)
- func (c *NodeController) Size() int
- func (c *NodeController) Start(ctx context.Context) error
- func (c *NodeController) WatchNodes(ctx context.Context, ch chan<- string, opt metav1.ListOptions) error
- type NodeControllerConfig
- type PodController
- func (c *PodController) DeletePod(ctx context.Context, pod *corev1.Pod) error
- func (c *PodController) DeletePods(ctx context.Context, pods <-chan *corev1.Pod)
- 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, deleteChan chan<- *corev1.Pod, ...) error
- type PodControllerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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
func (*Controller) CreateNode ¶ added in v0.7.3
func (c *Controller) CreateNode(ctx context.Context, nodeName string) error
type NodeController ¶ added in v0.5.0
type NodeController struct {
// contains filtered or unexported fields
}
NodeController is a fake nodes implementation that can be used to test
func NewNodeController ¶ added in v0.5.0
func NewNodeController(conf NodeControllerConfig) (*NodeController, error)
NewNodeController creates a new fake nodes controller
func (*NodeController) CreateNode ¶ added in v0.7.3
func (c *NodeController) CreateNode(ctx context.Context, nodeName string) error
CreateNode create a node use node template
func (*NodeController) Has ¶ added in v0.5.0
func (c *NodeController) Has(nodeName string) bool
func (*NodeController) KeepNodeHeartbeat ¶ added in v0.5.0
func (c *NodeController) KeepNodeHeartbeat(ctx context.Context)
KeepNodeHeartbeat keep node heartbeat
func (*NodeController) ListNodes ¶ added in v0.5.0
func (c *NodeController) ListNodes(ctx context.Context, ch chan<- string, opt metav1.ListOptions) error
ListNodes list nodes put into the channel
func (*NodeController) LockNodes ¶ added in v0.5.0
func (c *NodeController) LockNodes(ctx context.Context, nodes <-chan string)
LockNodes locks a nodes from the channel if they don't exist we create them and then take over them if they exist we take over them
func (*NodeController) Size ¶ added in v0.7.3
func (c *NodeController) Size() int
func (*NodeController) Start ¶ added in v0.5.0
func (c *NodeController) Start(ctx context.Context) error
Start starts the fake nodes controller It will create and take over the nodes and keep them alive if nodeSelectorFunc is not nil, it will use it to determine if the node should be taken over
func (*NodeController) WatchNodes ¶ added in v0.5.0
func (c *NodeController) WatchNodes(ctx context.Context, ch chan<- string, opt metav1.ListOptions) error
WatchNodes watch nodes put into the channel
type NodeControllerConfig ¶ added in v0.5.0
type NodeControllerConfig struct { ClientSet kubernetes.Interface NodeSelectorFunc func(node *corev1.Node) bool NodeLabelSelector string LockPodsOnNodeFunc func(nodeName string) error NodeIP string NodeTemplate string NodeInitializationTemplate string NodeHeartbeatTemplate string Logger Logger NodeHeartbeatInterval time.Duration NodeHeartbeatParallelism int LockNodeParallelism int FuncMap template.FuncMap }
NodeControllerConfig is the configuration for the NodeController
type PodController ¶ added in v0.5.0
type PodController struct {
// contains filtered or unexported fields
}
PodController is a fake pods implementation that can be used to test
func NewPodController ¶ added in v0.5.0
func NewPodController(conf PodControllerConfig) (*PodController, error)
NewPodController creates a new fake pods controller
func (*PodController) DeletePods ¶ added in v0.5.0
func (c *PodController) DeletePods(ctx context.Context, pods <-chan *corev1.Pod)
DeletePods deletes pods from the channel
func (*PodController) ListPods ¶ added in v0.5.0
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 ¶ added in v0.5.0
func (c *PodController) LockPods(ctx context.Context, pods <-chan *corev1.Pod)
LockPods locks a pods from the channel
func (*PodController) LockPodsOnNode ¶ added in v0.5.0
func (c *PodController) LockPodsOnNode(ctx context.Context, nodeName string) error
LockPodsOnNode locks pods on the node
func (*PodController) Start ¶ added in v0.5.0
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 ¶ added in v0.5.0
func (c *PodController) WatchPods(ctx context.Context, lockChan, deleteChan chan<- *corev1.Pod, opt metav1.ListOptions) error
WatchPods watch pods put into the channel
type PodControllerConfig ¶ added in v0.5.0
type PodControllerConfig struct { ClientSet kubernetes.Interface PodCustomStatusAnnotationSelector string NodeIP string CIDR string NodeHasFunc func(nodeName string) bool PodStatusTemplate string Logger Logger LockPodParallelism int DeletePodParallelism int FuncMap template.FuncMap }
PodControllerConfig is the configuration for the PodController