envresolve

package
v0.0.0-...-0597a29 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractContainerResourceValue

func ExtractContainerResourceValue(fs *v1.ResourceFieldSelector, container *v1.Container) (string, error)

ExtractContainerResourceValue extracts the value of a resource in an already known container

func ExtractFieldPathAsString

func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)

ExtractFieldPathAsString extracts the field from the given object and returns it as a string. The object must be a pointer to an API type.

func FormatMap

func FormatMap(m map[string]string) (fmtStr string)

FormatMap formats map[string]string to a string.

func GetEnvVarRefString

func GetEnvVarRefString(from *corev1.EnvVarSource) string

GenEnvVarRefString returns a text description of the supplied EnvVarSource

func GetEnvVarRefValue

func GetEnvVarRefValue(kc kubernetes.Interface, ns string, store *ResourceStore, from *corev1.EnvVarSource, obj runtime.Object, c *corev1.Container) (string, error)

GenEnvVarRefValue returns the value referenced by the supplied EnvVarSource given the other supplied information

func SplitMaybeSubscriptedPath

func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool)

SplitMaybeSubscriptedPath checks whether the specified fieldPath is subscripted, and

  • if yes, this function splits the fieldPath into path and subscript, and returns (path, subscript, true).
  • if no, this function returns (fieldPath, "", false).

Example inputs and outputs:

  • "metadata.annotations['myKey']" --> ("metadata.annotations", "myKey", true)
  • "metadata.annotations['a[b]c']" --> ("metadata.annotations", "a[b]c", true)
  • "metadata.labels[”]" --> ("metadata.labels", "", true)
  • "metadata.labels" --> ("metadata.labels", "", false)

Types

type ResourceStore

type ResourceStore struct {
	SecretStore    map[string]*corev1.Secret
	ConfigMapStore map[string]*corev1.ConfigMap
}

ResourceStore defines a new resource store data structure

func NewResourceStore

func NewResourceStore() *ResourceStore

NewResourceStore returns a pointer to a new resource store data structure

Jump to

Keyboard shortcuts

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