...

Package exec

import "k8s.io/client-go/tools/auth/exec"
Overview
Index

Overview ▾

Package exec contains helper utilities for exec credential plugins.

func LoadExecCredential

func LoadExecCredential(data []byte) (runtime.Object, *rest.Config, error)

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 an error will be returned.

Note that the returned rest.Config will use anonymous authentication, since the exec plugin has not returned credentials for this cluster yet.

func LoadExecCredentialFromEnv

func LoadExecCredentialFromEnv() (runtime.Object, *rest.Config, error)

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.