Documentation
¶
Index ¶
- Constants
- func GetChildProcesses(ppid uint32) ([]uint32, error)
- func ReadCommName(pid int) (string, error)
- func StartServer(conf *Config, reg RegisterGatherer) error
- func ToNetlinkNetemAttrs(netem *pb.Netem) netlink.NetemQdiscAttrs
- type Config
- type ContainerRuntimeInfoClient
- type ContainerdClient
- func (c ContainerdClient) ContainerKillByContainerID(ctx context.Context, containerID string) error
- func (c ContainerdClient) FormatContainerID(ctx context.Context, containerID string) (string, error)
- func (c ContainerdClient) GetPidFromContainerID(ctx context.Context, containerID string) (uint32, error)
- type ContainerdClientInterface
- type DaemonServer
- func (s *DaemonServer) ApplyIoChaos(ctx context.Context, in *pb.ApplyIoChaosRequest) (*pb.ApplyIoChaosResponse, error)
- func (s *DaemonServer) CancelStressors(ctx context.Context, req *pb.CancelStressRequest) (*empty.Empty, error)
- func (s *DaemonServer) ContainerGetPid(ctx context.Context, req *pb.ContainerRequest) (*pb.ContainerResponse, error)
- func (s *DaemonServer) ContainerKill(ctx context.Context, req *pb.ContainerRequest) (*empty.Empty, error)
- func (s *DaemonServer) ExecStressors(ctx context.Context, req *pb.ExecStressRequest) (*pb.ExecStressResponse, error)
- func (s *DaemonServer) FlushIPSets(ctx context.Context, req *pb.IPSetsRequest) (*empty.Empty, error)
- func (s *DaemonServer) RecoverTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)
- func (s *DaemonServer) SetDNSServer(ctx context.Context, req *pb.SetDNSServerRequest) (*empty.Empty, error)
- func (s *DaemonServer) SetIptablesChains(ctx context.Context, req *pb.IptablesChainsRequest) (*empty.Empty, error)
- func (s *DaemonServer) SetTcs(ctx context.Context, in *pb.TcsRequest) (*empty.Empty, error)
- func (s *DaemonServer) SetTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)
- type DockerClient
- type DockerClientInterface
- type Edge
- type Graph
- type RegisterGatherer
- type Response
Constants ¶
const ( // StatusOK represents OK status code StatusOK = 200 // StatusOtherError represents Error status code StatusOtherError = 1 )
const (
// DNSServerConfFile is the default config file for DNS server
DNSServerConfFile = "/etc/resolv.conf"
)
Variables ¶
This section is empty.
Functions ¶
func GetChildProcesses ¶
GetChildProcesses will return all child processes's pid. Include all generations. only return error when /proc/pid/tasks cannot be read
func ReadCommName ¶
ReadCommName returns the command name of process
func StartServer ¶
func StartServer(conf *Config, reg RegisterGatherer) error
StartServer starts chaos-daemon.
func ToNetlinkNetemAttrs ¶
func ToNetlinkNetemAttrs(netem *pb.Netem) netlink.NetemQdiscAttrs
Types ¶
type ContainerRuntimeInfoClient ¶
type ContainerRuntimeInfoClient interface { GetPidFromContainerID(ctx context.Context, containerID string) (uint32, error) ContainerKillByContainerID(ctx context.Context, containerID string) error FormatContainerID(ctx context.Context, containerID string) (string, error) }
ContainerRuntimeInfoClient represents a struct which can give you information about container runtime
func CreateContainerRuntimeInfoClient ¶
func CreateContainerRuntimeInfoClient(containerRuntime string) (ContainerRuntimeInfoClient, error)
CreateContainerRuntimeInfoClient creates a container runtime information client.
type ContainerdClient ¶
type ContainerdClient struct {
// contains filtered or unexported fields
}
ContainerdClient can get information from containerd
func (ContainerdClient) ContainerKillByContainerID ¶
func (c ContainerdClient) ContainerKillByContainerID(ctx context.Context, containerID string) error
ContainerKillByContainerID kills container according to container id
func (ContainerdClient) FormatContainerID ¶
func (c ContainerdClient) FormatContainerID(ctx context.Context, containerID string) (string, error)
FormatContainerID strips protocol prefix from the container ID
func (ContainerdClient) GetPidFromContainerID ¶
func (c ContainerdClient) GetPidFromContainerID(ctx context.Context, containerID string) (uint32, error)
GetPidFromContainerID fetches PID according to container id
type ContainerdClientInterface ¶
type ContainerdClientInterface interface {
LoadContainer(ctx context.Context, id string) (containerd.Container, error)
}
ContainerdClientInterface represents the ContainerClient, it's used to simply unit test
type DaemonServer ¶ added in v1.1.0
DaemonServer represents a grpc server for tc daemon
func NewDaemonServerWithCRClient ¶ added in v1.1.0
func NewDaemonServerWithCRClient(crClient ContainerRuntimeInfoClient) *DaemonServer
NewDaemonServerWithCRClient returns DaemonServer with container runtime client
func (*DaemonServer) ApplyIoChaos ¶ added in v1.1.0
func (s *DaemonServer) ApplyIoChaos(ctx context.Context, in *pb.ApplyIoChaosRequest) (*pb.ApplyIoChaosResponse, error)
func (*DaemonServer) CancelStressors ¶ added in v1.1.0
func (s *DaemonServer) CancelStressors(ctx context.Context, req *pb.CancelStressRequest) (*empty.Empty, error)
func (*DaemonServer) ContainerGetPid ¶ added in v1.1.0
func (s *DaemonServer) ContainerGetPid(ctx context.Context, req *pb.ContainerRequest) (*pb.ContainerResponse, error)
func (*DaemonServer) ContainerKill ¶ added in v1.1.0
func (s *DaemonServer) ContainerKill(ctx context.Context, req *pb.ContainerRequest) (*empty.Empty, error)
ContainerKill kills container according to container id in the req
func (*DaemonServer) ExecStressors ¶ added in v1.1.0
func (s *DaemonServer) ExecStressors(ctx context.Context, req *pb.ExecStressRequest) (*pb.ExecStressResponse, error)
func (*DaemonServer) FlushIPSets ¶ added in v1.1.0
func (s *DaemonServer) FlushIPSets(ctx context.Context, req *pb.IPSetsRequest) (*empty.Empty, error)
func (*DaemonServer) RecoverTimeOffset ¶ added in v1.1.0
func (s *DaemonServer) RecoverTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)
func (*DaemonServer) SetDNSServer ¶ added in v1.1.0
func (s *DaemonServer) SetDNSServer(ctx context.Context, req *pb.SetDNSServerRequest) (*empty.Empty, error)
func (*DaemonServer) SetIptablesChains ¶ added in v1.1.0
func (s *DaemonServer) SetIptablesChains(ctx context.Context, req *pb.IptablesChainsRequest) (*empty.Empty, error)
func (*DaemonServer) SetTcs ¶ added in v1.1.0
func (s *DaemonServer) SetTcs(ctx context.Context, in *pb.TcsRequest) (*empty.Empty, error)
func (*DaemonServer) SetTimeOffset ¶ added in v1.1.0
func (s *DaemonServer) SetTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient can get information from docker
func (DockerClient) ContainerKillByContainerID ¶
func (c DockerClient) ContainerKillByContainerID(ctx context.Context, containerID string) error
ContainerKillByContainerID kills container according to container id
func (DockerClient) FormatContainerID ¶
FormatContainerID strips protocol prefix from the container ID
func (DockerClient) GetPidFromContainerID ¶
func (c DockerClient) GetPidFromContainerID(ctx context.Context, containerID string) (uint32, error)
GetPidFromContainerID fetches PID according to container id
type DockerClientInterface ¶
type DockerClientInterface interface { ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) ContainerKill(ctx context.Context, containerID, signal string) error }
DockerClientInterface represents the DockerClient, it's used to simply unit test
type Graph ¶ added in v1.1.0
type Graph struct {
// contains filtered or unexported fields
}
Graph represents a graph with link list
func (*Graph) Flatten ¶ added in v1.1.0
Flatten flattens the subtree from source (without checking whether it's a tree)
type RegisterGatherer ¶
type RegisterGatherer interface { prometheus.Registerer prometheus.Gatherer }
RegisterGatherer combine prometheus.Registerer and prometheus.Gatherer