v1.30.2 Latest Latest

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 691




This section is empty.


View Source
var Semantic = conversion.EqualitiesOrDie(
	func(a, b resource.Quantity) bool {

		return a.Cmp(b) == 0
	func(a, b metav1.MicroTime) bool {
		return a.UTC() == b.UTC()
	func(a, b metav1.Time) bool {
		return a.UTC() == b.UTC()
	func(a, b labels.Selector) bool {
		return a.String() == b.String()
	func(a, b fields.Selector) bool {
		return a.String() == b.String()

Semantic can do semantic deep equality checks for core objects. Example: apiequality.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true


func AddOrUpdateTolerationInPod

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

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

func ClaimContainsAllocatedResourceStatus added in v1.28.0

func ClaimContainsAllocatedResourceStatus(pvc *core.PersistentVolumeClaim) bool

func ClaimContainsAllocatedResources added in v1.28.0

func ClaimContainsAllocatedResources(pvc *core.PersistentVolumeClaim) bool

func ContainsAccessMode added in v1.22.0

func ContainsAccessMode(modes []core.PersistentVolumeAccessMode, mode core.PersistentVolumeAccessMode) bool

func GetAccessModesAsString

func GetAccessModesAsString(modes []core.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,RWOP.

func GetAccessModesFromString

func GetAccessModesFromString(modes string) []core.PersistentVolumeAccessMode

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

func GetDeletionCostFromPodAnnotations added in v1.21.0

func GetDeletionCostFromPodAnnotations(annotations map[string]string) (int32, error)

GetDeletionCostFromPodAnnotations returns the integer value of pod-deletion-cost. Returns 0 if not set or the value is invalid.

func GetPersistentVolumeClaimClass

func GetPersistentVolumeClaimClass(claim *core.PersistentVolumeClaim) string

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

func GetPersistentVolumeClass

func GetPersistentVolumeClass(volume *core.PersistentVolume) string

GetPersistentVolumeClass returns StorageClassName.

func GetTaintsFromNodeAnnotations

func GetTaintsFromNodeAnnotations(annotations map[string]string) ([]core.Taint, error)

GetTaintsFromNodeAnnotations gets the json serialized taints data from Pod.Annotations and converts it to the []Taint type in core.

func GetTolerationsFromPodAnnotations

func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]core.Toleration, error)

GetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations and converts it to the []Toleration type in core.

func HugePageResourceName

func HugePageResourceName(pageSize resource.Quantity) core.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 core.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 IsExtendedResourceName

func IsExtendedResourceName(name core.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 core.ResourceName) bool

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

func IsHugePageResourceValueDivisible added in v1.21.0

func IsHugePageResourceValueDivisible(name core.ResourceName, quantity resource.Quantity) bool

IsHugePageResourceValueDivisible returns true if the resource value of storage is integer multiple of page size.

func IsIntegerResourceName

func IsIntegerResourceName(name core.ResourceName) bool

IsIntegerResourceName returns true if the resource is measured in integer values

func IsNativeResource added in v1.11.0

func IsNativeResource(name core.ResourceName) bool

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

func IsOvercommitAllowed

func IsOvercommitAllowed(name core.ResourceName) bool

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

func IsQuotaHugePageResourceName

func IsQuotaHugePageResourceName(name core.ResourceName) bool

IsQuotaHugePageResourceName returns true if the resource name has the quota related huge page resource prefix.

func IsResourceQuotaScopeValidForResource

func IsResourceQuotaScopeValidForResource(scope core.ResourceQuotaScope, resource core.ResourceName) bool

IsResourceQuotaScopeValidForResource returns true if the resource applies to the specified scope

func IsServiceIPSet

func IsServiceIPSet(service *core.Service) bool

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

func IsStandardContainerResourceName

func IsStandardContainerResourceName(name core.ResourceName) bool

IsStandardContainerResourceName returns true if the container can make a resource request for the specified resource

func IsStandardFinalizerName

func IsStandardFinalizerName(str string) bool

IsStandardFinalizerName checks if the input string is a standard finalizer name

func IsStandardLimitRangeType

func IsStandardLimitRangeType(value core.LimitType) bool

IsStandardLimitRangeType returns true if the type is Pod or Container

func IsStandardQuotaResourceName

func IsStandardQuotaResourceName(name core.ResourceName) bool

IsStandardQuotaResourceName returns true if the resource is known to the quota tracking system

func IsStandardResourceName

func IsStandardResourceName(name core.ResourceName) bool

IsStandardResourceName returns true if the resource is known to the system

func IsStandardResourceQuotaScope

func IsStandardResourceQuotaScope(scope core.ResourceQuotaScope) bool

IsStandardResourceQuotaScope returns true if the scope is a standard value

func NonConvertibleFields

func NonConvertibleFields(annotations map[string]string) map[string]string

NonConvertibleFields iterates over the provided map and filters out all but any keys with the "" prefix.

func PersistentVolumeClaimHasClass

func PersistentVolumeClaimHasClass(claim *core.PersistentVolumeClaim) bool

PersistentVolumeClaimHasClass returns true if given claim has set StorageClassName field.


This section is empty.


Path Synopsis
NOTE: DO NOT use those helper functions through client-go, the package path will be changed in the future.
NOTE: DO NOT use those helper functions through client-go, the package path will be changed in the future.

Jump to

Keyboard shortcuts

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