apiVersion: batch/v1
kind: Job
metadata:
  labels:
    app: kafka-producer-job-notls-noacks
  name: kafka-producer-job-notls-noacks
  namespace: kafka
spec:
  parallelism: 5
  completions: 5
  backoffLimit: 1
  template:
    metadata:
      name: kafka-perf-producer
      labels:
        app: kafka-perf-producer
    spec:
      restartPolicy: Never
      containers:
      - name: kafka-perf-producer
        image: quay.io/strimzi/kafka:0.24.0-kafka-2.7.1
        command: [ "bin/kafka-producer-perf-test.sh" ]
        args: [ "--topic", "perf-test", "--throughput", "10000000", "--num-records", "1000000", "--producer-props", "bootstrap.servers=my-cluster-kafka-bootstrap:9092", "--record-size", "1000" ]
        volumeMounts:
        - name: strimzi-ca
          readOnly: true
          mountPath: "/etc/strimzi"
        env:
        - name: CA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: my-cluster-cluster-ca-cert
              key: ca.password
      volumes:
      - name: strimzi-ca
        secret:
          secretName: my-cluster-cluster-ca-cert
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - kafka-perf-producer
              topologyKey: kubernetes.io/hostname
