Documentation ¶
Overview ¶
Package utils collects all the logic shared between different controllers
Package utils collects all the logic shared between different controllers
Index ¶
- Constants
- func CheckLabels(ns *corev1.Namespace, matchLabels map[string]string) bool
- func CheckSelectorLabel(ctx context.Context, k8sClient client.Client, namespaceName string, ...) (bool, error)
- func CheckSingleLabel(obj client.Object, label, value string) bool
- func Contains(slice []string, value string) bool
- func EnforceObjectAbsence(ctx context.Context, c client.Client, obj client.Object, kind string) error
- func FromResult(result controllerutil.OperationResult) int
- func HTTPGet(ctx context.Context, url string, timeout time.Duration) (statusCode int, contents []byte, err error)
- func HTTPGetJSONIntoStruct(ctx context.Context, url string, obj interface{}, timeout time.Duration) (statusCode int, err error)
- func LogConstructor(logger logr.Logger, ctrlname string) func(*reconcile.Request) logr.Logger
- func LongThreshold() time.Duration
- func MatchOneInStringSlices(a, b []string) bool
- func ParseDockerDirectory(name string) string
Constants ¶
const ( // LogInfoLevel -> level associated with informational messages. LogInfoLevel = 0 // LogDebugLevel -> level associated with debug messages. LogDebugLevel = 2 )
Variables ¶
This section is empty.
Functions ¶
func CheckLabels ¶
CheckLabels verifies whether a namespace is characterized by a set of required labels.
func CheckSelectorLabel ¶
func CheckSelectorLabel(ctx context.Context, k8sClient client.Client, namespaceName string, matchLabels map[string]string) (bool, error)
CheckSelectorLabel checks if the given namespace belongs to the whitelisted namespaces where to perform reconciliation.
func CheckSingleLabel ¶
CheckSingleLabel checks if the instance has the label and value.
func EnforceObjectAbsence ¶
func EnforceObjectAbsence(ctx context.Context, c client.Client, obj client.Object, kind string) error
EnforceObjectAbsence deletes a Kubernetes object and prints the appropriate log messages, without failing if it does not exist.
func FromResult ¶
func FromResult(result controllerutil.OperationResult) int
FromResult returns a logger level, given the result of a CreateOrUpdate operation.
func HTTPGet ¶
func HTTPGet(ctx context.Context, url string, timeout time.Duration) (statusCode int, contents []byte, err error)
HTTPGet performs a HTTP GET request to the given URL.
func HTTPGetJSONIntoStruct ¶
func HTTPGetJSONIntoStruct(ctx context.Context, url string, obj interface{}, timeout time.Duration) (statusCode int, err error)
HTTPGetJSONIntoStruct performs a HTTP GET request to the given URL and unmarshals the response into the given struct.
func LogConstructor ¶
LogConstructor returns a constructor for a logger to be used by the given controller.
func LongThreshold ¶
LongThreshold returns the duration used to trigger tracing printing.
func MatchOneInStringSlices ¶
MatchOneInStringSlices checks if there's at least one common string between two string slices.
func ParseDockerDirectory ¶
ParseDockerDirectory returns a valid Docker image directory.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package args groups the methods used for utils args.
|
Package args groups the methods used for utils args. |
Package restcfg contains utility functions to deal with rest configs.
|
Package restcfg contains utility functions to deal with rest configs. |
Package tests contains utilities for tests.
|
Package tests contains utilities for tests. |