kubectl

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakePodState

type FakePodState int
const (
	FakePodUnknown FakePodState = iota
	FakePodRunning
	FakePodCompleted
	FakePodError
)

func (FakePodState) String

func (i FakePodState) String() string

type Kubectl

type Kubectl struct {
	Log logr.Logger
}

Kubectl is able to perform kubectl cli commands.

func (Kubectl) PodDelete

func (k Kubectl) PodDelete(kubeconfigPath, namespace, name string) error

PodDelete deletes a Pod.

func (Kubectl) PodLog

func (k Kubectl) PodLog(kubeconfigPath, namespace, name string) (string, error)

PodLog returns the log of a Pod.

func (Kubectl) PodRun

func (k Kubectl) PodRun(kubeconfigPath, namespace, name, image, cmd string) error

PodRun runs a Pod.

func (Kubectl) PodState

func (k Kubectl) PodState(kubeconfigPath, namespace, name string) (string, error)

PodState returns the "Ready" status reason of the Pod in the cluster addressed by kubeconfigPath. State is PodRunning, PodCompleted, ContainersNotReady or empty when no Pod is found.

func (Kubectl) StorageClasses

func (k Kubectl) StorageClasses(kubeconfigPath string) ([]storagev1.StorageClass, error)

StorageClasses returns all the StorageClasses in the cluster addressed by kubeconfigPath.

type KubectlFake

type KubectlFake struct {
	// contains filtered or unexported fields
}

KubectlFake provides a Kubectler for testing.

func (*KubectlFake) PodDelete

func (k *KubectlFake) PodDelete(kubeconfigPath, namespace, name string) error

func (*KubectlFake) PodLog

func (k *KubectlFake) PodLog(kubeconfigPath, namespace, name string) (string, error)

func (*KubectlFake) PodRun

func (k *KubectlFake) PodRun(kubeconfigPath, namespace, name, image, cmd string) error

func (*KubectlFake) PodState

func (k *KubectlFake) PodState(kubeconfigPath, namespace, name string) (string, error)

func (KubectlFake) StorageClasses

func (k KubectlFake) StorageClasses(kubeconfigPath string) ([]storagev1.StorageClass, error)

StorageClasses returns all the StorageClasses in the cluster addressed by kubeconfigPath.

type Kubectrler

type Kubectrler interface {
	// PodState returns the state of a Pod in the cluster addressed by kubeconfigPath.
	// State is FakePodRunning, FakePodCompleted, FakePodError or empty when no Pod is found.
	PodState(kubeconfigPath, namespace, name string) (string, error)
	// PodRun run a Pod
	PodRun(kubeconfigPath, namespace, name, image, cmd string) error
	// PodLog returns the log of a Pod.
	PodLog(kubeconfigPath, namespace, name string) (string, error)
	// PodDelete deletes a Pod.
	PodDelete(kubeconfigPath, namespace, name string) error
	// StorageClasses returns all the StorageClasses in the cluster addressed by kubeconfigPath.
	StorageClasses(kubeconfigPath string) ([]storagev1.StorageClass, error)
}

Kubectrler is able to perform kubectl cli commands.

Jump to

Keyboard shortcuts

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