...

Package server

import "github.com/chaos-mesh/chaos-mesh/pkg/ctrl/server"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Constants
func GetPods(ctx context.Context, status v1alpha1.ChaosStatus, selectorSpec v1alpha1.PodSelectorSpec, c client.Client) ([]v1.Pod, []v1.Pod, error)
type DaemonHelper
    func (h *DaemonHelper) GetPidFromPod(ctx context.Context, pod *v1.Pod) (uint32, error)
type Resolver
    func (r *Resolver) AttrOverrideSpec() generated.AttrOverrideSpecResolver
    func (r *Resolver) BandwidthSpec() generated.BandwidthSpecResolver
    func (r *Resolver) ChaosCondition() generated.ChaosConditionResolver
    func (r *Resolver) CidrAndPort() generated.CidrAndPortResolver
    func (r *Resolver) ContainerStateRunning() generated.ContainerStateRunningResolver
    func (r *Resolver) ContainerStateTerminated() generated.ContainerStateTerminatedResolver
    func (r *Resolver) ExecBypass(ctx context.Context, pod *v1.Pod, cmd string, nsTypes ...bpm.NsType) (string, error)
    func (r *Resolver) ExperimentStatus() generated.ExperimentStatusResolver
    func (r *Resolver) GetCPUPeriod(ctx context.Context, obj *v1.Pod, cpuMountType string) (int, error)
    func (r *Resolver) GetCPUQuota(ctx context.Context, obj *v1.Pod, cpuMountType string) (int, error)
    func (r *Resolver) GetCgroup(ctx context.Context, obj *v1.Pod, pid string) (string, error)
    func (r *Resolver) GetCgroups(ctx context.Context, obj *model.PodStressChaos) (*model.Cgroups, error)
    func (r *Resolver) GetFdsOfProcess(ctx context.Context, process *model.Process) []*model.Fd
    func (r *Resolver) GetIpset(ctx context.Context, obj *v1.Pod) (string, error)
    func (r *Resolver) GetIptables(ctx context.Context, obj *v1.Pod) ([]string, error)
    func (r *Resolver) GetMemoryLimit(ctx context.Context, obj *v1.Pod) (int64, error)
    func (r *Resolver) GetMounts(ctx context.Context, pod *v1.Pod) ([]string, error)
    func (r *Resolver) GetPidFromPS(ctx context.Context, pod *v1.Pod) ([]*model.Process, error)
    func (r *Resolver) GetTcQdisc(ctx context.Context, obj *v1.Pod) ([]string, error)
    func (r *Resolver) HTTPChaos() generated.HTTPChaosResolver
    func (r *Resolver) HTTPChaosSpec() generated.HTTPChaosSpecResolver
    func (r *Resolver) HTTPChaosStatus() generated.HTTPChaosStatusResolver
    func (r *Resolver) IOChaos() generated.IOChaosResolver
    func (r *Resolver) IOChaosAction() generated.IOChaosActionResolver
    func (r *Resolver) IOChaosSpec() generated.IOChaosSpecResolver
    func (r *Resolver) IOChaosStatus() generated.IOChaosStatusResolver
    func (r *Resolver) IoFault() generated.IoFaultResolver
    func (r *Resolver) Logger() generated.LoggerResolver
    func (r *Resolver) MistakeSpec() generated.MistakeSpecResolver
    func (r *Resolver) MutablePod() generated.MutablePodResolver
    func (r *Resolver) Mutation() generated.MutationResolver
    func (r *Resolver) Namespace() generated.NamespaceResolver
    func (r *Resolver) NetworkChaos() generated.NetworkChaosResolver
    func (r *Resolver) OwnerReference() generated.OwnerReferenceResolver
    func (r *Resolver) Pod() generated.PodResolver
    func (r *Resolver) PodCondition() generated.PodConditionResolver
    func (r *Resolver) PodHTTPChaos() generated.PodHTTPChaosResolver
    func (r *Resolver) PodHttpChaosReplaceActions() generated.PodHttpChaosReplaceActionsResolver
    func (r *Resolver) PodHttpChaosRule() generated.PodHttpChaosRuleResolver
    func (r *Resolver) PodHttpChaosSelector() generated.PodHttpChaosSelectorResolver
    func (r *Resolver) PodIOChaos() generated.PodIOChaosResolver
    func (r *Resolver) PodNetworkChaos() generated.PodNetworkChaosResolver
    func (r *Resolver) PodSelectorSpec() generated.PodSelectorSpecResolver
    func (r *Resolver) PodStatus() generated.PodStatusResolver
    func (r *Resolver) PodStressChaos() generated.PodStressChaosResolver
    func (r *Resolver) Process() generated.ProcessResolver
    func (r *Resolver) Query() generated.QueryResolver
    func (r *Resolver) RawIPSet() generated.RawIPSetResolver
    func (r *Resolver) RawIptables() generated.RawIptablesResolver
    func (r *Resolver) RawTrafficControl() generated.RawTrafficControlResolver
    func (r *Resolver) Record() generated.RecordResolver
    func (r *Resolver) StressChaos() generated.StressChaosResolver
    func (r *Resolver) StressChaosSpec() generated.StressChaosSpecResolver
    func (r *Resolver) StressChaosStatus() generated.StressChaosStatusResolver

