Documentation ¶
Index ¶
- Constants
- func FormatWorkloadClusterKubeconfigFilename(clusterName string) string
- func FromClusterName(clusterName string) string
- func FromEnvironment() string
- func ResolveAndValidateFilename(flagValue, clusterName string) (string, error)
- func ResolveFilename(flagValue, clusterName string) string
- func ValidateFilename(filename string) error
- func ValidateKubeconfigPath(clusterName string, parentFolders ...string) error
Constants ¶
const EnvName = "KUBECONFIG"
EnvName is the standard KubeConfig environment variable name. https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#set-the-kubeconfig-environment-variable
const FromClusterFormat = "%s-eks-a-cluster.kubeconfig"
FromClusterFormat defines the format of the kubeconfig of the.
Variables ¶
This section is empty.
Functions ¶
func FormatWorkloadClusterKubeconfigFilename ¶ added in v0.13.0
FormatWorkloadClusterKubeconfigFilename returns a filename for the Kubeconfig of workload clusters. The filename does not include a basepath.
func FromClusterName ¶
FromClusterName formats an expected Kubeconfig path for EKS-A clusters. This includes a subdirecftory named after the cluster name. For example, if the clusterName is 'sandbox' the generated path would be sandbox/sandbox-eks-a-cluster.kubeconfig.
func FromEnvironment ¶
func FromEnvironment() string
FromEnvironment returns the first kubeconfig file specified in the KUBECONFIG environment variable.
The environment variable can contain a list of files, much like how the PATH environment variable contains a list of directories.
func ResolveAndValidateFilename ¶ added in v0.12.0
ResolveAndValidate composes ResolveFilename and ValidateFile.
Literally, that's all it does. They're frequently called together, so hopefully this is a helper.
func ResolveFilename ¶ added in v0.12.0
ResolveFilename returns a path to a kubeconfig file by priority.
The priority is:
- CLI flag (flagValue)
- A file created at cluster creation, found by a combining the cluster name with present working directory.
- The first filename found in the KUBECONFIG environment variable.
NO VALIDATION IS PERFORMED. See ValidateFile for validation.
There are other places one may wish to consult or load a kubeconfig file from, but this function tries to walk the narrow line between what the kubernetes client code does (#1, #3, and some other things that we more or less don't support), with some of the existing EKSA CLI tools that look for kubeconfig files relative to the working directory that were created at cluster creation time. These different functionalities don't always mesh, and aren't always compatible, but this function tries to combine them as much as possible, without breaking either.
func ValidateFilename ¶ added in v0.12.0
ValidateFilename loads a file to validate it's basic contents.
The values of the fields within aren't validated, but the file's existence and basic structure are checked.
func ValidateKubeconfigPath ¶ added in v0.12.0
Types ¶
This section is empty.