kuberc

package
v0.33.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const RecommendedKubeRCFileName = "kuberc"

Variables

Functions

func DefaultGetPreferences

func DefaultGetPreferences(kuberc string, errOut io.Writer) (*config.Preference, error)

DefaultGetPreferences returns KubeRCConfiguration. If users sets kuberc file explicitly in --kuberc flag, it has the highest priority. If not specified, it looks for in KUBERC environment variable. If KUBERC is also not set, it falls back to default .kuberc file at the same location where kubeconfig's defaults are residing in. If KUBERC is set to "off", kuberc will be turned off and original behaviors in kubectl will be applied.

Types

type Preferences

type Preferences struct {
	// contains filtered or unexported fields
}

Preferences stores the kuberc file coming either from environment variable or file from set in flag or the default kuberc path.

func (*Preferences) AddFlags

func (p *Preferences) AddFlags(flags *pflag.FlagSet)

AddFlags adds kuberc related flags into the command.

func (*Preferences) Apply

func (p *Preferences) Apply(rootCmd *cobra.Command, args []string, errOut io.Writer) ([]string, error)

Apply firstly applies the aliases in the preferences file and secondly overrides the default values of flags.

type PreferencesHandler

type PreferencesHandler interface {
	AddFlags(flags *pflag.FlagSet)
	Apply(rootCmd *cobra.Command, args []string, errOut io.Writer) ([]string, error)
}

PreferencesHandler is responsible for setting default flags arguments based on user's kuberc configuration.

func NewPreferences

func NewPreferences() PreferencesHandler

NewPreferences returns initialized Prefrences object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