kubeconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package kubeconfig provides a thin wrapper over k8s.io/client-go/tools/clientcmd for registering kubeconfig/context/namespace CLI flags, replacing the k8s.io/cli-runtime/pkg/genericclioptions.ConfigFlags dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFlags

type ConfigFlags struct {
	KubeConfig *string
	Context    *string
	Namespace  *string
}

ConfigFlags holds pointers to kubeconfig, context, and namespace flag values. A nil pointer field is skipped when AddFlags is called, making that flag unavailable in the command — matching the genericclioptions.ConfigFlags idiom.

func NewConfigFlags

func NewConfigFlags(_ bool) *ConfigFlags

NewConfigFlags returns a ConfigFlags with all fields initialised to empty (non-nil) string pointers. The usePersistentConfig parameter is accepted for drop-in compatibility with genericclioptions.NewConfigFlags but is unused.

func (*ConfigFlags) AddFlags

func (f *ConfigFlags) AddFlags(fs *pflag.FlagSet)

AddFlags registers whichever flags have non-nil pointer fields onto fs.

func (*ConfigFlags) ToRESTConfig

func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)

ToRESTConfig returns a *rest.Config built from the configured kubeconfig and context.

func (*ConfigFlags) ToRawKubeConfigLoader

func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader returns a clientcmd.ClientConfig for low-level access (e.g., reading raw context/cluster information).

Jump to

Keyboard shortcuts

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