helper

package
v1.10.6-lite6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateTolerationInPod

func AddOrUpdateTolerationInPod(pod *v1.Pod, toleration *v1.Toleration) bool

AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list. Returns true if something was updated, false otherwise.

func AddOrUpdateTolerationInPodSpec

func AddOrUpdateTolerationInPodSpec(spec *v1.PodSpec, toleration *v1.Toleration) bool

AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec. Returns true if something was updated, false otherwise.

func AddToNodeAddresses

func AddToNodeAddresses(addresses *[]v1.NodeAddress, addAddresses ...v1.NodeAddress)

AddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice, only if they do not already exist

func GetAccessModesAsString

func GetAccessModesAsString(modes []v1.PersistentVolumeAccessMode) string

GetAccessModesAsString returns a string representation of an array of access modes. modes, when present, are always in the same order: RWO,ROX,RWX.

func GetAccessModesFromString

func GetAccessModesFromString(modes string) []v1.PersistentVolumeAccessMode

GetAccessModesAsString returns an array of AccessModes from a string created by GetAccessModesAsString

func GetAvoidPodsFromNodeAnnotations

func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (v1.AvoidPods, error)

func GetMatchingTolerations

func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (bool, []v1.Toleration)

Returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise.

func GetPersistentVolumeClaimClass

func GetPersistentVolumeClaimClass(claim *v1.PersistentVolumeClaim) string

GetPersistentVolumeClaimClass returns StorageClassName. If no storage class was requested, it returns "".

func GetPersistentVolumeClass

func GetPersistentVolumeClass(volume *v1.PersistentVolume) string

GetPersistentVolumeClass returns StorageClassName.

func GetStorageNodeAffinityFromAnnotation

func GetStorageNodeAffinityFromAnnotation(annotations map[string]string) (*v1.NodeAffinity, error)

GetStorageNodeAffinityFromAnnotation gets the json serialized data from PersistentVolume.Annotations and converts it to the NodeAffinity type in api. TODO: update when storage node affinity graduates to beta

func HugePageResourceName

func HugePageResourceName(pageSize resource.Quantity) v1.ResourceName

HugePageResourceName returns a ResourceName with the canonical hugepage prefix prepended for the specified page size. The page size is converted to its canonical representation.

func HugePageSizeFromResourceName

func HugePageSizeFromResourceName(name v1.ResourceName) (resource.Quantity, error)

HugePageSizeFromResourceName returns the page size for the specified huge page resource name. If the specified input is not a valid huge page resource name an error is returned.

func IsDefaultNamespaceResource

func IsDefaultNamespaceResource(name v1.ResourceName) bool

IsDefaultNamespaceResource returns true if the resource name is in the *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are implicitly in the kubernetes.io/ namespace.

func IsExtendedResourceName

func IsExtendedResourceName(name v1.ResourceName) bool

IsExtendedResourceName returns true if: 1. the resource name is not in the default namespace; 2. resource name does not have "requests." prefix, to avoid confusion with the convention in quota 3. it satisfies the rules in IsQualifiedName() after converted into quota resource name

func IsHugePageResourceName

func IsHugePageResourceName(name v1.ResourceName) bool

IsHugePageResourceName returns true if the resource name has the huge page resource prefix.

func IsOvercommitAllowed

func IsOvercommitAllowed(name v1.ResourceName) bool

IsOvercommitAllowed returns true if the resource is in the default namespace and not blacklisted and is not hugepages.

func IsScalarResourceName

func IsScalarResourceName(name v1.ResourceName) bool

Extended and Hugepages resources

func IsServiceIPSet

func IsServiceIPSet(service *v1.Service) bool

this function aims to check if the service's ClusterIP is set or not the objective is not to perform validation here

func LoadBalancerStatusDeepCopy

func LoadBalancerStatusDeepCopy(lb *v1.LoadBalancerStatus) *v1.LoadBalancerStatus

TODO: make method on LoadBalancerStatus?

func LoadBalancerStatusEqual

func LoadBalancerStatusEqual(l, r *v1.LoadBalancerStatus) bool

TODO: make method on LoadBalancerStatus?

func NodeSelectorRequirementsAsSelector

func NodeSelectorRequirementsAsSelector(nsm []v1.NodeSelectorRequirement) (labels.Selector, error)

NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements labels.Selector.

func PodAnnotationsFromSysctls

func PodAnnotationsFromSysctls(sysctls []v1.Sysctl) string

PodAnnotationsFromSysctls creates an annotation value for a slice of Sysctls.

func StorageNodeAffinityToAlphaAnnotation

func StorageNodeAffinityToAlphaAnnotation(annotations map[string]string, affinity *v1.NodeAffinity) error

Converts NodeAffinity type to Alpha annotation for use in PersistentVolumes TODO: update when storage node affinity graduates to beta

func SysctlsFromPodAnnotation

func SysctlsFromPodAnnotation(annotation string) ([]v1.Sysctl, error)

SysctlsFromPodAnnotation parses an annotation value into a slice of Sysctls.

func SysctlsFromPodAnnotations

func SysctlsFromPodAnnotations(a map[string]string) ([]v1.Sysctl, []v1.Sysctl, error)

SysctlsFromPodAnnotations parses the sysctl annotations into a slice of safe Sysctls and a slice of unsafe Sysctls. This is only a convenience wrapper around SysctlsFromPodAnnotation.

func TolerationsTolerateTaint

func TolerationsTolerateTaint(tolerations []v1.Toleration, taint *v1.Taint) bool

TolerationsTolerateTaint checks if taint is tolerated by any of the tolerations.

func TolerationsTolerateTaintsWithFilter

func TolerationsTolerateTaintsWithFilter(tolerations []v1.Toleration, taints []v1.Taint, applyFilter taintsFilterFunc) bool

TolerationsTolerateTaintsWithFilter checks if given tolerations tolerates all the taints that apply to the filter in given taint list.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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