...

Package pod

import "github.com/chaos-mesh/chaos-mesh/pkg/selector/pod"
Overview
Index

Overview ▾

Variables

var ErrNoPodSelected = errors.New("no pod is selected")

func CheckPodMeetSelector

func CheckPodMeetSelector(ctx context.Context, c client.Client, pod v1.Pod, selector v1alpha1.PodSelectorSpec, clusterScoped bool, targetNamespace string, enableFilterNamespace bool) (bool, error)

CheckPodMeetSelector checks if this pod meets the selection criteria.

func SelectAndFilterPods

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

SelectAndFilterPods returns the list of pods that filtered by selector and SelectorMode Deprecated: use pod.SelectImpl as instead

func SelectPods

func SelectPods(ctx context.Context, c client.Client, r client.Reader, selector v1alpha1.PodSelectorSpec, 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.

type Params

type Params struct {
    fx.In

    Client client.Client
    Reader client.Reader `name:"no-cache"`
}

type Pod

type Pod struct {
    v1.Pod
}

func (*Pod) Id

func (pod *Pod) Id() string

type SelectImpl

type SelectImpl struct {
    generic.Option
    // contains filtered or unexported fields
}

func New

func New(params Params) *SelectImpl

func (*SelectImpl) Select

func (impl *SelectImpl) Select(ctx context.Context, ps *v1alpha1.PodSelector) ([]*Pod, error)