kubernetes

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: AGPL-3.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 {
	// 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) Client added in v0.3.2

func (f *FakeKubernetes) Client() kubernetes.Interface

Client return a kubernetes client

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) PodHelper added in v0.3.2

func (f *FakeKubernetes) PodHelper(namespace string) helpers.PodHelper

PodHelper returns a PodHelper for the given namespace

func (*FakeKubernetes) ServiceHelper added in v0.3.2

func (f *FakeKubernetes) ServiceHelper(namespace string) helpers.ServiceHelper

ServiceHelper returns a ServiceHelper for the given namespace

type Kubernetes

type Kubernetes interface {
	// Client returns a Kubernetes client
	Client() kubernetes.Interface
	// ServiceHelper returns a helpers.ServiceHelper scoped for the given namespace
	ServiceHelper(namespace string) helpers.ServiceHelper
	// PodHelper returns a helpers.PodHelper scoped for the given namespace
	PodHelper(namespace string) helpers.PodHelper
}

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() (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 NewFromConfig

func NewFromConfig(config *rest.Config) (Kubernetes, error)

NewFromConfig returns a Kubernetes instance configured with the provided kubeconfig.

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 implement helper functions for managing Kubernetes resources such as services and pods
Package helpers implement helper functions for managing Kubernetes resources such as services and pods

Jump to

Keyboard shortcuts

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