configutils

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(opts ...GetConfigOption) (*rest.Config, error)

GetConfig creates a *rest.Config for talking to a Kubernetes API server. Kubeconfig / the '--kubeconfig' flag instruct to use the kubeconfig file at that location. Otherwise, will assume running in cluster and use the cluster provided kubeconfig.

It also applies saner defaults for QPS and burst based on the Kubernetes controller manager defaults (20 QPS, 30 burst)

Config precedence

* Kubeconfig / --kubeconfig value / flag pointing at a file

* KUBECONFIG environment variable pointing at a file

* In-cluster config if running in cluster

* $HOME/.kube/config if exists.

func GetConfigOrDie added in v0.5.2

func GetConfigOrDie(opts ...GetConfigOption) *rest.Config

GetConfigOrDie creates a *rest.Config for talking to a Kubernetes apiserver. If Kubeconfig / --kubeconfig is set, will use the kubeconfig file at that location. Otherwise, will assume running in cluster and use the cluster provided kubeconfig.

Will log an error and exit if there is an error creating the rest.Config.

Types

type Context

type Context string

Context allows specifying the context to load.

func (Context) ApplyToGetConfig

func (c Context) ApplyToGetConfig(o *GetConfigOptions)

ApplyToGetConfig implements GetConfigOption.

type GetConfigOption

type GetConfigOption interface {
	// ApplyToGetConfig modifies the underlying GetConfigOptions.
	ApplyToGetConfig(o *GetConfigOptions)
}

GetConfigOption are options to a GetConfig call.

type GetConfigOptions

type GetConfigOptions struct {
	// Context is the kubeconfig context to load.
	Context string
	// Kubeconfig is the path to a kubeconfig to load.
	// If unset, the '--kubeconfig' flag is used.
	Kubeconfig *string
}

GetConfigOptions are options to supply for a GetConfig call.

func (*GetConfigOptions) ApplyOptions

func (o *GetConfigOptions) ApplyOptions(opts []GetConfigOption)

ApplyOptions applies all GetConfigOption tro this GetConfigOptions.

func (*GetConfigOptions) ApplyToGetConfig

func (o *GetConfigOptions) ApplyToGetConfig(o2 *GetConfigOptions)

ApplyToGetConfig implements GetConfigOption.

type Kubeconfig

type Kubeconfig string

Kubeconfig allows specifying the path to a kubeconfig file to use.

func (Kubeconfig) ApplyToGetConfig

func (k Kubeconfig) ApplyToGetConfig(o *GetConfigOptions)

ApplyToGetConfig implements GetConfigOption.

Jump to

Keyboard shortcuts

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