kubernetes

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NameMaxLen is the maximum length for a kubernetes name.
	NameMaxLen = 63
)

Variables

This section is empty.

Functions

func AnnotationsOrLabelsConform

func AnnotationsOrLabelsConform(existing, expected map[string]string) bool

AnnotationsOrLabelsConform returns false if the existing labels/annotations (or really just map) does *not* have all the keys/values from the expected/rendered labels/annotations.

func ContainersEqual

func ContainersEqual(existing, rendered []k8scorev1.Container) bool

ContainersEqual returns true if the existing container slice matches the rendered container slice it ignores slice order.

func CurrentNamespace

func CurrentNamespace() (string, error)

CurrentNamespace returns the current kubernetes namespace as read from the KUBE_NAMESPACE env var, or the serviceaccount/namespace file on the instance.

func MustCurrentNamespace

func MustCurrentNamespace() string

MustCurrentNamespace returns the current kubernetes namespace or panics.

func SafeConcatNameKubernetes

func SafeConcatNameKubernetes(name ...string) string

SafeConcatNameKubernetes concats all provided strings into a string joined by "-" - if the final string is greater than 63 characters, the string will be shortened, and a hash will be used at the end of the string to keep it unique, but safely within allowed lengths.

func SafeConcatNameMax

func SafeConcatNameMax(name []string, max int) string

SafeConcatNameMax concats all provided strings into a string joined by "-" - if the final string is greater than max characters, the string will be shortened, and a hash will be used at the end of the string to keep it unique, but safely within allowed lengths.

func VolumeAlreadyMounted

func VolumeAlreadyMounted(volumeName string, existingVolumes []k8scorev1.Volume) bool

VolumeAlreadyMounted checks if the given volumeName is already in the existingVolumes.

func YAMLToK8sResourceRequirements

func YAMLToK8sResourceRequirements(asYAML string) (*k8scorev1.ResourceRequirements, error)

YAMLToK8sResourceRequirements accepts a yaml string that looks suspiciously like k8s resources for a container and converts it to k8scorev1.ResourceRequirements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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