package status
import "k8s.io/kubernetes/pkg/kubelet/status"
Index ¶
- Constants
- func GenerateAllContainersRestartingCondition(pod *v1.Pod, podStatus *kubecontainer.PodStatus, oldPodStatus *v1.PodStatus, podPhase v1.PodPhase) v1.PodCondition
- func GenerateContainersReadyCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
- func GeneratePodInitializedCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
- func GeneratePodReadyCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, conditions []v1.PodCondition, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
- func GeneratePodReadyToStartContainersCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, podStatus *kubecontainer.PodStatus) v1.PodCondition
- func NeedToReconcilePodReadiness(pod *v1.Pod) bool
- type Manager
- type PodDeletionSafetyProvider
- type PodManager
- type PodStartupLatencyStateHelper
- type PodStatusProvider
Constants ¶
const ( // UnknownContainerStatuses says that all container statuses are unknown. UnknownContainerStatuses = "UnknownContainerStatuses" // PodCompleted says that all related containers have succeeded. PodCompleted = "PodCompleted" // PodFailed says that the pod has failed and as such the containers have failed. PodFailed = "PodFailed" // ContainersNotReady says that one or more containers are not ready. ContainersNotReady = "ContainersNotReady" // ContainersNotInitialized says that one or more init containers have not succeeded. ContainersNotInitialized = "ContainersNotInitialized" // ReadinessGatesNotReady says that one or more pod readiness gates are not ready. ReadinessGatesNotReady = "ReadinessGatesNotReady" // RestartAllContainersStarted says that a container exited and triggered RestartAllContainer action. RestartAllContainersStarted = "RestartAllContainersStarted" )
Functions ¶
func GenerateAllContainersRestartingCondition ¶
func GenerateAllContainersRestartingCondition(pod *v1.Pod, podStatus *kubecontainer.PodStatus, oldPodStatus *v1.PodStatus, podPhase v1.PodPhase) v1.PodCondition
func GenerateContainersReadyCondition ¶
func GenerateContainersReadyCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
GenerateContainersReadyCondition returns the status of "ContainersReady" condition. The status of "ContainersReady" condition is true when all containers are ready.
func GeneratePodInitializedCondition ¶
func GeneratePodInitializedCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
GeneratePodInitializedCondition returns initialized condition if all init containers in a pod are ready, else it returns an uninitialized condition.
func GeneratePodReadyCondition ¶
func GeneratePodReadyCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, conditions []v1.PodCondition, containerStatuses []v1.ContainerStatus, podPhase v1.PodPhase) v1.PodCondition
GeneratePodReadyCondition returns "Ready" condition of a pod. The status of "Ready" condition is "True", if all containers in a pod are ready AND all matching conditions specified in the ReadinessGates have status equal to "True".
func GeneratePodReadyToStartContainersCondition ¶
func GeneratePodReadyToStartContainersCondition(pod *v1.Pod, oldPodStatus *v1.PodStatus, podStatus *kubecontainer.PodStatus) v1.PodCondition
func NeedToReconcilePodReadiness ¶
NeedToReconcilePodReadiness returns if the pod "Ready" condition need to be reconcile
Types ¶
type Manager ¶
type Manager interface {
PodStatusProvider
// Start the API server status sync loop.
Start(ctx context.Context)
// SetPodStatus caches updates the cached status for the given pod, and triggers a status update.
SetPodStatus(logger klog.Logger, pod *v1.Pod, status v1.PodStatus)
// SetContainerReadiness updates the cached container status with the given readiness, and
// triggers a status update.
SetContainerReadiness(logger klog.Logger, podUID types.UID, containerID kubecontainer.ContainerID, ready bool)
// SetContainerStartup updates the cached container status with the given startup, and
// triggers a status update.
SetContainerStartup(logger klog.Logger, podUID types.UID, containerID kubecontainer.ContainerID, started bool)
// TerminatePod resets the container status for the provided pod to terminated and triggers
// a status update.
TerminatePod(logger klog.Logger, pod *v1.Pod)
// RemoveOrphanedStatuses scans the status cache and removes any entries for pods not included in
// the provided podUIDs.
RemoveOrphanedStatuses(logger klog.Logger, podUIDs map[types.UID]bool)
// GetPodResizeConditions returns cached PodStatus Resize conditions value
GetPodResizeConditions(podUID types.UID) []*v1.PodCondition
// SetPodResizePendingCondition caches the last PodResizePending condition for the pod.
// It returns true if the condition reason or observedGeneration is modified as a result of this call.
SetPodResizePendingCondition(podUID types.UID, reason, message string, observedGeneration int64) bool
// SetPodResizeInProgressCondition caches the last PodResizeInProgress condition for the pod.
// This function does not update observedGeneration if the condition already exists, nor does
// it allow the reason or message to be cleared.
// It returns true if the condition is modified as a result of this call, and it returns
// the observedGeneration of the condition.
SetPodResizeInProgressCondition(podUID types.UID, reason, message string, observedGeneration int64) (int64, bool)
// ClearPodResizePendingCondition clears the PodResizePending condition for the pod from the cache.
ClearPodResizePendingCondition(podUID types.UID)
// ClearPodResizeInProgressCondition clears the PodResizeInProgress condition for the pod from the cache.
// If the condition was cleared, it returns the observedGeneration of the cleared condition and true.
// Otherwise it returns zero and false.
ClearPodResizeInProgressCondition(podUID types.UID) (int64, bool)
// IsPodResizeDeferred returns true if the pod resize is currently deferred.
IsPodResizeDeferred(podUID types.UID) bool
// IsPodResizeInfeasible returns true if the pod resize is infeasible.
IsPodResizeInfeasible(podUID types.UID) bool
// BackfillPodResizeConditions backfills the status manager's resize conditions by reading them from the
// provided pods' statuses.
BackfillPodResizeConditions(pods []*v1.Pod)
}
Manager is the Source of truth for kubelet pod status, and should be kept up-to-date with the latest v1.PodStatus. It also syncs updates back to the API server.
func NewManager ¶
func NewManager(kubeClient clientset.Interface, podManager PodManager, podDeletionSafety PodDeletionSafetyProvider, podStartupLatencyHelper PodStartupLatencyStateHelper) Manager
NewManager returns a functional Manager.
type PodDeletionSafetyProvider ¶
type PodDeletionSafetyProvider interface {
// PodCouldHaveRunningContainers returns true if the pod could have running containers.
PodCouldHaveRunningContainers(pod *v1.Pod) bool
}
PodDeletionSafetyProvider provides guarantees that a pod can be safely deleted.
type PodManager ¶
type PodManager interface {
GetPodByUID(types.UID) (*v1.Pod, bool)
GetMirrorPodByPod(*v1.Pod) (*v1.Pod, bool)
TranslatePodUID(uid types.UID) kubetypes.ResolvedPodUID
GetUIDTranslations() (podToMirror map[kubetypes.ResolvedPodUID]kubetypes.MirrorPodUID, mirrorToPod map[kubetypes.MirrorPodUID]kubetypes.ResolvedPodUID)
}
PodManager is the subset of methods the manager needs to observe the actual state of the kubelet. See pkg/k8s.io/kubernetes/pkg/kubelet/pod.Manager for method godoc.
type PodStartupLatencyStateHelper ¶
type PodStartupLatencyStateHelper interface {
RecordStatusUpdated(pod *v1.Pod)
DeletePodStartupState(podUID types.UID)
}
type PodStatusProvider ¶
type PodStatusProvider interface {
// GetPodStatus returns the cached status for the provided pod UID, as well as whether it
// was a cache hit.
GetPodStatus(uid types.UID) (v1.PodStatus, bool)
}
PodStatusProvider knows how to provide status for a pod. It is intended to be used by other components that need to introspect the authoritative status of a pod. The PodStatusProvider represents the actual status of a running pod as the kubelet sees it.
Source Files ¶
generate.go status_manager.go
Directories ¶
| Path | Synopsis |
|---|---|
| pkg/kubelet/status/testing |
- Version
- v1.35.1 (latest)
- Published
- Feb 10, 2026
- Platform
- linux/amd64
- Imports
- 25 packages
- Last checked
- 2 months ago –
Tools for package owners.