context

package
v0.18.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// KubernetesEndpoint is the kubernetes endpoint name in a stored context
	KubernetesEndpoint = "kubernetes"
)

Variables

This section is empty.

Functions

func ConfigFromContext

func ConfigFromContext(name string, s store.Reader) (clientcmd.ClientConfig, error)

ConfigFromContext resolves a kubernetes client config for the specified context. If kubeconfigOverride is specified, use this config file instead of the context defaults.ConfigFromContext if command.ContextDockerHost is specified as the context name, fallsback to the default user's kubeconfig file

func ConfigFromEndpoint added in v0.10.0

func ConfigFromEndpoint(endpointName string, s store.Reader) (clientcmd.ClientConfig, error)

ConfigFromEndpoint loads kubernetes config from endpoint

func NewKubernetesConfig

func NewKubernetesConfig(configPath string) clientcmd.ClientConfig

NewKubernetesConfig resolves the path to the desired Kubernetes configuration file based on the KUBECONFIG environment variable and command line flags.

Types

type Endpoint

type Endpoint struct {
	EndpointMeta
	TLSData *context.TLSData
}

Endpoint is a typed wrapper around a context-store generic endpoint describing a Kubernetes endpoint, with TLS data

func FromKubeConfig

func FromKubeConfig(kubeconfig, kubeContext, namespaceOverride string) (Endpoint, error)

FromKubeConfig creates a Kubernetes endpoint from a Kubeconfig file

func (*Endpoint) KubernetesConfig

func (c *Endpoint) KubernetesConfig() clientcmd.ClientConfig

KubernetesConfig creates the kubernetes client config from the endpoint

type EndpointMeta

type EndpointMeta struct {
	context.EndpointMetaBase
	DefaultNamespace string                           `json:",omitempty"`
	ProxyURL         string                           `json:",omitempty"`
	AuthProvider     *clientcmdapi.AuthProviderConfig `json:",omitempty"`
	Exec             *clientcmdapi.ExecConfig         `json:",omitempty"`
	UsernamePassword *UsernamePassword                `json:"usernamePassword,omitempty"`
	Token            string                           `json:"token,omitempty"`
}

EndpointMeta is a typed wrapper around a context-store generic endpoint describing a Kubernetes endpoint, without TLS data

func EndpointFromContext

func EndpointFromContext(metadata store.Metadata) *EndpointMeta

EndpointFromContext extracts kubernetes endpoint info from current context

func (*EndpointMeta) ResolveDefault

func (c *EndpointMeta) ResolveDefault() (interface{}, *store.EndpointTLSData, error)

ResolveDefault returns endpoint metadata for the default Kubernetes endpoint, which is derived from the env-based kubeconfig.

func (*EndpointMeta) WithTLSData

func (c *EndpointMeta) WithTLSData(s store.Reader, contextName string) (Endpoint, error)

WithTLSData loads TLS materials for the endpoint

type UsernamePassword

type UsernamePassword struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

UsernamePassword contains username/password auth info

Jump to

Keyboard shortcuts

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