Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFailedMessage(ctx context.Context, failedMessage string, daemons []v1.Pod, c *ClientSet) error
- func ConnectToLocalChaosDaemon(port int) (daemonClient.ChaosDaemonClientInterface, error)
- func Exec(ctx context.Context, pod v1.Pod, cmd string, c *kubernetes.Clientset) (string, error)
- func ExecBypass(ctx context.Context, pod v1.Pod, daemon v1.Pod, cmd string, ...) (string, error)
- func GetChaosList(ctx context.Context, chaosType string, chaosName string, ns string, ...) ([]runtime.Object, []string, error)
- func GetPidFromPS(ctx context.Context, pod v1.Pod, daemon v1.Pod, c *kubernetes.Clientset) ([]string, []string, error)
- func GetPidFromPod(ctx context.Context, pod v1.Pod, daemon v1.Pod) (uint32, error)
- func GetPods(ctx context.Context, chaosName string, status v1alpha1.ChaosStatus, ...) ([]v1.Pod, []v1.Pod, error)
- func L() logr.Logger
- func Log(pod v1.Pod, tail int64, c *kubernetes.Clientset) (string, error)
- func MarshalChaos(s interface{}) (string, error)
- func PrettyPrint(s string, indentLevel int, color Color)
- func PrintResult(result []ChaosResult)
- func SetupGlobalLogger(logger logr.Logger)
- func SetupKlog() error
- type ChaosResult
- type ClientSet
- type Color
- type CommonRestClientGetter
- type ItemResult
- type LoggerFlushFunc
- type PodResult
- type TLSFileConfig
Constants ¶
const ( ItemSuccess = iota + 1 ItemFailure )
const ChaosDaemonClientCert = "chaos-mesh-daemon-client-certs"
const ChaosDaemonNamespace = "chaos-testing"
Variables ¶
var Insecure bool
Functions ¶
func CheckFailedMessage ¶
func CheckFailedMessage(ctx context.Context, failedMessage string, daemons []v1.Pod, c *ClientSet) error
CheckFailedMessage provide debug info and suggestions from failed message
func ConnectToLocalChaosDaemon ¶ added in v1.2.0
func ConnectToLocalChaosDaemon(port int) (daemonClient.ChaosDaemonClientInterface, error)
ConnectToLocalChaosDaemon would connect to ChaosDaemon run in localhost
func Exec ¶
Exec executes certain command and returns the result Only commands in chaos-mesh components should use this way for target pod, use ExecBypass
func ExecBypass ¶
func ExecBypass(ctx context.Context, pod v1.Pod, daemon v1.Pod, cmd string, c *kubernetes.Clientset) (string, error)
ExecBypass use chaos-daemon to enter namespace and execute command in target pod
func GetChaosList ¶
func GetChaosList(ctx context.Context, chaosType string, chaosName string, ns string, c client.Client) ([]runtime.Object, []string, error)
GetChaosList returns chaos list limited by input
func GetPidFromPS ¶
func GetPidFromPS(ctx context.Context, pod v1.Pod, daemon v1.Pod, c *kubernetes.Clientset) ([]string, []string, error)
GetPidFromPS returns pid-command pairs
func GetPidFromPod ¶
GetPidFromPod returns pid given containerd ID in pod
func GetPods ¶
func GetPods(ctx context.Context, chaosName string, status v1alpha1.ChaosStatus, selectorSpec v1alpha1.SelectorSpec, c client.Client) ([]v1.Pod, []v1.Pod, error)
GetPods returns pod list and corresponding chaos daemon
func MarshalChaos ¶
MarshalChaos returns json in readable format
func PrettyPrint ¶
PrettyPrint print with tab number and color
func PrintResult ¶
func PrintResult(result []ChaosResult)
PrintResult prints result to users in prettier format
func SetupGlobalLogger ¶ added in v1.2.0
Types ¶
type ChaosResult ¶
type ClientSet ¶
type ClientSet struct { CtrlCli client.Client KubeCli *kubernetes.Clientset }
ClientSet contains two different clients
func InitClientSet ¶
InitClientSet inits two different clients that would be used
type CommonRestClientGetter ¶ added in v1.2.0
type CommonRestClientGetter struct {
*genericclioptions.ConfigFlags
}
CommonRestClientGetter is used for non-e2e test environment. It's basically do the same thing as genericclioptions.ConfigFlags, but it load rest config from incluster or .kubeconfig file
func NewCommonRestClientGetter ¶ added in v1.2.0
func NewCommonRestClientGetter() *CommonRestClientGetter
func (*CommonRestClientGetter) ToRESTConfig ¶ added in v1.2.0
func (it *CommonRestClientGetter) ToRESTConfig() (*rest.Config, error)
type ItemResult ¶
type LoggerFlushFunc ¶ added in v1.2.0
type LoggerFlushFunc func()
func NewStderrLogger ¶ added in v1.2.0
func NewStderrLogger() (logr.Logger, LoggerFlushFunc, error)
type PodResult ¶
type PodResult struct { Name string Items []ItemResult }
type TLSFileConfig ¶ added in v1.2.0
var TLSFiles TLSFileConfig