k8s

package
v0.0.0-...-5fa7f0c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type K8sClient

type K8sClient interface {
	GetSecret(name, namespace string) (corev1.Secret, error)
	CreateSecret(secret *corev1.Secret) (*ctrl.Result, error)
	GetJob(name, namespace string) (batchv1.Job, error)
	CreateJob(job *batchv1.Job) (*ctrl.Result, error)
	DeleteJob(job *batchv1.Job) error
	GetConfigMap(name, namespace string) (corev1.ConfigMap, error)
	CreateConfigMap(cm *corev1.ConfigMap) (*ctrl.Result, error)
	GetStatefulSet(name, namespace string) (appsv1.StatefulSet, error)
	DeleteStatefulSet(sts *appsv1.StatefulSet, orphan bool) error
	ListStatefulSets(listOptions ...client.ListOption) (appsv1.StatefulSetList, error)
	GetDeployment(name, namespace string) (appsv1.Deployment, error)
	CreateDeployment(deployment *appsv1.Deployment) (*ctrl.Result, error)
	DeleteDeployment(deployment *appsv1.Deployment, orphan bool) error
	GetService(name, namespace string) (corev1.Service, error)
	CreateService(svc *corev1.Service) (*ctrl.Result, error)
	GetOpenSearchCluster(name, namespace string) (opsterv1.OpenSearchCluster, error)
	UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opsterv1.OpenSearchCluster)) error
	UdateObjectStatus(instance client.Object, f func(client.Object)) error
	ReconcileResource(runtime.Object, reconciler.DesiredState) (*ctrl.Result, error)
	GetPod(name, namespace string) (corev1.Pod, error)
	DeletePod(pod *corev1.Pod) error
	ListPods(listOptions *client.ListOptions) (corev1.PodList, error)
	GetPVC(name, namespace string) (corev1.PersistentVolumeClaim, error)
	UpdatePVC(pvc *corev1.PersistentVolumeClaim) error
	ListPVCs(listOptions *client.ListOptions) (corev1.PersistentVolumeClaimList, error)
	Scheme() *runtime.Scheme
	Context() context.Context
}

An abstraction over the kubernetes client to make testing with mocks easier and to hide some repeating boilerplate code Note: If you add a method here you need to tun `make genmocks` to update the mock

type K8sClientImpl

type K8sClientImpl struct {
	reconciler.ResourceReconciler
	client.Client
	// contains filtered or unexported fields
}

func (K8sClientImpl) Context

func (c K8sClientImpl) Context() context.Context

func (K8sClientImpl) CreateConfigMap

func (c K8sClientImpl) CreateConfigMap(cm *corev1.ConfigMap) (*ctrl.Result, error)

func (K8sClientImpl) CreateDeployment

func (c K8sClientImpl) CreateDeployment(deployment *appsv1.Deployment) (*ctrl.Result, error)

func (K8sClientImpl) CreateJob

func (c K8sClientImpl) CreateJob(job *batchv1.Job) (*ctrl.Result, error)

func (K8sClientImpl) CreateSecret

func (c K8sClientImpl) CreateSecret(secret *corev1.Secret) (*ctrl.Result, error)

func (K8sClientImpl) CreateService

func (c K8sClientImpl) CreateService(svc *corev1.Service) (*ctrl.Result, error)

func (K8sClientImpl) DeleteDeployment

func (c K8sClientImpl) DeleteDeployment(deployment *appsv1.Deployment, orphan bool) error

func (K8sClientImpl) DeleteJob

func (c K8sClientImpl) DeleteJob(job *batchv1.Job) error

func (K8sClientImpl) DeletePod

func (c K8sClientImpl) DeletePod(pod *corev1.Pod) error

func (K8sClientImpl) DeleteStatefulSet

func (c K8sClientImpl) DeleteStatefulSet(sts *appsv1.StatefulSet, orphan bool) error

func (K8sClientImpl) GetConfigMap

func (c K8sClientImpl) GetConfigMap(name, namespace string) (corev1.ConfigMap, error)

func (K8sClientImpl) GetDeployment

func (c K8sClientImpl) GetDeployment(name, namespace string) (appsv1.Deployment, error)

func (K8sClientImpl) GetJob

func (c K8sClientImpl) GetJob(name, namespace string) (batchv1.Job, error)

func (K8sClientImpl) GetOpenSearchCluster

func (c K8sClientImpl) GetOpenSearchCluster(name, namespace string) (opsterv1.OpenSearchCluster, error)

func (K8sClientImpl) GetPVC

func (c K8sClientImpl) GetPVC(name, namespace string) (corev1.PersistentVolumeClaim, error)

func (K8sClientImpl) GetPod

func (c K8sClientImpl) GetPod(name, namespace string) (corev1.Pod, error)

func (K8sClientImpl) GetSecret

func (c K8sClientImpl) GetSecret(name, namespace string) (corev1.Secret, error)

func (K8sClientImpl) GetService

func (c K8sClientImpl) GetService(name, namespace string) (corev1.Service, error)

func (K8sClientImpl) GetStatefulSet

func (c K8sClientImpl) GetStatefulSet(name, namespace string) (appsv1.StatefulSet, error)

func (K8sClientImpl) ListPVCs

func (K8sClientImpl) ListPods

func (c K8sClientImpl) ListPods(listOptions *client.ListOptions) (corev1.PodList, error)

func (K8sClientImpl) ListStatefulSets

func (c K8sClientImpl) ListStatefulSets(listOptions ...client.ListOption) (appsv1.StatefulSetList, error)

func (K8sClientImpl) ReconcileResource

func (c K8sClientImpl) ReconcileResource(object runtime.Object, state reconciler.DesiredState) (*ctrl.Result, error)

func (K8sClientImpl) Scheme

func (c K8sClientImpl) Scheme() *runtime.Scheme

func (K8sClientImpl) UdateObjectStatus

func (c K8sClientImpl) UdateObjectStatus(instance client.Object, f func(client.Object)) error

UpdateStatus for a generic kubernetes object. f should cast to specific type (e.g. `role := instance.(OpenSearchRole)`)

func (K8sClientImpl) UpdateOpenSearchClusterStatus

func (c K8sClientImpl) UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opsterv1.OpenSearchCluster)) error

func (K8sClientImpl) UpdatePVC

func (c K8sClientImpl) UpdatePVC(pvc *corev1.PersistentVolumeClaim) error

Jump to

Keyboard shortcuts

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