kubernetes

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kubernetes implements helper functions for manipulating resources in a Kubernetes cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeKubernetes

type FakeKubernetes struct {
	*fake.Clientset
	// contains filtered or unexported fields
}

FakeKubernetes is a fake implementation of the Kubernetes interface

func NewFakeKubernetes

func NewFakeKubernetes(clientset *fake.Clientset) (*FakeKubernetes, error)

NewFakeKubernetes returns a new fake implementation of Kubernetes from fake Clientset

func (*FakeKubernetes) Context

func (f *FakeKubernetes) Context() context.Context

Context returns the context for executing k8s actions

func (*FakeKubernetes) GetFakeProcessExecutor

func (f *FakeKubernetes) GetFakeProcessExecutor() *helpers.FakePodCommandExecutor

GetFakeProcessExecutor returns the FakeProcessExecutor used by the helpers to mock the execution of commands in a Pod

func (*FakeKubernetes) Helpers

func (f *FakeKubernetes) Helpers() helpers.Helpers

Helpers return a instance of FakeHelper

func (*FakeKubernetes) NamespacedHelpers

func (f *FakeKubernetes) NamespacedHelpers(namespace string) helpers.Helpers

NamespacedHelpers return a instance of FakeHelper for a given namespace

type Kubernetes

type Kubernetes interface {
	kubernetes.Interface
	Context() context.Context
	Helpers() helpers.Helpers
	NamespacedHelpers(namespace string) helpers.Helpers
}

Kubernetes defines an interface that extends kubernetes interface[k8s.io/client-go/kubernetes.Interface] Adding helper functions for common tasks

func New added in v0.1.3

func New(ctx context.Context) (Kubernetes, error)

New returns a Kubernetes instance or an error when no config is eligible to be used. there are three ways of loading the kubernetes config, using the order as they are described below 1. in-cluster config, from serviceAccount token. 2. KUBECONFIG environment variable. 3. $HOME/.kube/config file.

func NewFromKubeconfig

func NewFromKubeconfig(ctx context.Context, kubeconfig string) (Kubernetes, error)

NewFromKubeconfig returns a Kubernetes instance configured with the kubeconfig pointed by the given path

Directories

Path Synopsis
Package helpers offers functions to simplify dealing with kubernetes resources.
Package helpers offers functions to simplify dealing with kubernetes resources.

Jump to

Keyboard shortcuts

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