type ResourceStore … // NewResourceStore returns a pointer to a new resource store data structure. func NewResourceStore() *ResourceStore { … } // getSecretRefValue returns the value of a secret in the supplied namespace func getSecretRefValue(client kubernetes.Interface, namespace string, store *ResourceStore, secretSelector *corev1.SecretKeySelector) (string, error) { … } // getConfigMapRefValue returns the value of a configmap in the supplied namespace func getConfigMapRefValue(client kubernetes.Interface, namespace string, store *ResourceStore, configMapSelector *corev1.ConfigMapKeySelector) (string, error) { … } // getFieldRef returns the value of the supplied path in the given object func getFieldRef(obj runtime.Object, from *corev1.EnvVarSource) (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 extractFieldPathAsString(obj interface{ … } // 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) func splitMaybeSubscriptedPath(fieldPath string) (string, string, bool) { … } // formatMap formats map[string]string to a string. func formatMap(m map[string]string) (fmtStr string) { … } // getResourceFieldRef returns the value of a resource in the given container func getResourceFieldRef(from *corev1.EnvVarSource, container *corev1.Container) (string, error) { … } // ExtractContainerResourceValue extracts the value of a resource // in an already known container func extractContainerResourceValue(fs *corev1.ResourceFieldSelector, container *corev1.Container) (string, error) { … } // convertResourceCPUToString converts cpu value to the format of divisor and returns // ceiling of the value. func convertResourceCPUToString(cpu *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceMemoryToString converts memory value to the format of divisor and returns // ceiling of the value. func convertResourceMemoryToString(memory *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceHugePagesToString converts hugepages value to the format of divisor and returns // ceiling of the value. func convertResourceHugePagesToString(hugePages *resource.Quantity, divisor resource.Quantity) (string, error) { … } // convertResourceEphemeralStorageToString converts ephemeral storage value to the format of divisor and returns // ceiling of the value. func convertResourceEphemeralStorageToString(ephemeralStorage *resource.Quantity, divisor resource.Quantity) (string, error) { … } // GetEnvVarRefValue returns the value referenced by the supplied EnvVarSource given the other supplied information. func GetEnvVarRefValue(kc kubernetes.Interface, ns string, store *ResourceStore, from *corev1.EnvVarSource, obj runtime.Object, c *corev1.Container) (string, error) { … } // GetEnvVarRefString returns a text description of whichever field is set within the supplied EnvVarSource argument. func GetEnvVarRefString(from *corev1.EnvVarSource) string { … } // IsHugePageResourceName returns true if the resource name has the huge page // resource prefix. func IsHugePageResourceName(name corev1.ResourceName) bool { … }