Package files

cgroup.go daemon.go exec.go fd.go k8s-utils.go mount.go net.go process.go resolver.go schema.resolvers.go

Constants

const DefaultNamespace = "default"

func GetPods

func GetPods(ctx context.Context, status v1alpha1.ChaosStatus, selectorSpec v1alpha1.PodSelectorSpec, c client.Client) ([]v1.Pod, []v1.Pod, error)

GetPods returns pod list and corresponding chaos daemon

type DaemonHelper

type DaemonHelper struct {
    Builder *chaosdaemon.ChaosDaemonClientBuilder
}

func (*DaemonHelper) GetPidFromPod

func (h *DaemonHelper) GetPidFromPod(ctx context.Context, pod *v1.Pod) (uint32, error)

GetPidFromPod returns pid given containerd ID in pod

type Resolver

type Resolver struct {
    *DaemonHelper
    Log           logr.Logger
    Client        client.Client
    Clientset     *kubernetes.Clientset
    NoCacheReader client.Reader
}

func (*Resolver) AttrOverrideSpec

func (r *Resolver) AttrOverrideSpec() generated.AttrOverrideSpecResolver

AttrOverrideSpec returns generated.AttrOverrideSpecResolver implementation.

func (*Resolver) BandwidthSpec

func (r *Resolver) BandwidthSpec() generated.BandwidthSpecResolver

BandwidthSpec returns generated.BandwidthSpecResolver implementation.

func (*Resolver) ChaosCondition

func (r *Resolver) ChaosCondition() generated.ChaosConditionResolver

ChaosCondition returns generated.ChaosConditionResolver implementation.

func (*Resolver) CidrAndPort

func (r *Resolver) CidrAndPort() generated.CidrAndPortResolver

CidrAndPort returns generated.CidrAndPortResolver implementation.

func (*Resolver) ContainerStateRunning

func (r *Resolver) ContainerStateRunning() generated.ContainerStateRunningResolver

ContainerStateRunning returns generated.ContainerStateRunningResolver implementation.

func (*Resolver) ContainerStateTerminated

func (r *Resolver) ContainerStateTerminated() generated.ContainerStateTerminatedResolver

ContainerStateTerminated returns generated.ContainerStateTerminatedResolver implementation.

func (*Resolver) ExecBypass

func (r *Resolver) ExecBypass(ctx context.Context, pod *v1.Pod, cmd string, nsTypes ...bpm.NsType) (string, error)

ExecBypass use chaos-daemon to enter namespace and execute command in target pod

func (*Resolver) ExperimentStatus

func (r *Resolver) ExperimentStatus() generated.ExperimentStatusResolver

ExperimentStatus returns generated.ExperimentStatusResolver implementation.

func (*Resolver) GetCPUPeriod

func (r *Resolver) GetCPUPeriod(ctx context.Context, obj *v1.Pod, cpuMountType string) (int, error)

GetCPUPeriod returns result of cat /sys/fs/cgroup/:cpuMountType/cpu.cfs_period_us

func (*Resolver) GetCPUQuota

func (r *Resolver) GetCPUQuota(ctx context.Context, obj *v1.Pod, cpuMountType string) (int, error)

GetCPUQuota returns result of cat /sys/fs/cgroup/:cpuMountType/cpu.cfs_quota_us

func (*Resolver) GetCgroup

func (r *Resolver) GetCgroup(ctx context.Context, obj *v1.Pod, pid string) (string, error)

GetCgroup returns result of cat /proc/:pid/cgroup The output looks like: “` 11:freezer:/ 10:hugetlb:/ 9:memory:/system.slice/sshd.service 8:pids:/system.slice/sshd.service 7:perf_event:/ 6:net_cls,net_prio:/ 5:devices:/system.slice/sshd.service 4:blkio:/system.slice/sshd.service 3:cpu,cpuacct:/system.slice/sshd.service 2:cpuset:/ 1:name=systemd:/system.slice/sshd.service “`

