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" )
var ErrInvalidDNSServer = errors.New("invalid DNS server address")
func MetadataExtractor(keys ...log.Metadatkey) grpc.UnaryServerInterceptor
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 (c *Config) GrpcAddr() string
Get the grpc address
func (c *Config) HttpAddr() string
Get the http address
DaemonServer represents a grpc server for tc daemon
type DaemonServer struct { IPSetLocker *locker.Locker // contains filtered or unexported fields }
func NewDaemonServerWithCRClient(crClient crclients.ContainerRuntimeInfoClient, reg prometheus.Registerer, log logr.Logger) *DaemonServer
NewDaemonServerWithCRClient returns DaemonServer with container runtime client
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)
ContainerKill kills container according to container id in the req
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)
RegisterGatherer combine prometheus.Registerer and prometheus.Gatherer
type RegisterGatherer interface { prometheus.Registerer prometheus.Gatherer }
Response is the body part of HTTP Response
type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
Server is the server for chaos daemon
type Server struct {
// contains filtered or unexported fields
}
func BuildServer(conf *Config, reg RegisterGatherer, log logr.Logger) (*Server, error)
BuildServer builds a chaos daemon server
func (s *Server) Shutdown() error
func (s *Server) Start() error
Start starts chaos-daemon.
type TimeChaosServer struct {
// contains filtered or unexported fields
}
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