k8sconfig

package module
v0.0.0-...-64f357c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRestConfig

func CreateRestConfig(apiConf APIConfig) (*rest.Config, error)

CreateRestConfig creates a Kubernetes API config from user configuration.

func MakeClient

func MakeClient(apiConf APIConfig) (kubernetes.Interface, error)

func MakeDynamicClient

func MakeDynamicClient(apiConf APIConfig) (dynamic.Interface, error)

Types

type APIConfig

type APIConfig struct {
	// How to authenticate to the K8s API server.  This can be one of `none`
	// (for no auth), `serviceAccount` (to use the standard service account
	// token provided to the agent pod), or `kubeConfig` to use credentials
	// from `~/.kube/config`.
	AuthType AuthType `mapstructure:"auth_type"`

	// When using auth_type `kubeConfig`, override the current context.
	Context string `mapstructure:"context"`
}

APIConfig contains options relevant to connecting to the K8s API

func (APIConfig) Validate

func (c APIConfig) Validate() error

Validate validates the K8s API config

type AuthType

type AuthType string
const (
	// AuthTypeNone means no auth is required
	AuthTypeNone AuthType = "none"
	// AuthTypeServiceAccount means to use the built-in service account that
	// K8s automatically provisions for each pod.
	AuthTypeServiceAccount AuthType = "serviceAccount"
	// AuthTypeKubeConfig uses local credentials like those used by kubectl.
	AuthTypeKubeConfig AuthType = "kubeConfig"
)

Jump to

Keyboard shortcuts

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