utils

package
v0.0.0-...-50978b4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvVar

func EnvVar(name, value string) corev1.EnvVar

envVar returns an environment variable for the given name and value

func RandomString

func RandomString(length int) (string, error)

func SecretEnvVar

func SecretEnvVar(name, secretName, secretKey string) corev1.EnvVar

secretEnvVar returns an environment variable with the given name and value

func StringInSlice

func StringInSlice(item string, slice []string) bool

func StringSliceEquals

func StringSliceEquals(a, b []string) bool

func UpsertAllObjects

func UpsertAllObjects[T client.Object](ctx context.Context, r client.Client, objects []T) []error

UpsertAllObjects upserts all objects in the given slice to the Kubernetes API server. If an object already exists, it is updated. If an object does not exist, it is created. The objects are identified by their keys, which are extracted from the objects themselves. The function returns a slice of errors, one for each object that failed to be upserted.

func UpsertObject

func UpsertObject[T client.Object](ctx context.Context, r client.Client, obj T) error

UpsertObject upserts the given object in Kubernetes. If the object already exists, it is updated. If the object does not exist, it is created. The object is identified by its key, which is extracted from the object itself. The function returns an error if the upsert operation fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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