utils

package
v0.0.0-...-8f0f6a6 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ManagedLabel         = cappAPIGroup + "/managed"
	ManagedLabelValue    = "true"
	ManagedLabelSelector = fmt.Sprintf("%s=%s", ManagedLabel, ManagedLabelValue)

	ParentCappLabel         = cappAPIGroup + "/parent-capp"
	ParentCappNSLabel       = cappAPIGroup + "/parent-capp-ns"
	ParentCappLabelSelector = ParentCappLabel + "=%s"

	PlacementEnvironmentKey   = "environment"
	PlacementRegionKey        = "region"
	PlacementEnvironmentLabel = cappAPIGroup + "/" + PlacementEnvironmentKey
	PlacementRegionLabel      = cappAPIGroup + "/" + PlacementRegionKey

	CappNameLabel         = cappAPIGroup + "/cappName"
	CappNameLabelSelector = CappNameLabel + "=%s"
)

Functions

func AddManagedLabel

func AddManagedLabel(labels map[string]string) map[string]string

AddManagedLabel adds the managed label to the given labels map.

func ConvertKeyValueToMap

func ConvertKeyValueToMap(kvList []types.KeyValue) map[string]string

ConvertKeyValueToMap converts a slice of KeyValue pairs to a map with string keys and values.

func ConvertMapToKeyValue

func ConvertMapToKeyValue(values map[string]string) []types.KeyValue

ConvertMapToKeyValue converts a map with string keys and values to a slice of KeyValue pairs.

func GetEnvBool

func GetEnvBool(key string, defaultValue bool) (bool, error)

GetEnvBool retrieves the value of the environment variable named by the key. If the variable is empty or not set, it returns the default value.

func GetEnvNumber

func GetEnvNumber(key string, defaultValue int) (int, error)

GetEnvNumber retrieves the value of the environment variable named by the key. If the variable is empty or not set, it returns the default value.

func GetPodLogStream

func GetPodLogStream(ctx context.Context, client kubernetes.Interface, namespace, podName, containerName string, previous bool) (io.ReadCloser, error)

GetPodLogStream returns the logs of a container in a pod.

func GetPodsByLabel

func GetPodsByLabel(ctx context.Context, client kubernetes.Interface, namespace, labelSelector string, listOptions metav1.ListOptions) (*corev1.PodList, error)

GetPodsByLabel returns the pods in a namespace using a given label selector.

func IsPodInPodList

func IsPodInPodList(podName string, pods *corev1.PodList) bool

IsPodInPodList checks if a pod with the given name exists in the provided list of pods.

func ParseIntStr

func ParseIntStr(intStr string) (int64, error)

ParseIntStr parses a string into an int64 number.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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