kubernetes

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 8 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 Config

type Config struct {
	// Context for executing kubernetes operations
	Context context.Context
	// Path to Kubernetes access configuration
	Kubeconfig string
}

Config defines the configuration for creating a Kubernetes instance

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 NewFromConfig

func NewFromConfig(c Config) (Kubernetes, error)

NewFromConfig returns a Kubernetes instance configured with the given options

func NewFromKubeconfig

func NewFromKubeconfig(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