Documentation ¶
Overview ¶
Package utils implements some utility functions.
Index ¶
- func DifferenceOfIntSlices(a, b []int) (onlyInA []int, onlyInB []int)
- func DifferenceOfStringSlices(a, b []string) (onlyInA []string, onlyInB []string)
- func FilterStringFromList(list []string, strToFilter string) (newList []string)
- func FindOwnerRefFromList(refList []metav1.OwnerReference, name, kind, apiVersion string) (ref int, found bool)
- func GenerateName(name *string, fallback string) string
- func GetDefaultLogger(logLevel string) logr.Logger
- func LabelSelectorToLabels(str string) (map[string]string, error)
- func LabelsToLabelSelector(labels map[string]string) string
- func RemoveOwnerRefFromList(refList []metav1.OwnerReference, name, kind, apiVersion string) []metav1.OwnerReference
- func StringInList(list []string, strToSearch string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DifferenceOfIntSlices ¶
DifferenceOfIntSlices returns the elements in `a` that aren't in `b` as well as elements of `a` not in `b`.
func DifferenceOfStringSlices ¶
DifferenceOfStringSlices returns the elements in `a` that aren't in `b` as well as elements of `a` not in `b`.
func FilterStringFromList ¶
FilterStringFromList produces a new string slice that does not include the strToFilter argument.
func FindOwnerRefFromList ¶
func FindOwnerRefFromList(refList []metav1.OwnerReference, name, kind, apiVersion string) (ref int, found bool)
FindOwnerRefFromList finds the owner ref of a Kubernetes object in a list of owner refs.
func GenerateName ¶
GenerateName takes a name as string pointer. It returns name if pointer is not nil, otherwise it returns fallback with random suffix.
func GetDefaultLogger ¶
GetDefaultLogger returns a default zapr logger.
func LabelSelectorToLabels ¶
LabelSelectorToLabels is converting an HCloud label selector to a map of labels.
func LabelsToLabelSelector ¶
LabelsToLabelSelector is converting a map of labels to HCloud label selector.
func RemoveOwnerRefFromList ¶
func RemoveOwnerRefFromList(refList []metav1.OwnerReference, name, kind, apiVersion string) []metav1.OwnerReference
RemoveOwnerRefFromList removes the owner reference of a Kubernetes object.
func StringInList ¶
StringInList returns a boolean indicating whether strToSearch is a member of the string slice passed as the first argument.
Types ¶
This section is empty.