k8s

package
v0.5.56 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kubernetes

type Kubernetes interface {
	SetConfig(string) (Kubernetes, error)
	GetPods(string) (*v1.PodList, error)
	HealthCheckPods(selectors []string, timeout time.Duration) error
	Apply(files []string, waitUntilReady bool) error
	Delete(files []string) error
	GetPodLogs(ctx context.Context, podName, nameSpace string) (io.ReadCloser, error)
}

Kubernetes defines an interface for a Kuberenetes client

func NewKubernetes

func NewKubernetes(t time.Duration, l logger.Logger) Kubernetes

NewKubernetes creates a new client for interacting with Kubernetes clusters

type KubernetesImpl

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

KubernetesImpl is a concrete implementation of a Kubernetes client

func (*KubernetesImpl) Apply

func (k *KubernetesImpl) Apply(files []string, waitUntilReady bool) error

Apply Kubernetes YAML files at path if waitUntilReady is true then the client will block until all resources have been created

func (*KubernetesImpl) Delete

func (k *KubernetesImpl) Delete(files []string) error

Delete Kuberentes YAML files at path

func (*KubernetesImpl) GetPodLogs

func (k *KubernetesImpl) GetPodLogs(ctx context.Context, podName, nameSpace string) (io.ReadCloser, error)

GetPodLogs returns a io.ReadCloser,err for a given pods' logs

func (*KubernetesImpl) GetPods

func (k *KubernetesImpl) GetPods(selector string) (*v1.PodList, error)

GetPods returns the Kubernetes pods based on the label selector

func (*KubernetesImpl) HealthCheckPods

func (k *KubernetesImpl) HealthCheckPods(selectors []string, timeout time.Duration) error

HealthCheckPods uses the given selector to check that all pods are started and running. selectors are checked sequentially pods = ["component=server,app=consul", "component=client,app=consul"]

func (*KubernetesImpl) SetConfig

func (k *KubernetesImpl) SetConfig(kubeconfig string) (Kubernetes, error)

SetConfig for the Kubernetes cluster and clones the client

type MockKubernetes

type MockKubernetes struct {
	mock.Mock
}

func (*MockKubernetes) Apply

func (m *MockKubernetes) Apply(files []string, waitUntilReady bool) error

func (*MockKubernetes) Delete

func (m *MockKubernetes) Delete(files []string) error

func (*MockKubernetes) GetPodLogs

func (m *MockKubernetes) GetPodLogs(ctx context.Context, podName, nameSpace string) (io.ReadCloser, error)

func (*MockKubernetes) GetPods

func (m *MockKubernetes) GetPods(selector string) (*v1.PodList, error)

func (*MockKubernetes) HealthCheckPods

func (m *MockKubernetes) HealthCheckPods(selectors []string, timeout time.Duration) error

func (*MockKubernetes) SetConfig

func (m *MockKubernetes) SetConfig(kubeconfig string) (Kubernetes, error)

Jump to

Keyboard shortcuts

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