Skip to content

Schedule Once

It schedule the chaos once either on the specified time or immediately after creation of schedule CR.

View the schedule once schema

Schedule NOW

Field .spec.schedule.now
Description Flag to control the type of scheduling
Type Mandatory
Range true, false
Default n/a
Notes The now in the spec.schedule ensures immediate creation of chaosengine, i.e., injection of chaos.

Schedule Once

Field .spec.schedule.once.executionTime
Description Flag to specify execution timestamp at which chaos is injected, when the policy is once. The chaosengine is created exactly at this timestamp.
Type Mandatory
Range user-defined (type: UTC Timeformat)
Default n/a
Notes .spec.schedule.once refers to a single-instance execution of chaos at a particular timestamp specified by .spec.schedule.once.executionTime

Immediate Chaos

It schedule the chaos immediately after creation of the chaos-schedule CR. It can be tuned via setting spec.schedule.now to true.

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosSchedule
metadata:
  name: schedule-nginx
spec:
  schedule:
    now: true
  engineTemplateSpec:
    engineState: 'active'
    appinfo:
      appns: 'default'
      applabel: 'app=nginx'
      appkind: 'deployment'
    annotationCheck: 'true'
    chaosServiceAccount: pod-delete-sa
    jobCleanUpPolicy: 'delete'
    experiments:
      - name: pod-delete
        spec:
          components:
            env:
              # set chaos duration (in sec) as desired
              - name: TOTAL_CHAOS_DURATION
                value: '30'

              # set chaos interval (in sec) as desired
              - name: CHAOS_INTERVAL
                value: '10'

              # pod failures without '--force' & default terminationGracePeriodSeconds
              - name: FORCE
                value: 'false'

Chaos at a Specified TimeStamp

It schedule the chaos once at the specified time. It can be tuned via setting spec.schedule.once.executionTime. The execution time should be in UTC Timezone.

apiVersion: litmuschaos.io/v1alpha1
kind: ChaosSchedule
metadata:
  name: schedule-nginx
spec:
  schedule:
    once:
      #should be modified according to current UTC Time
      executionTime: "2020-05-12T05:47:00Z"   
  engineTemplateSpec:
    engineState: 'active'
    appinfo:
      appns: 'default'
      applabel: 'app=nginx'
      appkind: 'deployment'
    annotationCheck: 'true'
    chaosServiceAccount: pod-delete-sa
    jobCleanUpPolicy: 'delete'
    experiments:
      - name: pod-delete
        spec:
          components:
            env:
              # set chaos duration (in sec) as desired
              - name: TOTAL_CHAOS_DURATION
                value: '30'

              # set chaos interval (in sec) as desired
              - name: CHAOS_INTERVAL
                value: '10'

              # pod failures without '--force' & default terminationGracePeriodSeconds
              - name: FORCE
                value: 'false'