Documentation ¶
Index ¶
- Constants
- func ConvertDownwardAPIFieldLabel(version, label, value string) (string, string, error)
- func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)
- func FormatMap(m map[string]string) (fmtStr string)
- func FromServices(services []*v1.Service) []v1.EnvVar
- func IsServiceIPSet(service *corev1.Service) bool
- func PopulateEnvironmentVariables(ctx context.Context, pod *corev1.Pod, rm *manager.ResourceManager, ...) error
- func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool)
Constants ¶
const ( // ReasonOptionalConfigMapNotFound is the reason used in events emitted when an optional configmap is not found. ReasonOptionalConfigMapNotFound = "OptionalConfigMapNotFound" // ReasonOptionalConfigMapKeyNotFound is the reason used in events emitted when an optional configmap key is not found. ReasonOptionalConfigMapKeyNotFound = "OptionalConfigMapKeyNotFound" // ReasonFailedToReadOptionalConfigMap is the reason used in events emitted when an optional configmap could not be read. ReasonFailedToReadOptionalConfigMap = "FailedToReadOptionalConfigMap" // ReasonOptionalSecretNotFound is the reason used in events emitted when an optional secret is not found. ReasonOptionalSecretNotFound = "OptionalSecretNotFound" // ReasonOptionalSecretKeyNotFound is the reason used in events emitted when an optional secret key is not found. ReasonOptionalSecretKeyNotFound = "OptionalSecretKeyNotFound" // ReasonFailedToReadOptionalSecret is the reason used in events emitted when an optional secret could not be read. ReasonFailedToReadOptionalSecret = "FailedToReadOptionalSecret" // ReasonMandatoryConfigMapNotFound is the reason used in events emitted when a mandatory configmap is not found. ReasonMandatoryConfigMapNotFound = "MandatoryConfigMapNotFound" // ReasonMandatoryConfigMapKeyNotFound is the reason used in events emitted when a mandatory configmap key is not found. ReasonMandatoryConfigMapKeyNotFound = "MandatoryConfigMapKeyNotFound" // ReasonFailedToReadMandatoryConfigMap is the reason used in events emitted when a mandatory configmap could not be read. ReasonFailedToReadMandatoryConfigMap = "FailedToReadMandatoryConfigMap" // ReasonMandatorySecretNotFound is the reason used in events emitted when a mandatory secret is not found. ReasonMandatorySecretNotFound = "MandatorySecretNotFound" // ReasonMandatorySecretKeyNotFound is the reason used in events emitted when a mandatory secret key is not found. ReasonMandatorySecretKeyNotFound = "MandatorySecretKeyNotFound" // ReasonFailedToReadMandatorySecret is the reason used in events emitted when a mandatory secret could not be read. ReasonFailedToReadMandatorySecret = "FailedToReadMandatorySecret" // ReasonInvalidEnvironmentVariableNames is the reason used in events emitted when a configmap/secret referenced in a ".spec.containers[*].envFrom" field contains invalid environment variable names. ReasonInvalidEnvironmentVariableNames = "InvalidEnvironmentVariableNames" )
Variables ¶
This section is empty.
Functions ¶
func ConvertDownwardAPIFieldLabel ¶
ConvertDownwardAPIFieldLabel converts the specified downward API field label and its value in the pod of the specified version to the internal version, and returns the converted label and value. This function returns an error if the conversion fails.
func ExtractFieldPathAsString ¶
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 FromServices ¶
FromServices builds environment variables that a container is started with, which tell the container where to find the services it may need, which are provided as an argument.
func IsServiceIPSet ¶
IsServiceIPSet aims to check if the service's ClusterIP is set or not the objective is not to perform validation here
func PopulateEnvironmentVariables ¶
func PopulateEnvironmentVariables(ctx context.Context, pod *corev1.Pod, rm *manager.ResourceManager, recorder record.EventRecorder) error
PopulateEnvironmentVariables populates the environment of each container (and init container) in the specified pod.
func SplitMaybeSubscriptedPath ¶
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 ¶
This section is empty.