kubeconfig

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig() (*clientgo.Config, error)

GetConfig returns the currently loaded configuration via LoadConfig(). Returns an error if LoadConfig() has not been called.

func GetUser

func GetUser(name string) (string, error)

GetUser returns the currently configured user for a context Returns an error if LoadConfig() has not been called.

func LoadConfig

func LoadConfig(kubeconfigFile string) error

LoadConfig loads a kubeconfig from the specified kubeconfigFile, or uses the recommended file from kubectl defaults ($HOME/.kube/config). If the file exists it will use the existing configuration as a base for the changes, otherwise it starts a new configuration. Returns an error only if the existing file is not a valid configuration or it can't be read.

func Remove

func Remove(name string) error

Remove deletes all items related to the specified target: cluster, context, user. Returns an error if LoadConfig() has not been called.f

func UpdateConfig

func UpdateConfig(name string, aliases []string, tokenData *TokenInfo) error

UpdateConfig loads the current kubeconfig file and applies the changes described in the tokenData. Once applied, it writes the changes to disk. It will use the specified name for the names of the cluster, user and context. It will create an additional context for each of the aliases provided

Types

type TokenInfo

type TokenInfo struct {
	// Username the identifier of the logged in user
	Username string
	// IDToken the JWT token for the user
	IDToken string
	// ClientID the id of the client requesting the authentication
	ClientID string
	// ClientSecret a secret to identify the client requesting the authentication
	ClientSecret string
	// IssuerURL the URL of the OIDC provider
	IssuerURL string
	// IssuerCA base64 encoded CA used to validate the Issuers certificate
	IssuerCA string
	// ClusterName name of the cluster that can be accessed with the IDToken
	ClusterName string
	// ClusterAPIServerURL URL of the apiserver of the cluster that can be accessed with the IDToken
	ClusterAPIServerURL string
	// ClusterCA base64 encoded CA of the cluster that can be accessed with the IDToken
	ClusterCA string
}

TokenInfo contains the data required to configure an OIDC authenticator for kubectl

Jump to

Keyboard shortcuts

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