kubernetes

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEnvVarNotFound  = errors.New("env var not found")
	ErrNoDiscoveryEnvs = errors.New("failed to find config")
)
View Source
var (
	ErrNoEnvNames              = errors.New("dialect does not contain any env names")
	ErrSecretDoesNotHaveKey    = errors.New("secret does not have key")
	ErrConfigMapDoesNotHaveKey = errors.New("config map does not have key")
)
View Source
var ErrNoPods = errors.New("no pods in namespace")
View Source
var ErrPodNotFound = errors.New("no pods with matching label")

Functions

func FilterPodList added in v1.8.0

func FilterPodList(pods []v1.Pod, queries []LabelQueryable) []v1.Pod

func FindEnvVar

func FindEnvVar(pod v1.Pod, envName string) (*v1.EnvVar, error)

func NewConfigLoader added in v1.4.3

func NewConfigLoader(kubeconfig, context string) clientcmd.ClientConfig

Types

type ConfigFinder added in v1.8.0

type ConfigFinder interface {
	GetValue(context.Context, KubeClient, corev1.Pod) (string, error)
}

type ConfigFinders added in v1.8.0

type ConfigFinders []ConfigFinder

func (ConfigFinders) Search added in v1.8.0

func (c ConfigFinders) Search(ctx context.Context, client KubeClient, pod corev1.Pod) (string, error)

type ConfigFromEnv added in v1.8.0

type ConfigFromEnv []string

func (ConfigFromEnv) GetValue added in v1.8.0

func (e ConfigFromEnv) GetValue(ctx context.Context, client KubeClient, pod corev1.Pod) (string, error)

type ConfigFromVolumeSecret added in v1.8.0

type ConfigFromVolumeSecret struct {
	Name string
	Key  string
}

func (ConfigFromVolumeSecret) GetValue added in v1.8.0

func (f ConfigFromVolumeSecret) GetValue(ctx context.Context, client KubeClient, pod corev1.Pod) (string, error)

type ExecOptions added in v1.7.0

type ExecOptions struct {
	Pod            v1.Pod
	Cmd            string
	Stdin          io.Reader
	Stdout, Stderr io.Writer
	TTY            bool
	SizeQueue      remotecommand.TerminalSizeQueue
	DisablePing    bool
}

type KubeClient

type KubeClient struct {
	ClientSet    kubernetes.Interface
	ClientConfig *rest.Config
	Discovery    *discovery.DiscoveryClient
	Context      string
	Namespace    string
}

func NewClient

func NewClient(kubeconfig, context, namespace string) (config KubeClient, err error)

func NewClientFromCmd

func NewClientFromCmd(cmd *cobra.Command) (KubeClient, error)

func (KubeClient) ConfigMaps added in v1.7.0

func (client KubeClient) ConfigMaps() v1.ConfigMapInterface

func (KubeClient) Exec

func (client KubeClient) Exec(ctx context.Context, opt ExecOptions) error

func (KubeClient) GetNamespacedPods

func (client KubeClient) GetNamespacedPods(ctx context.Context) (*v1.PodList, error)

func (KubeClient) GetPodsFiltered

func (client KubeClient) GetPodsFiltered(ctx context.Context, queries []LabelQueryable) ([]v1.Pod, error)

func (KubeClient) Jobs added in v1.7.0

func (client KubeClient) Jobs() batchv1.JobInterface

func (*KubeClient) MinServerVersion added in v1.6.7

func (c *KubeClient) MinServerVersion(wantMajor, wantMinor int) (bool, error)

func (KubeClient) Namespaces

func (client KubeClient) Namespaces() v1.NamespaceInterface

func (KubeClient) Pods

func (client KubeClient) Pods() v1.PodInterface

func (KubeClient) Secrets

func (client KubeClient) Secrets() v1.SecretInterface

type LabelQuery

type LabelQuery struct {
	Name     string
	Operator selection.Operator
	Value    string
}

func (LabelQuery) FindPods

func (query LabelQuery) FindPods(pods []v1.Pod) []v1.Pod

func (LabelQuery) Matches

func (query LabelQuery) Matches(pod v1.Pod) bool

type LabelQueryAnd

type LabelQueryAnd []LabelQuery

func (LabelQueryAnd) FindPods

func (queries LabelQueryAnd) FindPods(pods []v1.Pod) []v1.Pod

func (LabelQueryAnd) Matches

func (queries LabelQueryAnd) Matches(pod v1.Pod) bool

type LabelQueryable

type LabelQueryable interface {
	Matches(pod v1.Pod) bool
	FindPods(pods []v1.Pod) []v1.Pod
}

Jump to

Keyboard shortcuts

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