apiVersion: apps/v1
kind: Deployment
metadata:
  name: replicated-partitions
  namespace: test-kafka
spec:
  replicas: 1
  selector:
    matchLabels:
      test-type: readiness
      test-target: under-replicated-partitions
  template:
    metadata:
      labels:
        test-type: readiness
        test-target: under-replicated-partitions
    spec:
      containers:
      - name: kafka
        image: solsson/kafka:2.2.0@sha256:cf048d6211b6b48f1783f97cb41add511386e2f0a5f5c62fa0eee9564dcd3e9a
        command:
        - /bin/bash
        - -ec
        - >
          touch /tmp/testlog;
          tail -f /tmp/testlog
        readinessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - >
              echo "### $(date -Ins -u) ###" >> /tmp/testlog
              &&
              [
              $(
              ./bin/kafka-topics.sh
              --zookeeper zookeeper.kafka:2181
              --describe
              --under-replicated-partitions
              |
              tee -a /tmp/testlog
              |
              wc -l
              )
              -eq
              0
              ]
          periodSeconds: 30
          timeoutSeconds: 29
