configutils

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 11 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 EgressSelectionName added in v0.6.5

type EgressSelectionName string

EgressSelectionName is the name of the egress configuration to use.

const (
	// EgressSelectionNameControlPlane instructs to use the controlplane egress selection.
	EgressSelectionNameControlPlane EgressSelectionName = "controlplane"
	// EgressSelectionNameEtcd instructs to use the etcd egress selection.
	EgressSelectionNameEtcd EgressSelectionName = "etcd"
	// EgressSelectionNameCluster instructs to use the cluster egress selection.
	EgressSelectionNameCluster EgressSelectionName = "cluster"
)

func (EgressSelectionName) NetworkContext added in v0.6.5

NetworkContext returns the corresponding network context of the egress selection.

type EgressSelectorConfig added in v0.6.5

type EgressSelectorConfig string

EgressSelectorConfig allows specifying the path to an egress selector config to use.

func (EgressSelectorConfig) ApplyToGetConfig added in v0.6.5

func (c EgressSelectorConfig) ApplyToGetConfig(o *GetConfigOptions)

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
	// EgressSelectorConfig is the path to an egress selector config to load.
	EgressSelectorConfig string
	// EgressSelectionName is the name of the egress configuration to use.
	// Defaults to EgressSelectionNameControlPlane.
	EgressSelectionName EgressSelectionName
}

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.

type WithEgressSelectionName added in v0.6.5

type WithEgressSelectionName EgressSelectionName

func (WithEgressSelectionName) ApplyToGetConfig added in v0.6.5

func (w WithEgressSelectionName) ApplyToGetConfig(o *GetConfigOptions)

ApplyToGetConfig implements GetConfigOption.

Jump to

Keyboard shortcuts

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