This document describe how to add TimeChaos experiments in Chaos Mesh.
TimeChaos is used to modify the return value of
clock_gettime, which causes time offset on Go's
time.Now() and Rust std's
Below is a sample TimeChaos configuration file:
cron: '@every 15s'
For more sample files, see examples. You can edit them as needed.
- mode defines the mode to select pods.
- selector specifies the target pods for chaos injection. For more details, see Define the Scope of Chaos Experiment.
- timeOffset specifies the time offset. It is a duration string with specified unit, such as
-1.5h. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
- clockIds defines all affected
clk_idrefers to the first argument of
clock_gettimecall. For most application,
- containerNames selects affected containers' names. If not set, the first container will be injected.
- duration defines the duration for each chaos experiment. In the sample file above, the time chaos lasts for 10 seconds.
- scheduler defines the scheduler rules for the running time of the chaos experiment. For more rule information, see robfig/cron.
- Time modification can only be injected into the main process of container.
- Time chaos has no effect on pure system call
- All injected vDSO calls use pure system calls to get the real time, so clock-related function calls can be much slower.