func (*Resolver) GetCgroups

func (r *Resolver) GetCgroups(ctx context.Context, obj *model.PodStressChaos) (*model.Cgroups, error)

GetCgroups returns result of cat /proc/cgroups

func (*Resolver) GetFdsOfProcess

func (r *Resolver) GetFdsOfProcess(ctx context.Context, process *model.Process) []*model.Fd

GetFdsOfProcess returns fd-target pairs. The output looks like: “` total 0 lrwx------ 1 docker docker 64 Mar 3 16:11 0 -> /dev/pts/0 lrwx------ 1 docker docker 64 Mar 3 16:11 1 -> /dev/pts/0 lrwx------ 1 docker docker 64 Mar 3 16:11 2 -> /dev/pts/0 lr-x------ 1 docker docker 64 Mar 3 16:11 3 -> /proc/642108/fd “`

func (*Resolver) GetIpset

func (r *Resolver) GetIpset(ctx context.Context, obj *v1.Pod) (string, error)

GetIpset returns result of ipset list

func (*Resolver) GetIptables

func (r *Resolver) GetIptables(ctx context.Context, obj *v1.Pod) ([]string, error)

GetIptables returns result of iptables --list

func (*Resolver) GetMemoryLimit

func (r *Resolver) GetMemoryLimit(ctx context.Context, obj *v1.Pod) (int64, error)

GetMemoryLimit returns result of cat /sys/fs/cgroup/memory/memory.limit_in_bytes

func (*Resolver) GetMounts

func (r *Resolver) GetMounts(ctx context.Context, pod *v1.Pod) ([]string, error)

GetMounts returns mounts info The output looks like: “` proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 dev /dev devtmpfs rw,nosuid,relatime,size=16283300k,nr_inodes=4070825,mode=755,inode64 0 0 run /run tmpfs rw,nosuid,nodev,relatime,mode=755,inode64 0 0 tmpfs /dev/shm tmpfs rw,nosuid,nodev,inode64 0 0 cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=3258252k,nr_inodes=814563,mode=700,uid=1000,gid=1000,inode64 0 0 “`

func (*Resolver) GetPidFromPS

func (r *Resolver) GetPidFromPS(ctx context.Context, pod *v1.Pod) ([]*model.Process, error)

GetPidFromPS returns pid-command pairs

func (*Resolver) GetTcQdisc

func (r *Resolver) GetTcQdisc(ctx context.Context, obj *v1.Pod) ([]string, error)

GetIpset returns result of tc qdisc list

func (*Resolver) HTTPChaos

func (r *Resolver) HTTPChaos() generated.HTTPChaosResolver

HTTPChaos returns generated.HTTPChaosResolver implementation.

func (*Resolver) HTTPChaosSpec

func (r *Resolver) HTTPChaosSpec() generated.HTTPChaosSpecResolver

HTTPChaosSpec returns generated.HTTPChaosSpecResolver implementation.

func (*Resolver) HTTPChaosStatus

func (r *Resolver) HTTPChaosStatus() generated.HTTPChaosStatusResolver

HTTPChaosStatus returns generated.HTTPChaosStatusResolver implementation.

func (*Resolver) IOChaos

func (r *Resolver) IOChaos() generated.IOChaosResolver

IOChaos returns generated.IOChaosResolver implementation.

func (*Resolver) IOChaosAction

func (r *Resolver) IOChaosAction() generated.IOChaosActionResolver

IOChaosAction returns generated.IOChaosActionResolver implementation.

func (*Resolver) IOChaosSpec

func (r *Resolver) IOChaosSpec() generated.IOChaosSpecResolver

IOChaosSpec returns generated.IOChaosSpecResolver implementation.

func (*Resolver) IOChaosStatus

func (r *Resolver) IOChaosStatus() generated.IOChaosStatusResolver

IOChaosStatus returns generated.IOChaosStatusResolver implementation.

func (*Resolver) IoFault

func (r *Resolver) IoFault() generated.IoFaultResolver

IoFault returns generated.IoFaultResolver implementation.

func (*Resolver) Logger

func (r *Resolver) Logger() generated.LoggerResolver

Logger returns generated.LoggerResolver implementation.

func (*Resolver) MistakeSpec

func (r *Resolver) MistakeSpec() generated.MistakeSpecResolver

