pod

package
v0.5.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DaemonsetClusterAutoscalerPodAnnotationKey use to inform the cluster-autoscaler that a pod
	// should be considered as a DaemonSet pod
	DaemonsetClusterAutoscalerPodAnnotationKey = "cluster-autoscaler.kubernetes.io/daemonset-pod"
)

Variables

View Source
var (
	// StandardDaemonSetTolerations contains the tolerations that the EDS controller should add to
	// all pods it manages.
	// For consistency, this list must be in sync with the tolerations that are automatically added
	// by the regular kubernetes DaemonSet controller:
	// https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#taints-and-tolerations
	StandardDaemonSetTolerations = []corev1.Toleration{
		{
			Key:      "node.kubernetes.io/not-ready",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoExecute,
		},
		{
			Key:      "node.kubernetes.io/unreachable",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoExecute,
		},
		{
			Key:      "node.kubernetes.io/disk-pressure",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoSchedule,
		},
		{
			Key:      "node.kubernetes.io/memory-pressure",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoSchedule,
		},
		{
			Key:      "node.kubernetes.io/unschedulable",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoSchedule,
		},
		{
			Key:      "node.kubernetes.io/network-unavailable",
			Operator: corev1.TolerationOpExists,
			Effect:   corev1.TaintEffectNoSchedule,
		},
	}
)

Should be const but GO doesn't support const structures

Functions

func CannotStart added in v0.5.0

CannotStart returns true if the Pod is currently experiencing abnormal start condition

func CreatePodFromDaemonSetReplicaSet

func CreatePodFromDaemonSetReplicaSet(scheme *runtime.Scheme, replicaset *datadoghqv1alpha1.ExtendedDaemonSetReplicaSet, node *corev1.Node, edsNode *datadoghqv1alpha1.ExtendedDaemonsetSetting, addNodeAffinity bool) (*corev1.Pod, error)

CreatePodFromDaemonSetReplicaSet use to create a Pod from a ReplicaSet instance and a specific Node name.

func GetContainerStatus

func GetContainerStatus(statuses []v1.ContainerStatus, name string) (v1.ContainerStatus, bool)

GetContainerStatus extracts the status of container "name" from "statuses". It also returns if "name" exists.

func GetExistingContainerStatus

func GetExistingContainerStatus(statuses []v1.ContainerStatus, name string) v1.ContainerStatus

GetExistingContainerStatus extracts the status of container "name" from "statuses",

func GetPodCondition

func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodConditionFromList

func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.

func GetPodReadyCondition

func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition

GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.

func HasPodSchedulerIssue

func HasPodSchedulerIssue(pod *v1.Pod) bool

HasPodSchedulerIssue returns true if a pod remained unscheduled for more than 10 minutes or if it stayed in `Terminating` state for longer than its grace period.

func HighestRestartCount added in v0.5.0

func HighestRestartCount(pod *v1.Pod) (int, datadoghqv1alpha1.ExtendedDaemonSetStatusReason)

HighestRestartCount checks if a pod in the Canary deployment is restarting This returns the count and the "reason" for the pod with the most restarts

func IsCannotStartReason added in v0.5.0

func IsCannotStartReason(reason string) bool

IsCannotStartReason returns true for a reason that is considered an abnormal cannot start condition

func IsEvicted

func IsEvicted(status *v1.PodStatus) bool

IsEvicted returns whether the status corresponds to an evicted pod

func IsPodAvailable

func IsPodAvailable(pod *v1.Pod, minReadySeconds int32, now metav1.Time) bool

IsPodAvailable returns true if a pod is available; false otherwise. Precondition for an available pod is that it must be ready. On top of that, there are two cases when a pod can be considered available: 1. minReadySeconds == 0, or 2. LastTransitionTime (is set) + minReadySeconds < current time

func IsPodReady

func IsPodReady(pod *v1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status v1.PodStatus) bool

IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.

func IsPodScheduled

func IsPodScheduled(pod *v1.Pod) (string, bool)

IsPodScheduled return true if it is already assigned to a Node

func MostRecentRestart added in v0.5.0

MostRecentRestart returns the most recent restart time for a pod or the time

func PendingCreate added in v0.5.0

func PendingCreate(pod *v1.Pod) bool

PendingCreate returns true if the Pod is pending create (may be an eventually resolving state)

func SortPodByCreationTime

func SortPodByCreationTime(pods []*v1.Pod) []*v1.Pod

SortPodByCreationTime return the pods sorted by creation time from the newer to the older

func UpdatePodCondition

func UpdatePodCondition(status *v1.PodStatus, condition *v1.PodCondition) bool

UpdatePodCondition updates existing pod condition or creates a new one. Sets LastTransitionTime to now if the status has changed. Returns true if pod condition has changed or has been added.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL