utils

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeMountableChecksum

func ComputeMountableChecksum(secrets []corev1.Secret, configMaps []corev1.ConfigMap) (map[string]string, error)

ComputeMountableChecksum computes checksums for secrets and config maps by applying a sha256sum to the ordered items.

func GetConfigMapSelector

func GetConfigMapSelector(ctx context.Context, c client.Client, namespace string, sel matryoshkav1alpha1.ConfigMapSelector, defaultKey string) (string, error)

GetConfigMapSelector gets the config map referenced by the namespace and matryoshkav1alpha1.ConfigMapSelector and uses LookupConfigMapSelector to retrieve the specified key. If key is empty, defaultKey is used.

func GetSecretSelector

func GetSecretSelector(ctx context.Context, c client.Client, namespace string, sel matryoshkav1alpha1.SecretSelector, defaultKey string) ([]byte, error)

GetSecretSelector gets the secret referenced by the namespace and matryoshkav1alpha1.SecretSelector and uses LookupSecretSelector to retrieve the specified key. If key is empty, defaultKey is used.

func LookupConfigMapSelector

func LookupConfigMapSelector(configMap *corev1.ConfigMap, sel matryoshkav1alpha1.ConfigMapSelector, defaultKey string) (string, error)

LookupConfigMapSelector looks up the key referenced by the matryoshkav1alpha1.ConfigMapSelector or the defaultKey if key is empty.

func LookupSecretSelector

func LookupSecretSelector(secret *corev1.Secret, sel matryoshkav1alpha1.SecretSelector, defaultKey string) ([]byte, error)

LookupSecretSelector looks up the key referenced by the matryoshkav1alpha1.SecretSelector or the defaultKey if key is empty.

func MergeStringStringMaps

func MergeStringStringMaps(ms ...map[string]string) map[string]string

MergeStringStringMaps returns a new map with the key-value pairs of all given maps merged. If all maps are nil, nil is returned. If a map is non-nil, a non-nil map is returned. The key-value pairs of the last map have the highest priority.

func StringOrDefault

func StringOrDefault(s string, defaultValue string) string

StringOrDefault returns the given string if it's non-empty, otherwise it returns the defaultValue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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