k8sclient

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0 Imports: 13 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLabelSelectorString

func CreateLabelSelectorString(labels map[string]string) string

func CreateListOptions

func CreateListOptions(timeout *int64, labels map[string]string, resourceVersion string) *metav1.ListOptions

Types

type FakeKubeClient

type FakeKubeClient struct {
	Deployments map[string]*appsv1.Deployment
	PVCs        map[string]*v1.PersistentVolumeClaim
	// contains filtered or unexported fields
}

func NewFakeKubeClient

func NewFakeKubeClient(failMatrix map[string]bool, versionMajor, versionMinor string) *FakeKubeClient

func (*FakeKubeClient) CheckDeploymentExists

func (k *FakeKubeClient) CheckDeploymentExists(deploymentName string) (bool, error)

func (*FakeKubeClient) CheckPVCExists

func (k *FakeKubeClient) CheckPVCExists(pvc string) (bool, error)

func (*FakeKubeClient) CheckPodExists

func (k *FakeKubeClient) CheckPodExists(pod string) (bool, error)

func (*FakeKubeClient) CheckSecretExists

func (k *FakeKubeClient) CheckSecretExists(secretName string) (bool, error)

func (*FakeKubeClient) CreateCHAPSecret

func (k *FakeKubeClient) CreateCHAPSecret(secretName, accountName, initiatorSecret, targetSecret string) (*v1.Secret,
	error)

func (*FakeKubeClient) CreateDeployment

func (k *FakeKubeClient) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error)

func (*FakeKubeClient) CreatePV

func (*FakeKubeClient) CreatePVC

func (*FakeKubeClient) CreatePod

func (k *FakeKubeClient) CreatePod(pod *v1.Pod) (*v1.Pod, error)

func (*FakeKubeClient) CreateSecret

func (k *FakeKubeClient) CreateSecret(secret *v1.Secret) (*v1.Secret, error)

func (*FakeKubeClient) DeletePV

func (k *FakeKubeClient) DeletePV(pvName string, options *metav1.DeleteOptions) error

func (*FakeKubeClient) DeletePVC

func (k *FakeKubeClient) DeletePVC(pvcName string, options *metav1.DeleteOptions) error

func (*FakeKubeClient) DeletePod

func (k *FakeKubeClient) DeletePod(podName string, options *metav1.DeleteOptions) error

func (*FakeKubeClient) DeleteSecret

func (k *FakeKubeClient) DeleteSecret(secretName string, options *metav1.DeleteOptions) error

func (*FakeKubeClient) GetBoundPVC

func (k *FakeKubeClient) GetBoundPVC(pvc *v1.PersistentVolumeClaim,
	pv *v1.PersistentVolume, timeout *int64,
	labels map[string]string) (*v1.PersistentVolumeClaim, error)

func (*FakeKubeClient) GetDeployment

func (k *FakeKubeClient) GetDeployment(deploymentName string,
	options metav1.GetOptions) (*appsv1.Deployment, error)

func (*FakeKubeClient) GetPVC

func (k *FakeKubeClient) GetPVC(pvcName string,
	options metav1.GetOptions) (*v1.PersistentVolumeClaim, error)

func (*FakeKubeClient) GetPVCPhase

func (k *FakeKubeClient) GetPVCPhase(pvcName string,
	options metav1.GetOptions) (v1.PersistentVolumeClaimPhase, error)

func (*FakeKubeClient) GetPod

func (k *FakeKubeClient) GetPod(podName string,
	options metav1.GetOptions) (*v1.Pod, error)

func (*FakeKubeClient) GetPodByLabels

func (k *FakeKubeClient) GetPodByLabels(listOptions *metav1.ListOptions) (*v1.Pod, error)

func (*FakeKubeClient) GetPodPhase

func (k *FakeKubeClient) GetPodPhase(podName string,
	options metav1.GetOptions) (v1.PodPhase, error)

