Documentation
¶
Overview ¶
Package pods provides pod status for a namespace using kubectl. It supports both a snapshot as well as a continuous stream.
Index ¶
Constants ¶
const ( PodPending = corev1.PodPending // Accepted but not all containers have started. PodRunning = corev1.PodRunning // All containers have started and at least one is running. PodSucceeded = corev1.PodSucceeded // All containers terminated without error. PodFailed = corev1.PodFailed // All containers terminated with at least one error. )
Values for Phase. These constants are copied from k8s.io/api/core/v1 as a convenience.
Variables ¶
var MaxPullTime = time.Minute * 15
MaxPullTime is how long we will give a pod to start after seeing ErrImagePull.
Functions ¶
func WatchPodStatus ¶
func WatchPodStatus(ctx context.Context, client kubernetes.Interface, namespace string) (chan *PodStatus, func(), error)
WatchPodStatus returns a channel on which the status of the pods in the supplied namespace are written.
Types ¶
type ContainerStatus ¶
type ContainerStatus struct { Name string Image string // path of requested image Ready bool // true if ready Reason string // if not empty, the reason it isn't ready Message string // human readable reason Raw *corev1.ContainerStatus }
A ContainerStatus contains the status of a single container in the pod.
func (*ContainerStatus) Equal ¶
func (c *ContainerStatus) Equal(oc *ContainerStatus) bool
func (*ContainerStatus) String ¶
func (c *ContainerStatus) String() string
type PodStatus ¶
type PodStatus struct { Name string // name of pod UID types.UID Namespace string Phase corev1.PodPhase // current phase Ready bool // true if all containers are ready Containers []ContainerStatus InitContainers []ContainerStatus Pod corev1.Pod // copy of the raw pod }
A PodStatus represents the status of a single Pod.
func GetPodStatus ¶
func GetPodStatus(ctx context.Context, client kubernetes.Interface, namespace string) ([]*PodStatus, error)
GetPodStatus returns the status of the pods found in the supplied namespace.
func PodToStatus ¶
PodToStatus returns a pointer to a new PodStatus for pod.
type Watcher ¶ added in v0.1.11
type Watcher struct {
// contains filtered or unexported fields
}
A Watcher watches pod and container updates.
func NewWatcher ¶ added in v0.1.11
NewWatcher returns a Watcher on the provided client or an error. The cancel function is called when the Watcher determines a container has permanently failed. The Watcher will exit if the context provided is canceled, an error is encountered, or Cleanup is called.
func (*Watcher) Cleanup ¶ added in v0.1.11
Cleanup should be called when the Watcher is no longer needed. If the Watcher encountered an error the provided err is logged and the Watcher error is returned, otherwise err is returned.
func (*Watcher) SetProgress ¶ added in v0.1.11
SetProgress determins if progress output should be displayed while watching.