Documentation ¶
Overview ¶
Package flag implements shortcuts for parsing flags and creating kubernetes client from them.
Usage ¶
Create ConfigFlag that by default looks for config in your home dir and use a shortcut to create kubernetes.Clientset
import kflag "github.com/bukowa/goutils/kubernetes/config/flag" import "flag" cf := kflag.NewConfigFlag() // set flags cf.Set() // parse flags flag.Parse() // create kubernetes client c, err := kubeConfigFlag.NewClient()
By default config file from home directory will be used `$HOME/.kube/config`. If you set --kubeconfig to empty value then client will use in-cluster config files.
cf := kflag.NewConfigFlag() // change default to use in-cluster config cf.Default = "" // parse flags flag.Parse() // create kubernetes client c, err := kubeConfigFlag.NewClient()
Index ¶
Constants ¶
View Source
const ( ConfigPathFlagName = "kubeconfig" ConfigPathFlagHelp = "path to kubernetes config file, can be empty - API client will load in-cluster config then" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigFlag ¶
func NewConfigFlag ¶
func NewConfigFlag() *ConfigFlag
func (*ConfigFlag) NewClient ¶
func (cf *ConfigFlag) NewClient() (c *kubernetes.Clientset, err error)
func (*ConfigFlag) SetFlagSet ¶
func (cf *ConfigFlag) SetFlagSet(fs *flag.FlagSet)
Click to show internal directories.
Click to hide internal directories.