func (*FakeKubeClient) GetRunningPod

func (k *FakeKubeClient) GetRunningPod(pod *v1.Pod, timeout *int64, labels map[string]string) (*v1.Pod, error)

func (*FakeKubeClient) GetSecret

func (k *FakeKubeClient) GetSecret(secretName string, options metav1.GetOptions) (*v1.Secret, error)

func (*FakeKubeClient) ListPod

func (k *FakeKubeClient) ListPod(listOptions *metav1.ListOptions) (*v1.PodList, error)

func (*FakeKubeClient) Namespace

func (k *FakeKubeClient) Namespace() string

func (*FakeKubeClient) SnapshotState

func (k *FakeKubeClient) SnapshotState() *FakeKubeClientState

func (*FakeKubeClient) Version

func (k *FakeKubeClient) Version() *version.Info

func (*FakeKubeClient) WatchPVC

func (k *FakeKubeClient) WatchPVC(listOptions *metav1.ListOptions) (watch.Interface, error)

func (*FakeKubeClient) WatchPod

func (k *FakeKubeClient) WatchPod(listOptions *metav1.ListOptions) (watch.Interface, error)

type FakeKubeClientState

type FakeKubeClientState struct {
	Deployments []string
	PVCs        []string
}

type Interface

type Interface interface {
	Version() *version.Info
	GetDeployment(deploymentName string, options metav1.GetOptions) (*appsv1.Deployment, error)
	CheckDeploymentExists(deploymentName string) (bool, error)
	CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error)
	GetPod(podName string, options metav1.GetOptions) (*v1.Pod, error)
	GetPodByLabels(listOptions *metav1.ListOptions) (*v1.Pod, error)
	GetPodPhase(podName string, options metav1.GetOptions) (v1.PodPhase, error)
	CheckPodExists(pod string) (bool, error)
	CreatePod(pod *v1.Pod) (*v1.Pod, error)
	DeletePod(podName string, options *metav1.DeleteOptions) error
	WatchPod(listOptions *metav1.ListOptions) (watch.Interface, error)
	ListPod(listOptions *metav1.ListOptions) (*v1.PodList, error)
	GetRunningPod(pod *v1.Pod, timeout *int64, labels map[string]string) (*v1.Pod, error)
	GetPVC(pvcName string, options metav1.GetOptions) (*v1.PersistentVolumeClaim, error)
	GetPVCPhase(pvcName string, options metav1.GetOptions) (v1.PersistentVolumeClaimPhase, error)
	CheckPVCExists(pvc string) (bool, error)
	CreatePVC(pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error)
	DeletePVC(pvcName string, options *metav1.DeleteOptions) error
	WatchPVC(listOptions *metav1.ListOptions) (watch.Interface, error)
	GetBoundPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume, timeout *int64,
		labels map[string]string) (*v1.PersistentVolumeClaim, error)
	CreatePV(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
	DeletePV(pvName string, options *metav1.DeleteOptions) error
	CreateSecret(secret *v1.Secret) (*v1.Secret, error)
	CreateCHAPSecret(secretName, accountName, initiatorSecret, targetSecret string) (*v1.Secret, error)
	GetSecret(secretName string, options metav1.GetOptions) (*v1.Secret, error)
	CheckSecretExists(secretName string) (bool, error)
	DeleteSecret(secretName string, options *metav1.DeleteOptions) error
	Namespace() string
}

func NewFakeKubeClientBasic

func NewFakeKubeClientBasic(config *rest.Config, namespace string) (Interface, error)

func NewKubeClient

func NewKubeClient(config *rest.Config, namespace string) (Interface, error)

type KubeClient

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

func (*KubeClient) CheckDeploymentExists

func (k *KubeClient) CheckDeploymentExists(deploymentName string) (bool, error)

func (*KubeClient) CheckPVCExists

func (k *KubeClient) CheckPVCExists(pvc string) (bool, error)

