{"modulePath":"github.com/UnityTech/client-go","version":"v4.0.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package helper\n\n## Variables\n\n```go\nvar Semantic = conversion.EqualitiesOrDie(\n\tfunc(a, b resource.Quantity) bool {\n\n\t\treturn a.Cmp(b) == 0\n\t},\n\tfunc(a, b metav1.Time) bool {\n\t\treturn a.UTC() == b.UTC()\n\t},\n\tfunc(a, b labels.Selector) bool {\n\t\treturn a.String() == b.String()\n\t},\n\tfunc(a, b fields.Selector) bool {\n\t\treturn a.String() == b.String()\n\t},\n)\n```\nSemantic can do semantic deep equality checks for api objects. Example: apiequality.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true\n\n## Functions\n\n```go\nfunc AddOrUpdateTolerationInPod(pod *api.Pod, toleration *api.Toleration) bool\n```\nAddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list. Returns true if something was updated, false otherwise.\n\n```go\nfunc AddToNodeAddresses(addresses *[]api.NodeAddress, addAddresses ...api.NodeAddress)\n```\nAddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice, only if they do not already exist\n\n```go\nfunc GetAccessModesAsString(modes []api.PersistentVolumeAccessMode) string\n```\nGetAccessModesAsString returns a string representation of an array of access modes. modes, when present, are always in the same order: RWO,ROX,RWX.\n\n```go\nfunc GetAccessModesFromString(modes string) []api.PersistentVolumeAccessMode\n```\nGetAccessModesAsString returns an array of AccessModes from a string created by GetAccessModesAsString\n\n```go\nfunc GetAffinityFromPodAnnotations(annotations map[string]string) (*api.Affinity, error)\n```\nGetAffinityFromPodAnnotations gets the json serialized affinity data from Pod.Annotations and converts it to the Affinity type in api. TODO: remove when alpha support for affinity is removed\n\n```go\nfunc GetPersistentVolumeClaimClass(claim *api.PersistentVolumeClaim) string\n```\nGetPersistentVolumeClaimClass returns StorageClassName. If no storage class was requested, it returns \"\".\n\n```go\nfunc GetPersistentVolumeClass(volume *api.PersistentVolume) string\n```\nGetPersistentVolumeClass returns StorageClassName.\n\n```go\nfunc GetStorageNodeAffinityFromAnnotation(annotations map[string]string) (*api.NodeAffinity, error)\n```\nGetStorageNodeAffinityFromAnnotation 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\n\n```go\nfunc GetTaintsFromNodeAnnotations(annotations map[string]string) ([]api.Taint, error)\n```\nGetTaintsFromNodeAnnotations gets the json serialized taints data from Pod.Annotations and converts it to the \\[]Taint type in api.\n\n```go\nfunc GetTolerationsFromPodAnnotations(annotations map[string]string) ([]api.Toleration, error)\n```\nGetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations and converts it to the \\[]Toleration type in api.\n\n```go\nfunc HasAnnotation(obj api.ObjectMeta, ann string) bool\n```\nHasAnnotation returns a bool if passed in annotation exists\n\n```go\nfunc IsIntegerResourceName(str string) bool\n```\nIsIntegerResourceName returns true if the resource is measured in integer values\n\n```go\nfunc IsOpaqueIntResourceName(name api.ResourceName) bool\n```\nIsOpaqueIntResourceName returns true if the resource name has the opaque integer resource prefix.\n\n```go\nfunc IsResourceQuotaScopeValidForResource(scope api.ResourceQuotaScope, resource string) bool\n```\nIsResourceQuotaScopeValidForResource returns true if the resource applies to the specified scope\n\n```go\nfunc IsServiceIPRequested(service *api.Service) bool\n```\nthis function aims to check if the service's cluster IP is requested or not\n\n```go\nfunc IsServiceIPSet(service *api.Service) bool\n```\nthis function aims to check if the service's ClusterIP is set or not the objective is not to perform validation here\n\n```go\nfunc IsStandardContainerResourceName(str string) bool\n```\nIsStandardContainerResourceName returns true if the container can make a resource request for the specified resource\n\n```go\nfunc IsStandardFinalizerName(str string) bool\n```\n\n```go\nfunc IsStandardLimitRangeType(str string) bool\n```\nIsStandardLimitRangeType returns true if the type is Pod or Container\n\n```go\nfunc IsStandardQuotaResourceName(str string) bool\n```\nIsStandardQuotaResourceName returns true if the resource is known to the quota tracking system\n\n```go\nfunc IsStandardResourceName(str string) bool\n```\nIsStandardResourceName returns true if the resource is known to the system\n\n```go\nfunc IsStandardResourceQuotaScope(str string) bool\n```\nIsStandardResourceQuotaScope returns true if the scope is a standard value\n\n```go\nfunc LoadBalancerStatusDeepCopy(lb *api.LoadBalancerStatus) *api.LoadBalancerStatus\n```\nTODO: make method on LoadBalancerStatus?\n\n```go\nfunc LoadBalancerStatusEqual(l, r *api.LoadBalancerStatus) bool\n```\nTODO: make method on LoadBalancerStatus?\n\n```go\nfunc NodeSelectorRequirementsAsSelector(nsm []api.NodeSelectorRequirement) (labels.Selector, error)\n```\nNodeSelectorRequirementsAsSelector converts the \\[]NodeSelectorRequirement api type into a struct that implements labels.Selector.\n\n```go\nfunc NonConvertibleFields(annotations map[string]string) map[string]string\n```\nNonConvertibleFields iterates over the provided map and filters out all but any keys with the \"non-convertible.kubernetes.io\" prefix.\n\n```go\nfunc OpaqueIntResourceName(name string) api.ResourceName\n```\nOpaqueIntResourceName returns a ResourceName with the canonical opaque integer prefix prepended. If the argument already has the prefix, it is returned unmodified.\n\n```go\nfunc PersistentVolumeClaimHasClass(claim *api.PersistentVolumeClaim) bool\n```\nPersistentVolumeClaimHasClass returns true if given claim has set StorageClassName field.\n\n```go\nfunc PodAnnotationsFromSysctls(sysctls []api.Sysctl) string\n```\nPodAnnotationsFromSysctls creates an annotation value for a slice of Sysctls.\n\n```go\nfunc SetMetaDataAnnotation(obj *api.ObjectMeta, ann string, value string)\n```\nSetMetaDataAnnotation sets the annotation and value\n\n```go\nfunc StorageNodeAffinityToAlphaAnnotation(annotations map[string]string, affinity *api.NodeAffinity) error\n```\nConverts NodeAffinity type to Alpha annotation for use in PersistentVolumes TODO: update when storage node affinity graduates to beta\n\n```go\nfunc SysctlsFromPodAnnotation(annotation string) ([]api.Sysctl, error)\n```\nSysctlsFromPodAnnotation parses an annotation value into a slice of Sysctls.\n\n```go\nfunc SysctlsFromPodAnnotations(a map[string]string) ([]api.Sysctl, []api.Sysctl, error)\n```\nSysctlsFromPodAnnotations parses the sysctl annotations into a slice of safe Sysctls and a slice of unsafe Sysctls. This is only a convenience wrapper around SysctlsFromPodAnnotation.\n\n```go\nfunc TaintToleratedByTolerations(taint *api.Taint, tolerations []api.Toleration) bool\n```\nTaintToleratedByTolerations checks if taint is tolerated by any of the tolerations.\n\n```go\nfunc TolerationToleratesTaint(toleration *api.Toleration, taint *api.Taint) bool\n```\nTolerationToleratesTaint checks if the toleration tolerates the taint.\n\n","path":"github.com/UnityTech/client-go/pkg/api/helper","name":"helper","synopsis":"","isRedistributable":true}
