clientconfig

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKubeConfigPath

func GetKubeConfigPath() string

GetKubeConfigPath returns the most likely kube config file to use. It first looks at all the files defined in the user KUBECONF env var and selects the first available. If the list is empty the default kube config path is returned.

func GetLocalKubeConfig

func GetLocalKubeConfig() (*clientcmdapi.Config, error)

GetLocalKubeConfig attempts to load up the current users local Kubernetes configuration.

func RemoveCredentialRBACResources

func RemoveCredentialRBACResources(config *rest.Config, UID string) error

RemoveCredentialRBACResources removes all RBAC resources for specific caas credential UID.

Types

type ClientConfig

type ClientConfig struct {
	Type           string
	Contexts       map[string]Context
	CurrentContext string
	Clouds         map[string]CloudConfig
	Credentials    map[string]cloud.Credential
}

ClientConfig - a set of cloud endpoint info and user credentials Clouds and user Credentials are joined by Contexts. There should always be a valid Context with same name as the CurrentContext string.

func NewK8sClientConfig

func NewK8sClientConfig(
	credentialUID string, config *clientcmdapi.Config,
	contextName, clusterName string,
	credentialResolver K8sCredentialResolver,
) (*ClientConfig, error)

func NewK8sClientConfigFromReader

func NewK8sClientConfigFromReader(
	credentialUID string, reader io.Reader,
	contextName, clusterName string,
	credentialResolver K8sCredentialResolver,
) (*ClientConfig, error)

NewK8sClientConfigFromReader returns a new Kubernetes client, reading the config from the specified reader.

type ClientConfigFunc

type ClientConfigFunc func(
	string, io.Reader, string, string, K8sCredentialResolver,
) (*ClientConfig, error)

ClientConfigFunc is a function that returns a ClientConfig. Functions of this type should be available for each supported CAAS framework, e.g. Kubernetes.

func NewClientConfigReader

func NewClientConfigReader(cloudType string) (ClientConfigFunc, error)

NewClientConfigReader returns a function of type ClientConfigFunc to read the client config for a given cloud type.

type CloudConfig

type CloudConfig struct {
	Endpoint      string
	SkipTLSVerify bool
	Attributes    map[string]interface{}
}

CloudConfig stores information about how to connect to a Cloud.

type Context

type Context struct {
	CloudName      string
	CredentialName string
}

Context joins Clouds and Credentials.

type K8sCredentialResolver

type K8sCredentialResolver func(string, *clientcmdapi.Config, string) (*clientcmdapi.Config, error)

K8sCredentialResolver defines the function for resolving non supported k8s credential.

func GetJujuAdminServiceAccountResolver

func GetJujuAdminServiceAccountResolver(clock jujuclock.Clock) K8sCredentialResolver

GetJujuAdminServiceAccountResolver returns a function for ensuring juju admin service account created with admin cluster role binding setup.

Jump to

Keyboard shortcuts

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