kubernetes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoKubeConfig      = errors.New("no Kubernetes configuration available")
	ErrKubeClientNotInit = errors.New("Kubernetes client not initialized")
	ErrNamespaceAccess   = errors.New("failed to access Kubernetes namespaces")
	ErrPodAccess         = errors.New("failed to access Kubernetes pods")
	ErrPodNotFound       = errors.New("pod not found in any namespace")
)

Define error types

Functions

This section is empty.

Types

type K8sAdapter

type K8sAdapter interface {
	GetPodByPodUID(ctx context.Context, podUID string) (apiv1.Pod, error)
	GetClient() *kubernetes.Clientset
}

func NewK8SAdapter

func NewK8SAdapter(options Options) (K8sAdapter, error)

NewK8SAdapter creates a new Kubernetes adapter based on command line options. Supports two modes: 1. When running inside the cluster, use in-cluster configuration 2. When running outside the cluster, use kubeconfig configuration

type MockK8sAdapter

type MockK8sAdapter struct {
	mock.Mock
}

MockK8sAdapter is an autogenerated mock type for the K8sAdapter type

func NewMockK8sAdapter

func NewMockK8sAdapter(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockK8sAdapter

NewMockK8sAdapter creates a new instance of MockK8sAdapter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockK8sAdapter) EXPECT

func (*MockK8sAdapter) GetClient

func (_mock *MockK8sAdapter) GetClient() *kubernetes.Clientset

GetClient provides a mock function for the type MockK8sAdapter

func (*MockK8sAdapter) GetPodByPodUID

func (_mock *MockK8sAdapter) GetPodByPodUID(ctx context.Context, podUID string) (v1.Pod, error)

GetPodByPodUID provides a mock function for the type MockK8sAdapter

type MockK8sAdapter_Expecter

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

func (*MockK8sAdapter_Expecter) GetClient

GetClient is a helper method to define mock.On call

func (*MockK8sAdapter_Expecter) GetPodByPodUID

func (_e *MockK8sAdapter_Expecter) GetPodByPodUID(ctx interface{}, podUID interface{}) *MockK8sAdapter_GetPodByPodUID_Call

GetPodByPodUID is a helper method to define mock.On call

  • ctx context.Context
  • podUID string

type MockK8sAdapter_GetClient_Call

type MockK8sAdapter_GetClient_Call struct {
	*mock.Call
}

MockK8sAdapter_GetClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClient'

func (*MockK8sAdapter_GetClient_Call) Return

func (*MockK8sAdapter_GetClient_Call) Run

func (*MockK8sAdapter_GetClient_Call) RunAndReturn

type MockK8sAdapter_GetPodByPodUID_Call

type MockK8sAdapter_GetPodByPodUID_Call struct {
	*mock.Call
}

MockK8sAdapter_GetPodByPodUID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByPodUID'

func (*MockK8sAdapter_GetPodByPodUID_Call) Return

func (*MockK8sAdapter_GetPodByPodUID_Call) Run

func (*MockK8sAdapter_GetPodByPodUID_Call) RunAndReturn

func (_c *MockK8sAdapter_GetPodByPodUID_Call) RunAndReturn(run func(ctx context.Context, podUID string) (v1.Pod, error)) *MockK8sAdapter_GetPodByPodUID_Call

type Options

type Options struct {
	KubeConfigPath string
	InCluster      bool
}

Options contains Kubernetes adapter options

Jump to

Keyboard shortcuts

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