util

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateDaemonPodTolerations

func AddOrUpdateDaemonPodTolerations(spec *v1.PodSpec)

AddOrUpdateDaemonPodTolerations apply necessary tolerations to DaemonSet Pods, e.g. node.kubernetes.io/not-ready:NoExecute.

func CreatePodTemplate

func CreatePodTemplate(template ketiv1.PodTemplateSpec, generation *int64, hash string) ketiv1.PodTemplateSpec

CreatePodTemplate returns copy of provided template with additional label which contains templateGeneration (for backward compatibility), hash of provided template and sets default daemon tolerations.

func GetTargetNodeName

func GetTargetNodeName(pod *ketiv1.Pod) (string, error)

GetTargetNodeName get the target node name of DaemonSet pods. If `.spec.NodeName` is not empty (nil), return `.spec.NodeName`; otherwise, retrieve node name of pending pods from NodeAffinity. Return error if failed to retrieve node name from `.spec.NodeName` and NodeAffinity.

func GetTemplateGeneration

func GetTemplateGeneration(ds *ketiv1.DaemonSet) (*int64, error)

GetTemplateGeneration gets the template generation associated with a v1.DaemonSet by extracting it from the deprecated annotation. If no annotation is found nil is returned. If the annotation is found and fails to parse nil is returned with an error. If the generation can be parsed from the annotation, a pointer to the parsed int64 value is returned.

func IsPodUpdated

func IsPodUpdated(pod *ketiv1.Pod, hash string, dsTemplateGeneration *int64) bool

IsPodUpdated checks if pod contains label value that either matches templateGeneration or hash

func ReplaceDaemonSetPodNodeNameNodeAffinity

func ReplaceDaemonSetPodNodeNameNodeAffinity(affinity *v1.Affinity, nodename string) *v1.Affinity

ReplaceDaemonSetPodNodeNameNodeAffinity replaces the RequiredDuringSchedulingIgnoredDuringExecution NodeAffinity of the given affinity with a new NodeAffinity that selects the given nodeName. Note that this function assumes that no NodeAffinity conflicts with the selected nodeName.

func SplitByAvailablePods

func SplitByAvailablePods(minReadySeconds int32, pods []*ketiv1.Pod) ([]*ketiv1.Pod, []*ketiv1.Pod)

SplitByAvailablePods splits provided daemon set pods by availability

Types

This section is empty.

Jump to

Keyboard shortcuts

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