apiVersion: litmuschaos.io/v1alpha1
description:
  message: |
    Give a memory hog on a node belonging to a deployment
kind: ChaosExperiment
metadata:
  name: node-memory-hog
  labels:
    name: node-memory-hog
    app.kubernetes.io/part-of: litmus
    app.kubernetes.io/component: chaosexperiment
    app.kubernetes.io/version: latest
spec:
  definition:
    scope: Cluster
    permissions:
      - apiGroups:
          - ""
          - "batch"
          - "apps"
          - "litmuschaos.io"
        resources:
          - "jobs"
          - "pods"
          - "pods/log"
          - "events"
          - "chaosengines"
          - "chaosexperiments"
          - "chaosresults"
        verbs:
          - "create"
          - "list"
          - "get"
          - "patch"
          - "update"
          - "delete"
      - apiGroups:
          - ""
        resources: 
          - "nodes"
        verbs:
          - "get"
          - "list"
    image: "litmuschaos/ansible-runner:latest"
    imagePullPolicy: Always
    args:
    - -c
    - ansible-playbook ./experiments/generic/node_memory_hog/node_memory_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
    command:
    - /bin/bash
    env:

    - name: ANSIBLE_STDOUT_CALLBACK
      value: 'default'

    - name: TOTAL_CHAOS_DURATION
      value: '120'

    ## specify the size as percent of total available memory (in percentage %)
    ## Default value "90%"
    - name: MEMORY_PERCENTAGE
      value: '90'        

    # Period to wait before injection of chaos in sec
    - name: RAMP_TIME
      value: ''

    # Provide the LIB here
    # Only litmus supported
    - name: LIB
      value: 'litmus'

    # provide lib image
    - name: LIB_IMAGE
      value: 'litmuschaos/stress-ng:latest' 
      
    labels:
      name: node-memory-hog
      app.kubernetes.io/part-of: litmus
      app.kubernetes.io/component: experiment-job
      app.kubernetes.io/version: latest
