k8s

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package k8s is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateObjectWithRetry added in v0.0.7

func CreateObjectWithRetry(ctx context.Context, cl client.Client, obj client.Object, opts ...client.CreateOption) error

create then get the object to ensure it is created

func DeleteObjectWithRetry added in v0.0.7

func DeleteObjectWithRetry(ctx context.Context, cl client.Client, obj client.Object, opts ...client.DeleteOption) error

delete then get the object to ensure it is deleted

func EnsureObject added in v0.0.7

func EnsureObject(ctx context.Context, cl client.Client, obj client.Object) error

EnsureObject ensures that the object exists in the cluster.

func ExtractNodeInstanceID

func ExtractNodeInstanceID(node *corev1.Node) (string, error)

func FilterNodeWithLabel

func FilterNodeWithLabel(nodes []*corev1.Node, nodeLabels map[string]string) []*corev1.Node

func FilterNodeWithoutLabel added in v0.0.3

func FilterNodeWithoutLabel(nodes []*corev1.Node, nodeLabels map[string]string) []*corev1.Node

func GetNodeCondition

func GetNodeCondition(node *corev1.Node, conditionType corev1.NodeConditionType) *corev1.NodeCondition

GetNodeCondition will get pointer to Node's existing condition. returns nil if no matching condition found.

func HasFinalizer

func HasFinalizer(obj metav1.Object, finalizer string) bool

HasFinalizer tests whether k8s object has specified finalizer

func NamespacedName

func NamespacedName(obj metav1.Object) types.NamespacedName

NamespacedName returns the namespaced name for k8s objects

func NodeNames

func NodeNames(nodes []*corev1.Node) []string

NodeNames get all the node names.

func NodeSlicesEqual

func NodeSlicesEqual(x, y []*corev1.Node) bool

NodeSlicesEqual check if two nodes equals to each other.

func ToSliceOfNamespacedNames

func ToSliceOfNamespacedNames[T metav1.ObjectMetaAccessor](s []T) []types.NamespacedName

ToSliceOfNamespacedNames gets the slice of types.NamespacedName from the input slice s

Types

type FinalizerManager

type FinalizerManager interface {
	AddFinalizers(ctx context.Context, object client.Object, finalizers ...string) error
	RemoveFinalizers(ctx context.Context, object client.Object, finalizers ...string) error
}

func NewDefaultFinalizerManager

func NewDefaultFinalizerManager(k8sClient client.Client, log logr.Logger) FinalizerManager

type Getter

type Getter interface {
	GetClusterKubeconfig(ctx context.Context, clusterKey ctrlclient.ObjectKey) (string, error)
}

type KubeconfigGetter

type KubeconfigGetter struct{}

func (*KubeconfigGetter) GetClusterKubeconfig

func (k *KubeconfigGetter) GetClusterKubeconfig(ctx context.Context, clusterKey ctrlclient.ObjectKey) (string, error)

GetClusterKubeconfig returns the kubeconfig for a selected Cluster as a string.

type MockFinalizerManager

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

MockFinalizerManager is a mock of FinalizerManager interface.

func NewMockFinalizerManager

func NewMockFinalizerManager(ctrl *gomock.Controller) *MockFinalizerManager

NewMockFinalizerManager creates a new mock instance.

func (*MockFinalizerManager) AddFinalizers

func (m *MockFinalizerManager) AddFinalizers(arg0 context.Context, arg1 client.Object, arg2 ...string) error

AddFinalizers mocks base method.

func (*MockFinalizerManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFinalizerManager) RemoveFinalizers

func (m *MockFinalizerManager) RemoveFinalizers(arg0 context.Context, arg1 client.Object, arg2 ...string) error

RemoveFinalizers mocks base method.

type MockFinalizerManagerMockRecorder

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

MockFinalizerManagerMockRecorder is the mock recorder for MockFinalizerManager.

func (*MockFinalizerManagerMockRecorder) AddFinalizers

func (mr *MockFinalizerManagerMockRecorder) AddFinalizers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

AddFinalizers indicates an expected call of AddFinalizers.

func (*MockFinalizerManagerMockRecorder) RemoveFinalizers

func (mr *MockFinalizerManagerMockRecorder) RemoveFinalizers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

RemoveFinalizers indicates an expected call of RemoveFinalizers.

Jump to

Keyboard shortcuts

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