...

Package chaosdaemon

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

Overview ▾

Index ▾

Constants
Variables
func MetadataExtractor(keys ...log.Metadatkey) grpc.UnaryServerInterceptor
func ToNetlinkNetemAttrs(netem *pb.Netem) netlink.NetemQdiscAttrs
type Config
    func (c *Config) GrpcAddr() string
    func (c *Config) HttpAddr() string
type DaemonServer
    func NewDaemonServerWithCRClient(crClient crclients.ContainerRuntimeInfoClient, reg prometheus.Registerer, log logr.Logger) *DaemonServer
    func (s *DaemonServer) ApplyBlockChaos(ctx context.Context, req *pb.ApplyBlockChaosRequest) (*pb.ApplyBlockChaosResponse, error)
    func (s *DaemonServer) ApplyHttpChaos(ctx context.Context, in *pb.ApplyHttpChaosRequest) (*pb.ApplyHttpChaosResponse, error)
    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) ExecCPUStressors(ctx context.Context, req *pb.ExecStressRequest) (*bpm.Process, error)
    func (s *DaemonServer) ExecMemoryStressors(ctx context.Context, req *pb.ExecStressRequest) (*bpm.Process, 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) InstallJVMRules(ctx context.Context, req *pb.InstallJVMRulesRequest) (*empty.Empty, error)
    func (s *DaemonServer) RecoverBlockChaos(ctx context.Context, req *pb.RecoverBlockChaosRequest) (*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)
    func (s *DaemonServer) UninstallJVMRules(ctx context.Context, req *pb.UninstallJVMRulesRequest) (*empty.Empty, error)
type RegisterGatherer
type Response
type Server
    func BuildServer(conf *Config, reg RegisterGatherer, log logr.Logger) (*Server, error)
    func (s *Server) Shutdown() error
    func (s *Server) Start() error
type TimeChaosServer
    func (s *TimeChaosServer) DelPodContainerNameProcess(idName tasks.PodContainerName)
    func (s *TimeChaosServer) SetPodContainerNameProcess(idName tasks.PodContainerName, sysID tasks.SysPID)
    func (s *TimeChaosServer) SetTimeOffset(uid tasks.TaskID, id tasks.PodContainerName, config time.Config) error

Package files

blockchaos_server_linux.go container.go dns_server.go http.go httpchaos_server.go iochaos_server.go ipset_server.go iptables_server.go jvm_server.go response.go server.go stress_server_linux.go tc_server.go time_server_linux.go types.go

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

var ErrInvalidDNSServer = errors.New("invalid DNS server address")

func MetadataExtractor

func MetadataExtractor(keys ...log.Metadatkey) grpc.UnaryServerInterceptor

func ToNetlinkNetemAttrs

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

type Config

Config contains the basic chaos daemon configuration.

type Config struct {
    HTTPPort       int
    GRPCPort       int
    Host           string
    CrClientConfig *crclients.CrClientConfig
    Profiling      bool
    // contains filtered or unexported fields
}

func (*Config) GrpcAddr

func (c *Config) GrpcAddr() string

Get the grpc address

func (*Config) HttpAddr

func (c *Config) HttpAddr() string

Get the http address

type DaemonServer

DaemonServer represents a grpc server for tc daemon

type DaemonServer struct {
    IPSetLocker *locker.Locker
    // contains filtered or unexported fields
}

func NewDaemonServerWithCRClient

func NewDaemonServerWithCRClient(crClient crclients.ContainerRuntimeInfoClient, reg prometheus.Registerer, log logr.Logger) *DaemonServer

NewDaemonServerWithCRClient returns DaemonServer with container runtime client

func (*DaemonServer) ApplyBlockChaos

func (s *DaemonServer) ApplyBlockChaos(ctx context.Context, req *pb.ApplyBlockChaosRequest) (*pb.ApplyBlockChaosResponse, error)

func (*DaemonServer) ApplyHttpChaos

func (s *DaemonServer) ApplyHttpChaos(ctx context.Context, in *pb.ApplyHttpChaosRequest) (*pb.ApplyHttpChaosResponse, error)

