config

package
v0.15.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 3,092

Documentation

Overview

Package config contains libraries for initializing REST configs for talking to the Kubernetes API

Index

Constants

View Source
const KubeconfigFlagName = "kubeconfig"

KubeconfigFlagName is the name of the kubeconfig flag

Variables

This section is empty.

Functions

func GetConfig

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

GetConfig creates a *rest.Config for talking to a Kubernetes API server. If --kubeconfig is set, will 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 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

func GetConfigOrDie() *rest.Config

GetConfigOrDie creates a *rest.Config for talking to a Kubernetes apiserver. If --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.

func GetConfigWithContext added in v0.2.0

func GetConfigWithContext(context string) (*rest.Config, error)

GetConfigWithContext creates a *rest.Config for talking to a Kubernetes API server with a specific context. If --kubeconfig is set, will 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 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 RegisterFlags added in v0.14.0

func RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers flag variables to the given FlagSet if not already registered. It uses the default command line FlagSet, if none is provided. Currently, it only registers the kubeconfig flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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