// containerResourceRuntimeValue returns the value of the provided container resource func containerResourceRuntimeValue(fs *api.ResourceFieldSelector, pod *api.Pod, container *api.Container) (string, error) { containerName := fs.ContainerName if len(containerName) == 0 { return fieldpath.ExtractContainerResourceValue(fs, container) } else { return fieldpath.ExtractResourceValueByContainerName(fs, pod, containerName) } }
func getEnvVarRefValue(f *clientcmd.Factory, store *resourceStore, from *kapi.EnvVarSource, obj runtime.Object, c *kapi.Container) (string, error) { if from.SecretKeyRef != nil { return getSecretRefValue(f, store, from.SecretKeyRef) } if from.ConfigMapKeyRef != nil { return getConfigMapRefValue(f, store, from.ConfigMapKeyRef) } if from.FieldRef != nil { return fieldpath.ExtractFieldPathAsString(obj, from.FieldRef.FieldPath) } if from.ResourceFieldRef != nil { return fieldpath.ExtractContainerResourceValue(from.ResourceFieldRef, c) } return "", fmt.Errorf("invalid valueFrom") }