kubernetes

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 11 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 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 EnforceDNSLabelConvention added in v0.0.23

func EnforceDNSLabelConvention(s string) string

EnforceDNSLabelConvention attempts to enforce the RFC 1123 label name requirements on s.

func ExistingMapStringStringContainsAllExpectedKeyValues added in v0.0.20

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

ExistingMapStringStringContainsAllExpectedKeyValues returns false if the existing map of strings does *not* have all the keys/values from the expected/rendered labels/annotations. Basically -- if the existing map has what we expect and anything else return true. If the existing map does not contain all the things we expected, return false.

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 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