Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeProvider ¶
type NodeProvider interface { // Ping checks if the node is still active. // This is intended to be lightweight as it will be called periodically as a // heartbeat to keep the node marked as ready in Kubernetes. Ping(context.Context) error // ConfigureNode enables a provider to configure the node object that // will be used for Kubernetes. ConfigureNode(context.Context, string) *v1.Node // RefreshNodeStatus return if the node status changes RefreshNodeStatus(ctx context.Context, nodeStatus *v1.NodeStatus) bool // SetStatusUpdateCallback is used to asynchronously monitor the node. // The passed in callback should be called any time there is a change to the // node's status. // This will generally trigger a call to the Kubernetes API server to update // the status. // // SetStatusUpdateCallback should not block callers. SetStatusUpdateCallback(ctx context.Context, cb func(*v1.Node)) }
NodeProvider is the interface used for registering a node and updating its status in Kubernetes.
Note: Implementers can choose to manage a node themselves, in which case it is not needed to provide an implementation for this interface.
type PodLifecycleHandler ¶
type PodLifecycleHandler interface { SyncPod(ctx context.Context, pod *v1.Pod, podStatus *pkgcontainer.PodStatus, reasonCache *ReasonCache) error KillPod(ctx context.Context, pod *v1.Pod, runningPod pkgcontainer.Pod, gracePeriodOverride *int64) error // DeletePod Pod object in master is gone, so just delete pod in provider and no need to call NotifyPods // after deletion. DeletePod(ctx context.Context, pod *v1.Pod) error CleanupPods(ctx context.Context, pods []*v1.Pod, runningPods []*pkgcontainer.Pod, possiblyRunningPods map[types.UID]sets.Empty) error RefreshPodStatus(pod *v1.Pod, podStatus *v1.PodStatus) GetPodStatus(ctx context.Context, pod *v1.Pod) (*pkgcontainer.PodStatus, error) GetPods(ctx context.Context, all bool) ([]*pkgcontainer.Pod, error) // Start sync loop Start(ctx context.Context) error // Stop sync loop Stop() }
PodLifecycleHandler defines the interface used by the PodsController to react to new and changed pods scheduled to the node that is being managed.
type PodProvider ¶
type PodProvider interface { PodLifecycleHandler }
type ReasonCache ¶
type ReasonCache struct {
// contains filtered or unexported fields
}
ReasonCache stores the failure reason of the latest container start in a string, keyed by <pod_UID>_<container_name>. The goal is to propagate this reason to the container status. This endeavor is "best-effort" for two reasons:
- The cache is not persisted.
- We use an LRU cache to avoid extra garbage collection work. This means that some entries may be recycled before a pod has been deleted.
TODO(random-liu): Use more reliable cache which could collect garbage of failed pod. TODO(random-liu): Move reason cache to somewhere better.
func NewReasonCache ¶
func NewReasonCache() *ReasonCache
NewReasonCache creates an instance of 'ReasonCache'.
func (*ReasonCache) Get ¶
func (c *ReasonCache) Get(uid types.UID, name string) (*ReasonItem, bool)
Get gets error reason from the cache. The return values are error reason, error message and whether an error reason is found in the cache. If no error reason is found, empty string will be returned for error reason and error message.
func (*ReasonCache) Remove ¶
func (c *ReasonCache) Remove(uid types.UID, name string)
Remove removes error reason from the cache
func (*ReasonCache) Update ¶
func (c *ReasonCache) Update(uid types.UID, result pkgcontainer.PodSyncResult)
Update updates the reason cache with the SyncPodResult. Only SyncResult with StartContainer action will change the cache.
type ReasonItem ¶
ReasonItem is the cached item in ReasonCache