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 ¶
- func GetLabelSelectorFromInstance(instance *chaosv1beta1.Disruption) (labels.Selector, error)
- func ValidateLabelSelector(selector labels.Selector) error
- type TargetSelector
- type TargetSelectorMock
- func (_m *TargetSelectorMock) EXPECT() *TargetSelectorMock_Expecter
- func (_m *TargetSelectorMock) GetMatchingNodesOverTotalNodes(c client.Client, instance *v1beta1.Disruption) (*v1.NodeList, int, error)
- func (_m *TargetSelectorMock) GetMatchingPodsOverTotalPods(c client.Client, instance *v1beta1.Disruption) (*v1.PodList, int, error)
- func (_m *TargetSelectorMock) TargetIsHealthy(target string, c client.Client, instance *v1beta1.Disruption) error
- type TargetSelectorMock_Expecter
- func (_e *TargetSelectorMock_Expecter) GetMatchingNodesOverTotalNodes(c interface{}, instance interface{}) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
- func (_e *TargetSelectorMock_Expecter) GetMatchingPodsOverTotalPods(c interface{}, instance interface{}) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
- func (_e *TargetSelectorMock_Expecter) TargetIsHealthy(target interface{}, c interface{}, instance interface{}) *TargetSelectorMock_TargetIsHealthy_Call
- type TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
- func (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Return(_a0 *v1.NodeList, _a1 int, _a2 error) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
- func (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Run(run func(c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
- func (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) RunAndReturn(run func(client.Client, *v1beta1.Disruption) (*v1.NodeList, int, error)) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
- type TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
- func (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Return(_a0 *v1.PodList, _a1 int, _a2 error) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
- func (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Run(run func(c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
- func (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) RunAndReturn(run func(client.Client, *v1beta1.Disruption) (*v1.PodList, int, error)) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
- type TargetSelectorMock_TargetIsHealthy_Call
- func (_c *TargetSelectorMock_TargetIsHealthy_Call) Return(_a0 error) *TargetSelectorMock_TargetIsHealthy_Call
- func (_c *TargetSelectorMock_TargetIsHealthy_Call) Run(run func(target string, c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_TargetIsHealthy_Call
- func (_c *TargetSelectorMock_TargetIsHealthy_Call) RunAndReturn(run func(string, client.Client, *v1beta1.Disruption) error) *TargetSelectorMock_TargetIsHealthy_Call
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 ¶
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 ¶
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 (_m *TargetSelectorMock) EXPECT() *TargetSelectorMock_Expecter
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 ¶
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 (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Return(_a0 *v1.NodeList, _a1 int, _a2 error) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
func (*TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Run ¶
func (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) Run(run func(c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
func (*TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) RunAndReturn ¶
func (_c *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call) RunAndReturn(run func(client.Client, *v1beta1.Disruption) (*v1.NodeList, int, error)) *TargetSelectorMock_GetMatchingNodesOverTotalNodes_Call
type TargetSelectorMock_GetMatchingPodsOverTotalPods_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 (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Return(_a0 *v1.PodList, _a1 int, _a2 error) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
func (*TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Run ¶
func (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) Run(run func(c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
func (*TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) RunAndReturn ¶
func (_c *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call) RunAndReturn(run func(client.Client, *v1beta1.Disruption) (*v1.PodList, int, error)) *TargetSelectorMock_GetMatchingPodsOverTotalPods_Call
type TargetSelectorMock_TargetIsHealthy_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 (_c *TargetSelectorMock_TargetIsHealthy_Call) Return(_a0 error) *TargetSelectorMock_TargetIsHealthy_Call
func (*TargetSelectorMock_TargetIsHealthy_Call) Run ¶
func (_c *TargetSelectorMock_TargetIsHealthy_Call) Run(run func(target string, c client.Client, instance *v1beta1.Disruption)) *TargetSelectorMock_TargetIsHealthy_Call
func (*TargetSelectorMock_TargetIsHealthy_Call) RunAndReturn ¶
func (_c *TargetSelectorMock_TargetIsHealthy_Call) RunAndReturn(run func(string, client.Client, *v1beta1.Disruption) error) *TargetSelectorMock_TargetIsHealthy_Call