MistakeSpec returns generated.MistakeSpecResolver implementation.

func (*Resolver) MutablePod

func (r *Resolver) MutablePod() generated.MutablePodResolver

MutablePod returns generated.MutablePodResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() generated.MutationResolver

Mutation returns generated.MutationResolver implementation.

func (*Resolver) Namespace

func (r *Resolver) Namespace() generated.NamespaceResolver

Namespace returns generated.NamespaceResolver implementation.

func (*Resolver) NetworkChaos

func (r *Resolver) NetworkChaos() generated.NetworkChaosResolver

NetworkChaos returns generated.NetworkChaosResolver implementation.

func (*Resolver) OwnerReference

func (r *Resolver) OwnerReference() generated.OwnerReferenceResolver

OwnerReference returns generated.OwnerReferenceResolver implementation.

func (*Resolver) Pod

func (r *Resolver) Pod() generated.PodResolver

Pod returns generated.PodResolver implementation.

func (*Resolver) PodCondition

func (r *Resolver) PodCondition() generated.PodConditionResolver

PodCondition returns generated.PodConditionResolver implementation.

func (*Resolver) PodHTTPChaos

func (r *Resolver) PodHTTPChaos() generated.PodHTTPChaosResolver

PodHTTPChaos returns generated.PodHTTPChaosResolver implementation.

func (*Resolver) PodHttpChaosReplaceActions

func (r *Resolver) PodHttpChaosReplaceActions() generated.PodHttpChaosReplaceActionsResolver

PodHttpChaosReplaceActions returns generated.PodHttpChaosReplaceActionsResolver implementation.

func (*Resolver) PodHttpChaosRule

func (r *Resolver) PodHttpChaosRule() generated.PodHttpChaosRuleResolver

PodHttpChaosRule returns generated.PodHttpChaosRuleResolver implementation.

func (*Resolver) PodHttpChaosSelector

func (r *Resolver) PodHttpChaosSelector() generated.PodHttpChaosSelectorResolver

PodHttpChaosSelector returns generated.PodHttpChaosSelectorResolver implementation.

func (*Resolver) PodIOChaos

func (r *Resolver) PodIOChaos() generated.PodIOChaosResolver

PodIOChaos returns generated.PodIOChaosResolver implementation.

func (*Resolver) PodNetworkChaos

func (r *Resolver) PodNetworkChaos() generated.PodNetworkChaosResolver

PodNetworkChaos returns generated.PodNetworkChaosResolver implementation.

func (*Resolver) PodSelectorSpec

func (r *Resolver) PodSelectorSpec() generated.PodSelectorSpecResolver

PodSelectorSpec returns generated.PodSelectorSpecResolver implementation.

func (*Resolver) PodStatus

func (r *Resolver) PodStatus() generated.PodStatusResolver

PodStatus returns generated.PodStatusResolver implementation.

func (*Resolver) PodStressChaos

func (r *Resolver) PodStressChaos() generated.PodStressChaosResolver

PodStressChaos returns generated.PodStressChaosResolver implementation.

func (*Resolver) Process

func (r *Resolver) Process() generated.ProcessResolver

Process returns generated.ProcessResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() generated.QueryResolver

Query returns generated.QueryResolver implementation.

func (*Resolver) RawIPSet

func (r *Resolver) RawIPSet() generated.RawIPSetResolver

RawIPSet returns generated.RawIPSetResolver implementation.

func (*Resolver) RawIptables

func (r *Resolver) RawIptables() generated.RawIptablesResolver

RawIptables returns generated.RawIptablesResolver implementation.

func (*Resolver) RawTrafficControl

func (r *Resolver) RawTrafficControl() generated.RawTrafficControlResolver

RawTrafficControl returns generated.RawTrafficControlResolver implementation.

func (*Resolver) Record

func (r *Resolver) Record() generated.RecordResolver

Record returns generated.RecordResolver implementation.

func (*Resolver) StressChaos

func (r *Resolver) StressChaos() generated.StressChaosResolver

StressChaos returns generated.StressChaosResolver implementation.

func (*Resolver) StressChaosSpec

func (r *Resolver) StressChaosSpec() generated.StressChaosSpecResolver

StressChaosSpec returns generated.StressChaosSpecResolver implementation.

func (*Resolver) StressChaosStatus

func (r *Resolver) StressChaosStatus() generated.StressChaosStatusResolver

StressChaosStatus returns generated.StressChaosStatusResolver implementation.

Subdirectories

Name Synopsis
..
generated
model