config

package
v0.0.0-...-7d477ab Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataOrFile

func DataOrFile(data []byte, file string) ([]byte, error)

DataOrFile reads content of data, or file's content if data doesn't exist and represent it as []byte data.

func InClusterConfig

func InClusterConfig() (*client.Configuration, error)

InClusterConfig returns a config object which uses the service account kubernetes gives to pods. It's intended for clients that expect to be running inside a pod running on kubernetes. It will return an error if called from a process not running in a kubernetes environment.

func LoadKubeConfig

func LoadKubeConfig() (*client.Configuration, error)

LoadKubeConfig loads authentication and cluster information from kube-config file and stores them in returned client.Configuration.

Types

type DefaultGoogleCredentialLoader

type DefaultGoogleCredentialLoader struct{}

DefaultGoogleCredentialLoader provides the default method for getting GCP token

func (DefaultGoogleCredentialLoader) GetGoogleCredentials

func (l DefaultGoogleCredentialLoader) GetGoogleCredentials() (*oauth2.Token, error)

GetGoogleCredentials fetches GCP using default locations

type GoogleCredentialLoader

type GoogleCredentialLoader interface {
	GetGoogleCredentials() (*oauth2.Token, error)
}

GoogleCredentialLoader defines the interface for getting GCP token

type KubeConfigLoader

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

KubeConfigLoader implements the util functions to load authentication and cluster info and hosts intermediate info values.

func NewKubeConfigLoaderFromYAMLFile

func NewKubeConfigLoaderFromYAMLFile(filename string, skipConfigPersist bool) (*KubeConfigLoader, error)

NewKubeConfigLoaderFromYAMLFile creates a new KubeConfigLoader with a parsed config yaml file.

func (*KubeConfigLoader) LoadActiveContext

func (l *KubeConfigLoader) LoadActiveContext() error

LoadActiveContext parses the loader's rawConfig using current context and set loader's current cluster and user.

func (*KubeConfigLoader) LoadAndSet

func (l *KubeConfigLoader) LoadAndSet() (*client.Configuration, error)

LoadAndSet loads authentication and cluster information from kube-config file and stores them in returned Configuration.

func (*KubeConfigLoader) RestConfig

func (l *KubeConfigLoader) RestConfig() RestConfig

RestConfig returns the value of RestConfig in a KubeConfigLoader

func (*KubeConfigLoader) SetActiveContext

func (l *KubeConfigLoader) SetActiveContext(ctx string) error

SetActiveContext sets the active context in rawConfig, performs necessary persistence, and reload active context. This function enables context switch

type RestConfig

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

RestConfig contains the information that a rest client needs to talk with a server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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