targetselector

package
v0.0.0-...-db6184a Latest Latest
Warning

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

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

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLabelSelectorFromInstance

func GetLabelSelectorFromInstance(instance *chaosv1beta1.Disruption) (labels.Selector, error)

GetLabelSelectorFromInstance crafts a label selector made of requirements from the given disruption instance

func ValidateLabelSelector

func ValidateLabelSelector(selector labels.Selector) error

ValidateLabelSelector assert label selector matches valid grammar, avoids CORE-414

Types

type TargetSelector

type TargetSelector interface {
	// GetMatchingPodsOverTotalPods Returns list of matching ready and untargeted pods and number of total pods
	GetMatchingPodsOverTotalPods(c client.Client, instance *chaosv1beta1.Disruption) (*corev1.PodList, int, error)

	// GetMatchingNodesOverTotalNodes Returns list of matching ready and untargeted nodes and number of total nodes
	GetMatchingNodesOverTotalNodes(c client.Client, instance *chaosv1beta1.Disruption) (*corev1.NodeList, int, error)

	// TargetIsHealthy Returns an error if the given target is unhealthy or does not exist
	TargetIsHealthy(target string, c client.Client, instance *chaosv1beta1.Disruption) error
}

TargetSelector is an interface for applying network disruptions to a Kubernetes Cluster

func NewRunningTargetSelector

func NewRunningTargetSelector(controllerEnableSafeguards bool, controllerNodeName string) TargetSelector

type TargetSelectorMock

type TargetSelectorMock struct {
	mock.Mock
}

TargetSelectorMock is an autogenerated mock type for the TargetSelector type

func NewTargetSelectorMock

func NewTargetSelectorMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *TargetSelectorMock

NewTargetSelectorMock creates a new instance of TargetSelectorMock. 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 (*TargetSelectorMock) EXPECT

func (*TargetSelectorMock) GetMatchingNodesOverTotalNodes

func (_m *TargetSelectorMock) GetMatchingNodesOverTotalNodes(c client.Client, instance *v1beta1.Disruption) (*v1.NodeList, int, error)

GetMatchingNodesOverTotalNodes provides a mock function with given fields: c, instance

func (*TargetSelectorMock) GetMatchingPodsOverTotalPods

func (_m *TargetSelectorMock) GetMatchingPodsOverTotalPods(c client.Client, instance *v1beta1.Disruption) (*v1.PodList, int, error)

GetMatchingPodsOverTotalPods provides a mock function with given fields: c, instance

func (*TargetSelectorMock) TargetIsHealthy

func (_m *TargetSelectorMock) TargetIsHealthy(target string, c client.Client, instance *v1beta1.Disruption) error

TargetIsHealthy provides a mock function with given fields: target, c, instance

type TargetSelectorMock_Expecter

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

func (*TargetSelectorMock_Expecter) GetMatchingNodesOverTotalNodes

func (_e *TargetSelectorMock_Expecter) GetMatchingNodesOverTotalNodes(c interface{}, instance interface{}) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call

GetMatchingNodesOverTotalNodes is a helper method to define mock.On call

  • c client.Client
  • instance *v1beta1.Disruption

func (*TargetSelectorMock_Expecter) GetMatchingPodsOverTotalPods

func (_e *TargetSelectorMock_Expecter) GetMatchingPodsOverTotalPods(c interface{}, instance interface{}) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call

GetMatchingPodsOverTotalPods is a helper method to define mock.On call

  • c client.Client
  • instance *v1beta1.Disruption

func (*TargetSelectorMock_Expecter) TargetIsHealthy

func (_e *TargetSelectorMock_Expecter) TargetIsHealthy(target interface{}, c interface{}, instance interface{}) *TargetSelectorMock_TargetIsHealthy_Call

TargetIsHealthy is a helper method to define mock.On call

  • target string
  • c client.Client
  • instance *v1beta1.Disruption

type TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call

type TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call struct {
	*mock.Call
}

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

func (*TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Return

func (*TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Run

func (*TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) RunAndReturn

type TargetSelectorMock_GetMatchingPodsOverTotalPods_Call

type TargetSelectorMock_GetMatchingPodsOverTotalPods_Call struct {
	*mock.Call
}

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

func (*TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Return

func (*TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Run

func (*TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) RunAndReturn

type TargetSelectorMock_TargetIsHealthy_Call

type TargetSelectorMock_TargetIsHealthy_Call struct {
	*mock.Call
}

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

func (*TargetSelectorMock_TargetIsHealthy_Call) Return

func (*TargetSelectorMock_TargetIsHealthy_Call) Run

func (*TargetSelectorMock_TargetIsHealthy_Call) RunAndReturn

Jump to

Keyboard shortcuts

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