kubeconfig

package
v0.15.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func FormatWorkloadClusterKubeconfigFilename(clusterName string) string

FormatWorkloadClusterKubeconfigFilename returns a filename for the Kubeconfig of workload clusters. The filename does not include a basepath.

func FromClusterName

func FromClusterName(clusterName string) string

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

func ResolveAndValidateFilename(flagValue, clusterName string) (string, error)

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

func ResolveFilename(flagValue, clusterName string) string

ResolveFilename returns a path to a kubeconfig file by priority.

The priority is:

  1. CLI flag (flagValue)
  2. A file created at cluster creation, found by a combining the cluster name with present working directory.
  3. 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

func ValidateFilename(filename string) error

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

func ValidateKubeconfigPath(clusterName string, parentFolders ...string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL