package context

import "github.com/docker/buildx/driver/kubernetes/context"

Index

Constants

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

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

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() (any, *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

Source Files

constants.go load.go save.go

Version
v0.22.0 (latest)
Published
Mar 17, 2025
Platform
js/wasm
Imports
10 packages
Last checked
3 weeks ago

Tools for package owners.