func (*DaemonServer) ApplyIOChaos

func (s *DaemonServer) ApplyIOChaos(ctx context.Context, in *pb.ApplyIOChaosRequest) (*pb.ApplyIOChaosResponse, error)

func (*DaemonServer) CancelStressors

func (s *DaemonServer) CancelStressors(ctx context.Context,
    req *pb.CancelStressRequest) (*empty.Empty, error)

func (*DaemonServer) ContainerGetPid

func (s *DaemonServer) ContainerGetPid(ctx context.Context, req *pb.ContainerRequest) (*pb.ContainerResponse, error)

func (*DaemonServer) ContainerKill

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

func (s *DaemonServer) ExecCPUStressors(ctx context.Context,
    req *pb.ExecStressRequest) (*bpm.Process, error)

func (*DaemonServer) ExecMemoryStressors

func (s *DaemonServer) ExecMemoryStressors(ctx context.Context,
    req *pb.ExecStressRequest) (*bpm.Process, error)

func (*DaemonServer) ExecStressors

func (s *DaemonServer) ExecStressors(ctx context.Context,
    req *pb.ExecStressRequest) (*pb.ExecStressResponse, error)

func (*DaemonServer) FlushIPSets

func (s *DaemonServer) FlushIPSets(ctx context.Context, req *pb.IPSetsRequest) (*empty.Empty, error)

func (*DaemonServer) InstallJVMRules

func (s *DaemonServer) InstallJVMRules(ctx context.Context,
    req *pb.InstallJVMRulesRequest) (*empty.Empty, error)

func (*DaemonServer) RecoverBlockChaos

func (s *DaemonServer) RecoverBlockChaos(ctx context.Context, req *pb.RecoverBlockChaosRequest) (*empty.Empty, error)

func (*DaemonServer) RecoverTimeOffset

func (s *DaemonServer) RecoverTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)

func (*DaemonServer) SetDNSServer

func (s *DaemonServer) SetDNSServer(ctx context.Context,
    req *pb.SetDNSServerRequest) (*empty.Empty, error)

func (*DaemonServer) SetIptablesChains

func (s *DaemonServer) SetIptablesChains(ctx context.Context, req *pb.IptablesChainsRequest) (*empty.Empty, error)

func (*DaemonServer) SetTcs

func (s *DaemonServer) SetTcs(ctx context.Context, in *pb.TcsRequest) (*empty.Empty, error)

func (*DaemonServer) SetTimeOffset

func (s *DaemonServer) SetTimeOffset(ctx context.Context, req *pb.TimeRequest) (*empty.Empty, error)

func (*DaemonServer) UninstallJVMRules

func (s *DaemonServer) UninstallJVMRules(ctx context.Context,
    req *pb.UninstallJVMRulesRequest) (*empty.Empty, error)

type RegisterGatherer

RegisterGatherer combine prometheus.Registerer and prometheus.Gatherer

type RegisterGatherer interface {
    prometheus.Registerer
    prometheus.Gatherer
}

type Response

Response is the body part of HTTP Response

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

type Server

Server is the server for chaos daemon

type Server struct {
    // contains filtered or unexported fields
}

func BuildServer

func BuildServer(conf *Config, reg RegisterGatherer, log logr.Logger) (*Server, error)

BuildServer builds a chaos daemon server

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start() error

Start starts chaos-daemon.

type TimeChaosServer

type TimeChaosServer struct {
    // contains filtered or unexported fields
}

func (*TimeChaosServer) DelPodContainerNameProcess

func (s *TimeChaosServer) DelPodContainerNameProcess(idName tasks.PodContainerName)

func (*TimeChaosServer) SetPodContainerNameProcess

func (s *TimeChaosServer) SetPodContainerNameProcess(idName tasks.PodContainerName, sysID tasks.SysPID)

func (*TimeChaosServer) SetTimeOffset

func (s *TimeChaosServer) SetTimeOffset(uid tasks.TaskID, id tasks.PodContainerName, config time.Config) error

Subdirectories