chaosdaemon

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusOK represents OK status code
	StatusOK = 200
	// StatusOtherError represents Error status code
	StatusOtherError = 1
)

Variables

This section is empty.

Functions

func GenNetnsPath

func GenNetnsPath(pid uint32) string

GetNetnsPath returns network namespace path

func GetChildProcesses

func GetChildProcesses(ppid uint32) ([]uint32, error)

GetChildProcesses will return all child processes's pid. Include all generations.

func StartServer

func StartServer(conf *Config, reg RegisterGatherer) error

StartServer starts chaos-daemon.

func ToNetlinkNetemAttrs

func ToNetlinkNetemAttrs(netem *pb.Netem) netlink.NetemQdiscAttrs

Types

type Config

type Config struct {
	HTTPPort  int
	GRPCPort  int
	Host      string
	Runtime   string
	Profiling bool
}

Config contains the basic chaos daemon configuration.

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 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

func (c DockerClient) FormatContainerID(ctx context.Context, containerID string) (string, error)

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 RegisterGatherer

type RegisterGatherer interface {
	prometheus.Registerer
	prometheus.Gatherer
}

RegisterGatherer combine prometheus.Registerer and prometheus.Gatherer

type Response

type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Response is the body part of HTTP Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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