Documentation ¶
Index ¶
- Constants
- func ContainersEqual(existing, rendered []k8scorev1.Container) bool
- func CurrentNamespace() (string, error)
- func ExistingMapStringStringContainsAllExpectedKeyValues(existing, expected map[string]string) bool
- func MustCurrentNamespace() string
- func SafeConcatNameKubernetes(name ...string) string
- func SafeConcatNameMax(name []string, max int) string
- func VolumeAlreadyMounted(volumeName string, existingVolumes []k8scorev1.Volume) bool
- func YAMLToK8sResourceRequirements(asYAML string) (*k8scorev1.ResourceRequirements, error)
Constants ¶
const (
// NameMaxLen is the maximum length for a kubernetes name.
NameMaxLen = 63
)
Variables ¶
This section is empty.
Functions ¶
func ContainersEqual ¶
ContainersEqual returns true if the existing container slice matches the rendered container slice it ignores slice order.
func CurrentNamespace ¶
CurrentNamespace returns the current kubernetes namespace as read from the KUBE_NAMESPACE env var, or the serviceaccount/namespace file on the instance.
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 ¶
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 ¶
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 ¶
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.