Package exec contains helper utilities for exec credential plugins.
func LoadExecCredential ¶
LoadExecCredential loads the configuration needed for an exec plugin to communicate with a cluster.
LoadExecCredential expects the provided data to be a serialized client.authentication.k8s.io ExecCredential object (of any version). If the provided data is invalid (i.e., it cannot be unmarshalled into any known client.authentication.k8s.io ExecCredential version), an error will be returned. A successfully unmarshalled ExecCredential will be returned as the first return value.
If the provided data is successfully unmarshalled, but it does not contain cluster information (i.e., ExecCredential.Spec.Cluster == nil), then the returned rest.Config and error will be nil.
Note that the returned rest.Config will use anonymous authentication, since the exec plugin has not returned credentials for this cluster yet.
LoadExecCredentialFromEnv is a helper-wrapper around LoadExecCredential that loads from the well-known KUBERNETES_EXEC_INFO environment variable.
When the KUBERNETES_EXEC_INFO environment variable is not set or is empty, then this function will immediately return an error.