selector

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 19 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPodMeetSelector

func CheckPodMeetSelector(pod v1.Pod, selector v1alpha1.SelectorSpec) (bool, error)

CheckPodMeetSelector checks if this pod meets the selection criteria. TODO: support to check fieldsSelector

func GetService

func GetService(ctx context.Context, c client.Client, namespace, controllerNamespace string, serviceName string) (*v1.Service, error)

GetService get k8s service by service name

func IsAllowedNamespaces added in v1.2.0

func IsAllowedNamespaces(ctx context.Context, c client.Client, namespace string) (bool, error)

func RandomFixedIndexes

func RandomFixedIndexes(start, end, count uint) []uint

RandomFixedIndexes returns the `count` random indexes between `start` and `end`. [start, end)

func SelectAndFilterPods

func SelectAndFilterPods(ctx context.Context, c client.Client, r client.Reader, spec SelectSpec, clusterScoped bool, targetNamespace string, enableFilterNamespace bool) ([]v1.Pod, error)

SelectAndFilterPods returns the list of pods that filtered by selector and PodMode

func SelectPods

func SelectPods(ctx context.Context, c client.Client, r client.Reader, selector v1alpha1.SelectorSpec, clusterScoped bool, targetNamespace string, enableFilterNamespace bool) ([]v1.Pod, error)

SelectPods returns the list of pods that are available for pod chaos action. It returns all pods that match the configured label, annotation and namespace selectors. If pods are specifically specified by `selector.Pods`, it just returns the selector.Pods.

Types

type SelectSpec

type SelectSpec interface {
	GetSelector() v1alpha1.SelectorSpec
	GetMode() v1alpha1.PodMode
	GetValue() string
}

Jump to

Keyboard shortcuts

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