// 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 IsExtendedResourceName(name v1.ResourceName) bool { … } // IsPrefixedNativeResource returns true if the resource name is in the // *kubernetes.io/ namespace. func IsPrefixedNativeResource(name v1.ResourceName) bool { … } // IsNativeResource returns true if the resource name is in the // *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are // implicitly in the kubernetes.io/ namespace. func IsNativeResource(name v1.ResourceName) bool { … } // IsHugePageResourceName returns true if the resource name has the huge page // resource prefix. func IsHugePageResourceName(name v1.ResourceName) bool { … } // 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 HugePageResourceName(pageSize resource.Quantity) v1.ResourceName { … } // 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 HugePageSizeFromResourceName(name v1.ResourceName) (resource.Quantity, error) { … } // HugePageUnitSizeFromByteSize returns hugepage size has the format. // `size` must be guaranteed to divisible into the largest units that can be expressed. // <size><unit-prefix>B (1024 = "1KB", 1048576 = "1MB", etc). func HugePageUnitSizeFromByteSize(size int64) (string, error) { … } // IsHugePageMedium returns true if the volume medium is in 'HugePages[-size]' format func IsHugePageMedium(medium v1.StorageMedium) bool { … } // HugePageSizeFromMedium returns the page size for the specified huge page medium. // If the specified input is not a valid huge page medium an error is returned. func HugePageSizeFromMedium(medium v1.StorageMedium) (resource.Quantity, error) { … } // IsOvercommitAllowed returns true if the resource is in the default // namespace and is not hugepages. func IsOvercommitAllowed(name v1.ResourceName) bool { … } // IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume func IsAttachableVolumeResourceName(name v1.ResourceName) bool { … } // IsServiceIPSet aims to check if the service's ClusterIP is set or not // the objective is not to perform validation here func IsServiceIPSet(service *v1.Service) bool { … } // 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 GetAccessModesAsString(modes []v1.PersistentVolumeAccessMode) string { … } // GetAccessModesFromString returns an array of AccessModes from a string created by GetAccessModesAsString func GetAccessModesFromString(modes string) []v1.PersistentVolumeAccessMode { … } // removeDuplicateAccessModes returns an array of access modes without any duplicates func removeDuplicateAccessModes(modes []v1.PersistentVolumeAccessMode) []v1.PersistentVolumeAccessMode { … } func ContainsAccessMode(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool { … } // NodeSelectorRequirementKeysExistInNodeSelectorTerms checks if a NodeSelectorTerm with key is already specified in terms func NodeSelectorRequirementKeysExistInNodeSelectorTerms(reqs []v1.NodeSelectorRequirement, terms []v1.NodeSelectorTerm) bool { … } // TopologySelectorRequirementsAsSelector converts the []TopologySelectorLabelRequirement api type into a struct // that implements labels.Selector. func TopologySelectorRequirementsAsSelector(tsm []v1.TopologySelectorLabelRequirement) (labels.Selector, error) { … } // MatchTopologySelectorTerms checks whether given labels match topology selector terms in ORed; // nil or empty term matches no objects; while empty term list matches all objects. func MatchTopologySelectorTerms(topologySelectorTerms []v1.TopologySelectorTerm, lbls labels.Set) bool { … } // AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec. // Returns true if something was updated, false otherwise. func AddOrUpdateTolerationInPodSpec(spec *v1.PodSpec, toleration *v1.Toleration) bool { … } // GetMatchingTolerations returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise. func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (bool, []v1.Toleration) { … } // ScopedResourceSelectorRequirementsAsSelector converts the ScopedResourceSelectorRequirement api type into a struct that implements // labels.Selector. func ScopedResourceSelectorRequirementsAsSelector(ssr v1.ScopedResourceSelectorRequirement) (labels.Selector, error) { … }