apiVersion: litmuschaos.io/v1alpha1
description:
  message: |
   Deleting a kafka broker pod
kind: ChaosExperiment
metadata:
  name: kafka-broker-pod-failure
  labels:
    name: kafka-broker-pod-failure
    app.kubernetes.io/part-of: litmus
    app.kubernetes.io/component: chaosexperiment
    app.kubernetes.io/version: latest
spec:
  definition:
    scope: Cluster
    permissions:
      - apiGroups:
          - ""
          - "apps"
          - "batch"
          - "litmuschaos.io"
        resources:
          - "statefulsets"
          - "deployments"
          - "events"
          - "pods/log"
          - "configmaps"
          - "jobs"
          - "pods"
          - "pods/exec"
          - "chaosengines"
          - "chaosexperiments"
          - "chaosresults"
        verbs:
          - "create"
          - "get"
          - "delete"
          - "list"
          - "patch"
      - apiGroups:
          - ""
        resources: 
          - "nodes"
        verbs:
          - "get"
          - "list"
    image: "litmuschaos/ansible-runner:latest"
    imagePullPolicy: Always
    args:
    - -c
    - ansible-playbook ./experiments/kafka/kafka-broker-pod-failure/kafka-broker-pod-failure-ansible-logic.yml -i /etc/ansible/hosts -vv; exit 0
    command:
    - /bin/bash
    env:

    - name: ANSIBLE_STDOUT_CALLBACK
      value: 'default'

    - name: KAFKA_KIND
      value: 'statefulset'

    - name: KAFKA_LIVENESS_STREAM
      value: 'enabled'

    - name: KAFKA_LIVENESS_IMAGE
      value: 'litmuschaos/kafka-client:ci'

    # set to 'enabled' if you have auth set up
    - name: KAFKA_SASL_AUTH
      value: 'disabled'

    # Recommended timeout for EKS platform: 60000 ms
    - name: KAFKA_CONSUMER_TIMEOUT
      value: '30000' #in ms

    - name: TOTAL_CHAOS_DURATION
      value: '15'

    - name: CHAOS_INTERVAL
      value: '5'

    # provide the kill count
    - name: KILL_COUNT
      value: ''

    - name: FORCE
      value: 'true'

    - name: KAFKA_INSTANCE_NAME
      value: ''

    - name: KAFKA_NAMESPACE
      value: ''

    - name: KAFKA_LABEL
      value: ''

    - name: KAFKA_BROKER
      value: ''

    - name: KAFKA_REPLICATION_FACTOR
      value: ''

    - name: KAFKA_SERVICE
      value: ''

    - name: KAFKA_PORT
      value: ''

    - name: ZOOKEEPER_NAMESPACE
      value: ''

    - name: ZOOKEEPER_LABEL
      value: ''

    - name: ZOOKEEPER_SERVICE
      value: ''

    - name: ZOOKEEPER_PORT
      value: ''

    ## env var that describes the library used to execute the chaos
    ## default: litmus. Supported values: litmus
    - name: LIB
      value: 'litmus'

    - name: LIB_IMAGE
      value: 'litmuschaos/pod-delete-helper:latest'
 
    labels:
      name: kafka-broker-pod-failure
      app.kubernetes.io/part-of: litmus

