litmus/executor
Rahul M Chheda 2e97549471 Delete Completed Jobs and updated README.md for steps (#854)
Signed-off-by: Rahul M Chheda <rahul.chheda@mayadata.io>
2019-10-21 16:22:24 +05:30
..
README.md Delete Completed Jobs and updated README.md for steps (#854) 2019-10-21 16:22:24 +05:30
chaos_executor_job.yml (feat)executor: add ability to patch litmusbooks with chaos params from chaos experiment CR (#662) 2019-09-04 10:03:08 +05:30
engine_env_getter.yml refactor[executor]: add ability to mount experiment specific configmaps (#797) 2019-10-03 07:27:26 +05:30
executor.yml Delete Completed Jobs and updated README.md for steps (#854) 2019-10-21 16:22:24 +05:30
experiment_configmap.yml refactor[executor] to patch engine status (#831) 2019-10-10 01:20:07 +05:30
experiment_env_getter.yml refactor[executor]: add ability to mount experiment specific configmaps (#797) 2019-10-03 07:27:26 +05:30
experiment_env_patcher.yml (feat)executor: add ability to patch litmusbooks with chaos params from chaos experiment CR (#662) 2019-09-04 10:03:08 +05:30
test.yml (feat)executor: add ability to patch litmusbooks with chaos params from chaos experiment CR (#662) 2019-09-04 10:03:08 +05:30

README.md

Litmus Chaos Executor

  • The executor runs the litmus jobs & monitors them. Typically invoked by the litmuschaos operator to run experiments listed in the chaosengine
  • To learn more about the chaosengine & chaosexperiment resources, see chaos operator

How to Override ChaosExperiment defaults

  • To override the ENV variables in the chaos experiment CRs, perform one of the below steps before applying the manifest:

    • Make changes in the ChaosExperiment CR manifest,
    apiVersion: litmuschaos.io/v1alpha1
    description:
      message: |
        Deletes a pod belonging to a deployment/statefulset/daemonset
    kind: ChaosExperiment
    metadata:
      name: kubernetes-state-pod-delete-v0.1.0
      version: 0.1.0
    spec:
      definition:
        args:
        - -c
        - ansible-playbook ./experiments/chaos/kubernetes/pod_delete/test.yml -i /etc/ansible/hosts
          -vv; exit 0
        command:
        - /bin/bash
        env:
        - name: ANSIBLE_STDOUT_CALLBACK
          value: default
        - name: TOTAL_CHAOS_DURATION 
          value: 15                        <---- EDIT HERE
        - name: CHAOS_INTERVAL
          value: 5
        - name: LIB
          value: ""
        image: ""
        labels:
          name: pod-delete
        litmusbook: /experiments/chaos/kubernetes/pod_delete/run_litmus_test.yml
    
  • Add those variables in the component spec of the respective experiments in the chaosEngine CR manifest

    apiVersion: litmuschaos.io/v1alpha1
    kind: ChaosEngine
    metadata:
      name: engine-nginx
      namespace: default
    spec:
      monitorenable: true 
      appinfo:
        appkind: deployment
        applabel: app=nginx
        appns: default    
      chaosServiceAccount: nginx
      experiments:
      - name: container-kill
        spec:
          components:
          - name: TARGET_CONTAINER   <------ ADD HERE  
            value: jackma
    

How to Delete stale / completed jobs after chaosExperiment Execution

  • To ensure the completed experiment jobs are removed, set spec.jobCleanupPolicy to delete

    apiVersion: litmuschaos.io/v1alpha1
    kind: ChaosEngine
    metadata:
      name: engine-nginx
      namespace: litmus 
    spec:
      jobCleanUpPolicy: ""  <-------------- ADD HERE
      appinfo: 
        appns: litmus
        # FYI, To see app label, apply kubectl get pods --show-labels
        applabel: "app=hello-deployment" 
      chaosServiceAccount: litmus 
      experiments:
        - name: pod-delete
          spec:
            components:
            - name: FORCE
              value: "true"
    

Limitations

  • Executor is currently unable to parse more than one configmap.

  • The name of file which contains data for configmap in experimentCR should be parameters.yml

  • The configmap is mounted in this default directory: /mnt/