Documentation ¶
Index ¶
- type Liveness
- type VNode
- func (vNode *VNode) AddKnowPod(pod *corev1.Pod)
- func (vNode *VNode) CheckAndUpdatePodStatus(ctx context.Context, key string, pod *corev1.Pod)
- func (vNode *VNode) DeleteKnownPod(key string)
- func (vNode *VNode) DeletePodsFromKubernetesForget(ctx context.Context, key string)
- func (vNode *VNode) Done() <-chan struct{}
- func (vNode *VNode) Err() error
- func (vNode *VNode) ExitWhenLeaderChanged() <-chan struct{}
- func (vNode *VNode) GetKnownPod(key string) (any, bool)
- func (vNode *VNode) GetLease() *coordinationv1.Lease
- func (vNode *VNode) GetNodeName() string
- func (vNode *VNode) IsLeader(clientId string) bool
- func (vNode *VNode) IsReady() (bool, error)
- func (vNode *VNode) Run(ctx context.Context, initData model.NodeInfo)
- func (vNode *VNode) Shutdown()
- func (vNode *VNode) StartLeaderElection(ctx context.Context, clientID string)
- func (vNode *VNode) SyncAllContainerInfo(ctx context.Context, infos []model.BizStatusData)
- func (vNode *VNode) SyncNodeStatus(data model.NodeStatusData)
- func (vNode *VNode) SyncOneContainerInfo(ctx context.Context, bizStatusData model.BizStatusData)
- func (vNode *VNode) SyncPodsFromKubernetesEnqueue(ctx context.Context, key string)
- func (vNode *VNode) WaitReady(ctx context.Context, timeout time.Duration) error
- type VNodeProvider
- type VNodeStore
- func (r *VNodeStore) AddVNode(nodeName string, vnode *VNode) error
- func (r *VNodeStore) AllNodeNum() int
- func (r *VNodeStore) DeleteVNode(nodeName string)
- func (r *VNodeStore) GetDeadVNodes() []*VNode
- func (r *VNodeStore) GetLeaseOccupiedVNodes(clientID string) []*VNode
- func (r *VNodeStore) GetLeaseOutdatedVNodeNames(clientID string) []string
- func (r *VNodeStore) GetUnReachableVNodes() []*VNode
- func (r *VNodeStore) GetVNode(nodeName string) *VNode
- func (r *VNodeStore) GetVNodeByNodeName(nodeName string) *VNode
- func (r *VNodeStore) GetVNodes() []*VNode
- func (r *VNodeStore) NodeShutdown(nodeName string)
- func (r *VNodeStore) RunningNodeNum() int
- func (r *VNodeStore) UpdateNodeStateOnProviderArrived(nodeName string, state model.NodeState)
- type VPodProvider
- func (b *VPodProvider) CreatePod(ctx context.Context, pod *corev1.Pod) error
- func (b *VPodProvider) DeletePod(ctx context.Context, pod *corev1.Pod) error
- func (b *VPodProvider) GetPod(_ context.Context, namespace, name string) (*corev1.Pod, error)
- func (b *VPodProvider) GetPodStatus(ctx context.Context, pod *corev1.Pod, bizStatus model.BizStatusData) (*corev1.PodStatus, error)
- func (b *VPodProvider) GetPods(_ context.Context) ([]*corev1.Pod, error)
- func (b *VPodProvider) NotifyPods(_ context.Context, cb func(*corev1.Pod))
- func (b *VPodProvider) SyncAllBizStatusToKube(ctx context.Context, bizStatusDatas []model.BizStatusData)
- func (b *VPodProvider) SyncBizStatusToKube(ctx context.Context, bizStatusData model.BizStatusData)
- func (b *VPodProvider) UpdatePod(ctx context.Context, pod *corev1.Pod) error
- type VPodStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Liveness ¶
Liveness sync and check the status in provider
func (*Liveness) Close ¶
func (liveness *Liveness) Close()
close because the base upload the deactive message
func (*Liveness) IsDead ¶
close by deactive message or timeout for module.NodeLeaseDurationSeconds, this may caused by base offline or leader changed
func (*Liveness) IsReachable ¶
unReachable check the node is unreachable
func (*Liveness) UpdateHeartBeatTime ¶
func (liveness *Liveness) UpdateHeartBeatTime()
type VNode ¶
type VNode struct { Liveness Liveness // Liveness of the node from provider // contains filtered or unexported fields }
VNode is the main struct for a virtual node
func (*VNode) AddKnowPod ¶
AddKnowPod stores the pod in the node
func (*VNode) CheckAndUpdatePodStatus ¶
CheckAndUpdatePodStatus checks and updates a pod in the node
func (*VNode) DeleteKnownPod ¶
DeleteKnownPod deletes a pod from the node
func (*VNode) DeletePodsFromKubernetesForget ¶
DeletePodsFromKubernetesForget deletes pods from Kubernetes in the node
func (*VNode) Done ¶
func (vNode *VNode) Done() <-chan struct{}
Done returns a channel that will be closed when the vnode has exited.
func (*VNode) ExitWhenLeaderChanged ¶
func (vNode *VNode) ExitWhenLeaderChanged() <-chan struct{}
ExitWhenLeaderChanged returns a channel that will be closed when the vnode leader changed
func (*VNode) GetLease ¶
func (vNode *VNode) GetLease() *coordinationv1.Lease
func (*VNode) GetNodeName ¶
func (*VNode) Shutdown ¶
func (vNode *VNode) Shutdown()
Shutdown is the func of shutting down a vnode when base exit
func (*VNode) StartLeaderElection ¶
StartLeaderElection renews the lease of the node
func (*VNode) SyncAllContainerInfo ¶
func (vNode *VNode) SyncAllContainerInfo(ctx context.Context, infos []model.BizStatusData)
SyncAllContainerInfo syncs the status of all containers
func (*VNode) SyncNodeStatus ¶
func (vNode *VNode) SyncNodeStatus(data model.NodeStatusData)
SyncNodeStatus syncs the status of the node
func (*VNode) SyncOneContainerInfo ¶
func (vNode *VNode) SyncOneContainerInfo(ctx context.Context, bizStatusData model.BizStatusData)
SyncOneContainerInfo syncs the status of a single container
func (*VNode) SyncPodsFromKubernetesEnqueue ¶
SyncPodsFromKubernetesEnqueue syncs pods from Kubernetes to the node
type VNodeProvider ¶
VNodeProvider is a struct that implements the NodeProvider interface.
func NewVNodeProvider ¶
func NewVNodeProvider(config *model.BuildVNodeConfig) *VNodeProvider
NewVNodeProvider creates a new VNodeProvider instance.
func (*VNodeProvider) Notify ¶
func (v *VNodeProvider) Notify(data model.NodeStatusData)
Notify updates the latest node status data and notifies about the change.
func (*VNodeProvider) NotifyNodeStatus ¶
func (v *VNodeProvider) NotifyNodeStatus(_ context.Context, cb func(*corev1.Node))
NotifyNodeStatus sets a callback function to notify about node status changes.
type VNodeStore ¶
VNodeStore provide the in memory runtime information.
func NewVNodeStore ¶
func NewVNodeStore() *VNodeStore
NewVNodeStore creates a new instance of VNodeStore.
func (*VNodeStore) AddVNode ¶
func (r *VNodeStore) AddVNode(nodeName string, vnode *VNode) error
AddVNode adds a VNode to the node name to VNode map.
func (*VNodeStore) AllNodeNum ¶
func (r *VNodeStore) AllNodeNum() int
AllNodeNum returns the number of all nodes.
func (*VNodeStore) DeleteVNode ¶
func (r *VNodeStore) DeleteVNode(nodeName string)
DeleteVNode removes a VNode from the node name to VNode map.
func (*VNodeStore) GetDeadVNodes ¶
func (r *VNodeStore) GetDeadVNodes() []*VNode
GetDeadVNodes returns the node information of nodes that are not reachable.
func (*VNodeStore) GetLeaseOccupiedVNodes ¶
func (r *VNodeStore) GetLeaseOccupiedVNodes(clientID string) []*VNode
func (*VNodeStore) GetLeaseOutdatedVNodeNames ¶
func (r *VNodeStore) GetLeaseOutdatedVNodeNames(clientID string) []string
GetLeaseOutdatedVNodeNames returns the node ids of outdated leases.
func (*VNodeStore) GetUnReachableVNodes ¶
func (r *VNodeStore) GetUnReachableVNodes() []*VNode
GetUnReachableVNodes returns the node information of nodes that are not reachable.
func (*VNodeStore) GetVNode ¶
func (r *VNodeStore) GetVNode(nodeName string) *VNode
GetVNode returns a VNode for a given node ID.
func (*VNodeStore) GetVNodeByNodeName ¶
func (r *VNodeStore) GetVNodeByNodeName(nodeName string) *VNode
GetVNodeByNodeName returns a VNode for a given node name.
func (*VNodeStore) GetVNodes ¶
func (r *VNodeStore) GetVNodes() []*VNode
GetVNodes returns all VNodes.
func (*VNodeStore) NodeShutdown ¶
func (r *VNodeStore) NodeShutdown(nodeName string)
NodeShutdown removes a node from the running node map.
func (*VNodeStore) RunningNodeNum ¶
func (r *VNodeStore) RunningNodeNum() int
RunningNodeNum returns the number of running nodes.
func (*VNodeStore) UpdateNodeStateOnProviderArrived ¶
func (r *VNodeStore) UpdateNodeStateOnProviderArrived(nodeName string, state model.NodeState)
UpdateNodeStateOnProviderArrived updates the latest message time for a given node ID.
type VPodProvider ¶
type VPodProvider struct { Namespace string // contains filtered or unexported fields }
VPodProvider is a struct that implements the nodeutil.Provider and virtual_kubelet.PodNotifier interfaces
func NewVPodProvider ¶
func NewVPodProvider(namespace, localIP, nodeName string, client client.Client, tunnel tunnel.Tunnel) *VPodProvider
NewVPodProvider is a function that creates a new VPodProvider instance
func (*VPodProvider) GetPod ¶
GetPod is a method of VPodProvider that gets a pod This method is simply used to return the observed defaultPod by local
so the outer control loop can call CreatePod / UpdatePod / DeletePod accordingly just return the defaultPod from the local store
func (*VPodProvider) GetPodStatus ¶
func (b *VPodProvider) GetPodStatus(ctx context.Context, pod *corev1.Pod, bizStatus model.BizStatusData) (*corev1.PodStatus, error)
GetPodStatus is a method of VPodProvider that gets the status of a pod This will be called repeatedly by virtual kubelet framework to get the defaultPod status we should query the actual runtime info and convert them in to V1PodStatus accordingly
func (*VPodProvider) NotifyPods ¶
func (b *VPodProvider) NotifyPods(_ context.Context, cb func(*corev1.Pod))
NotifyPods is a method of VPodProvider that sets the notify function
func (*VPodProvider) SyncAllBizStatusToKube ¶
func (b *VPodProvider) SyncAllBizStatusToKube(ctx context.Context, bizStatusDatas []model.BizStatusData)
SyncAllBizStatusToKube is a method of VPodProvider that synchronizes the information of all containers
func (*VPodProvider) SyncBizStatusToKube ¶
func (b *VPodProvider) SyncBizStatusToKube(ctx context.Context, bizStatusData model.BizStatusData)
SyncBizStatusToKube is a method of VPodProvider that synchronizes the information of a single container
type VPodStore ¶
type VPodStore struct { sync.RWMutex // This mutex is used for thread-safe access to the store. // contains filtered or unexported fields }
VPodStore provides in-memory runtime information.
func NewVPodStore ¶
func NewVPodStore() *VPodStore
func (*VPodStore) CheckContainerStatusNeedSync ¶
func (r *VPodStore) CheckContainerStatusNeedSync(bizStatusData model.BizStatusData) bool
func (*VPodStore) GetPodByKey ¶
GetPodByKey function retrieves a pod by its key.