Documentation ¶
Index ¶
- func DumpJSON(o interface{}) string
- func GetContainer(name string, pod *v1.Pod) *v1.Container
- func GetContainerEnvValue(container *v1.Container, key string) string
- func GetContainerEnvVar(container *v1.Container, key string) *v1.EnvVar
- func GetContainerStatus(name string, pod *v1.Pod) *v1.ContainerStatus
- func GetContainerVolumeMount(container *v1.Container, key string) *v1.VolumeMount
- func GetNamespace() string
- func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodContainerImageIDs(pod *v1.Pod) map[string]string
- func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
- func IsContainerImageEqual(image1, image2 string) bool
- func IsImageDigest(image string) bool
- func IsPodReady(pod *v1.Pod) bool
- func IsPodReadyConditionTrue(status v1.PodStatus) bool
- func IsRunningAndReady(pod *v1.Pod) bool
- func MergeEnvVar(original []v1.EnvVar, additional []v1.EnvVar) []v1.EnvVar
- func MergeVolumeMounts(original, additional []v1.VolumeMount) []v1.VolumeMount
- func MergeVolumes(original []v1.Volume, additional []v1.Volume) []v1.Volume
- func ParseImage(image string) (repo, tag, digest string, err error)
- func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool)
- func ValidatedLabelSelectorAsSelector(ps *metav1.LabelSelector) (labels.Selector, error)
- type ActivePods
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContainerStatus ¶
func GetContainerStatus(name string, pod *v1.Pod) *v1.ContainerStatus
func GetContainerVolumeMount ¶
func GetContainerVolumeMount(container *v1.Container, key string) *v1.VolumeMount
func GetNamespace ¶
func GetNamespace() string
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 IsContainerImageEqual ¶
1. image1, image2 are digest image, compare repo+digest 2. image1, image2 are normal image, compare repo+tag 3. image1, image2 are digest+normal image, don't support compare it, return false
func IsImageDigest ¶
whether image is digest format, for example: docker.io/busybox@sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.
func IsRunningAndReady ¶
func MergeVolumeMounts ¶
func MergeVolumeMounts(original, additional []v1.VolumeMount) []v1.VolumeMount
func ParseImage ¶
parse container images, 1. docker.io/busybox@sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d repo=docker.io/busybox, tag="", digest=sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d 2. docker.io/busybox:latest repo=docker.io/busybox, tag=latest, digest=""
func SplitMaybeSubscriptedPath ¶
SplitMaybeSubscriptedPath checks whether the specified fieldPath is subscripted, and
- if yes, this function splits the fieldPath into path and subscript, and returns (path, subscript, true).
- if no, this function returns (fieldPath, "", false).
Example inputs and outputs:
- "metadata.annotations['myKey']" --> ("metadata.annotations", "myKey", true)
- "metadata.annotations['a[b]c']" --> ("metadata.annotations", "a[b]c", true)
- "metadata.labels[”]" --> ("metadata.labels", "", true)
- "metadata.labels" --> ("metadata.labels", "", false)
func ValidatedLabelSelectorAsSelector ¶
func ValidatedLabelSelectorAsSelector(ps *metav1.LabelSelector) (labels.Selector, error)
Types ¶
type ActivePods ¶
ActivePods type allows custom sorting of pods so a controller can pick the best ones to delete.
func (ActivePods) Len ¶
func (s ActivePods) Len() int
func (ActivePods) Less ¶
func (s ActivePods) Less(i, j int) bool
func (ActivePods) Swap ¶
func (s ActivePods) Swap(i, j int)