configmap

package
v0.0.0-...-a5c132e Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotationsEqual

func AnnotationsEqual(current, desired *corev1.ConfigMap) bool

AnnotationsEqual return only true if the configmaps have equal annotations sections only.

func Create

func Create(ctx context.Context, c client.Client, cm *corev1.ConfigMap) error

Create will create the given configmap on the api server or return an error on failure

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, cm *corev1.ConfigMap, equal EqualityFunc, mutate MutateFunc) (bool, error)

CreateOrUpdate attempts first to get the given configmap. If the configmap does not exist, the configmap will be created. Otherwise, if the configmap exists and the provided comparison func detects any changes an update is attempted. Updates are retried with backoff (See retry.DefaultRetry). Returns on failure an non-nil error. Returns true if the configmap was updated and false otherwise.

func DataEqual

func DataEqual(current, desired *corev1.ConfigMap) bool

DataEqual return only true if the configmaps have equal data sections only.

func Delete

func Delete(ctx context.Context, c client.Client, key client.ObjectKey) error

Delete attempts to delete a k8s configmap if existing or returns an error.

func Get

Get returns the k8s configmap for the given object key or an error.

func GetDataSHA256

func GetDataSHA256(ctx context.Context, c client.Client, key client.ObjectKey, excludeKeys []string) string

GetDataSHA256 returns the sha256 checksum of the confimap data keys

func LabelEqual

func LabelEqual(current, desired *corev1.ConfigMap) bool

LabelEqual return only true if the configmaps have equal label sections only.

func MutateAnnotationsOnly

func MutateAnnotationsOnly(current, desired *corev1.ConfigMap)

MutateAnnotationsOnly is a default mutate function implementation that copies only the annotations section from desired to current configmap.

func MutateDataOnly

func MutateDataOnly(current, desired *corev1.ConfigMap)

MutateDataOnly is a default mutate function implementation that copies only the data section from desired to current configmap.

func New

func New(name, namespace string, labels map[string]string, data map[string]string) *corev1.ConfigMap

New returns a new k8s configmap

Types

type EqualityFunc

type EqualityFunc func(current, desired *corev1.ConfigMap) bool

EqualityFunc is the type for functions that compare two configmaps. Return true if two configmaps are equal.

type MutateFunc

type MutateFunc func(current, desired *corev1.ConfigMap)

MutateFunc is the type for functions that mutate the current configmap by applying the values from the desired configmap.

Jump to

Keyboard shortcuts

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