kubeconfig

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortFlagName     = "port"
	DCP_SECURE_TOKEN = "DCP_SECURE_TOKEN"
)
View Source
const (
	PlaceholderToken = "<placeholder>"
)

Variables

This section is empty.

Functions

func EnsureKubeconfigFlag

func EnsureKubeconfigFlag(fs *pflag.FlagSet) *pflag.Flag

controller-runtime expects --kubeconfig flag to be registered with the default flag.CommandLine flag set, see https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/config/config.go for details. Instead of registering the flag ourselves, we will call controller-runtime RegisterFlags() function, then look it up and return.

func EnsureKubeconfigPortFlag

func EnsureKubeconfigPortFlag(fs *pflag.FlagSet) *pflag.Flag

func RequireKubeconfigFlagValue

func RequireKubeconfigFlagValue(flags *pflag.FlagSet) (string, error)

Ensures that the kubeconfig flag exist and points to a non-empty file. Returns the value of the flag, i.e. path to that file.

Types

type Kubeconfig

type Kubeconfig struct {
	Config *clientcmd_api.Config
	// contains filtered or unexported fields
}

func EnsureKubeconfigData

func EnsureKubeconfigData(flags *pflag.FlagSet, log logr.Logger) (*Kubeconfig, error)

Creates API server addressing and authentication data that will go into the kubeconfig file. The kubeconfig flag value, if empty upon invocation, will be set to preferred path of the kubeconfig file. Does NOT create the kubeconfig file itself (see Kubeconfig.Save() for that).

func (*Kubeconfig) GetData

Reads Kubeconfig data and returns the address, port and security token of the current context, to be used to configure/connect to API server

func (*Kubeconfig) Path

func (k *Kubeconfig) Path() string

func (*Kubeconfig) Save

func (k *Kubeconfig) Save() error

Write the kubeconfig data if it doesn't exist. Will not update an existing kubeconfig.

Jump to

Keyboard shortcuts

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