func (*KubeClient) CheckPodExists

func (k *KubeClient) CheckPodExists(pod string) (bool, error)

func (*KubeClient) CheckSecretExists

func (k *KubeClient) CheckSecretExists(secretName string) (bool, error)

CheckSecretExists returns true if the Secret exists

func (*KubeClient) CreateCHAPSecret

func (k *KubeClient) CreateCHAPSecret(secretName, accountName, initiatorSecret, targetSecret string) (*v1.Secret,
	error)

CreateCHAPSecret creates a new Secret for iSCSI CHAP mutual authentication

func (*KubeClient) CreateDeployment

func (k *KubeClient) CreateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error)

func (*KubeClient) CreatePV

func (k *KubeClient) CreatePV(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)

func (*KubeClient) CreatePVC

func (*KubeClient) CreatePod

func (k *KubeClient) CreatePod(pod *v1.Pod) (*v1.Pod, error)

func (*KubeClient) CreateSecret

func (k *KubeClient) CreateSecret(secret *v1.Secret) (*v1.Secret, error)

CreateSecret creates a new Secret

func (*KubeClient) DeletePV

func (k *KubeClient) DeletePV(pvName string, options *metav1.DeleteOptions) error

func (*KubeClient) DeletePVC

func (k *KubeClient) DeletePVC(pvcName string, options *metav1.DeleteOptions) error

func (*KubeClient) DeletePod

func (k *KubeClient) DeletePod(podName string, options *metav1.DeleteOptions) error

func (*KubeClient) DeleteSecret

func (k *KubeClient) DeleteSecret(secretName string, options *metav1.DeleteOptions) error

DeleteSecret deletes the specified Secret

func (*KubeClient) GetBoundPVC

func (k *KubeClient) GetBoundPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume, timeout *int64,
	labels map[string]string) (*v1.PersistentVolumeClaim, error)

func (*KubeClient) GetDeployment

func (k *KubeClient) GetDeployment(
	deploymentName string,
	options metav1.GetOptions) (*appsv1.Deployment, error)

func (*KubeClient) GetPVC

func (k *KubeClient) GetPVC(pvcName string,
	options metav1.GetOptions) (*v1.PersistentVolumeClaim, error)

func (*KubeClient) GetPVCPhase

func (k *KubeClient) GetPVCPhase(pvcName string,
	options metav1.GetOptions) (v1.PersistentVolumeClaimPhase, error)

func (*KubeClient) GetPod

func (k *KubeClient) GetPod(podName string, options metav1.GetOptions) (*v1.Pod, error)

func (*KubeClient) GetPodByLabels

func (k *KubeClient) GetPodByLabels(listOptions *metav1.ListOptions) (*v1.Pod, error)

func (*KubeClient) GetPodPhase

func (k *KubeClient) GetPodPhase(podName string, options metav1.GetOptions) (v1.PodPhase, error)

func (*KubeClient) GetRunningPod

func (k *KubeClient) GetRunningPod(pod *v1.Pod, timeout *int64, labels map[string]string) (*v1.Pod, error)

func (*KubeClient) GetSecret

func (k *KubeClient) GetSecret(secretName string, options metav1.GetOptions) (*v1.Secret, error)

GetSecret looks up a Secret by name

func (*KubeClient) ListPod

func (k *KubeClient) ListPod(listOptions *metav1.ListOptions) (*v1.PodList, error)

func (*KubeClient) Namespace

func (k *KubeClient) Namespace() string

func (*KubeClient) Version

func (k *KubeClient) Version() *version.Info

func (*KubeClient) WatchPVC

func (k *KubeClient) WatchPVC(listOptions *metav1.ListOptions) (watch.Interface, error)

func (*KubeClient) WatchPod

func (k *KubeClient) WatchPod(listOptions *metav1.ListOptions) (watch.Interface, error)

Jump to

Keyboard shortcuts

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