aboutsummaryrefslogtreecommitdiff
path: root/test/basic-with-kafkacat.yml
blob: 405a798008d5066bb84063f3beb95b2418cbbafe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
kind: ConfigMap
metadata:
  name: basic-with-kafkacat
  namespace: test-kafka
apiVersion: v1
data:

  setup.sh: |-
    touch /tmp/testlog
    tail -f /tmp/testlog

  continue.sh: |-
    exit 0

  run.sh: |-
    exec >> /tmp/testlog
    exec 2>&1

    unique=$(date -Ins)

    echo "Test $unique" | kafkacat -P -b $BOOTSTRAP -t test-basic-with-kafkacat -v
    kafkacat -C -b $BOOTSTRAP -t test-basic-with-kafkacat -o -1 -e | grep $unique

    exit 0

---
apiVersion: batch/v1
kind: Job
metadata:
  name: basic-with-kafkacat
  namespace: test-kafka
spec:
  template:
    spec:
      containers:
      - name: topic-create
        image: solsson/kafka:1.0.0@sha256:17fdf1637426f45c93c65826670542e36b9f3394ede1cb61885c6a4befa8f72d
        command:
        - ./bin/kafka-topics.sh
        - --zookeeper
        -   zookeeper.kafka.svc.cluster.local:2181
        - --create
        - --if-not-exists
        - --topic
        -   test-basic-with-kafkacat
        - --partitions
        -   "1"
        - --replication-factor
        -   "1"
      restartPolicy: Never
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: basic-with-kafkacat
  namespace: test-kafka
spec:
  replicas: 1
  template:
    metadata:
      labels:
        test-target: kafka
        test-type: readiness
    spec:
      containers:
      - name: testcase
        # common test images
        #image: solsson/curl@sha256:8b0927b81d10043e70f3e05e33e36fb9b3b0cbfcbccdb9f04fd53f67a270b874
        image: solsson/kafkacat@sha256:ebebf47061300b14a4b4c2e1e4303ab29f65e4b95d34af1b14bb8f7ec6da7cef
        #image: solsson/kubectl-kafkacat@sha256:3715a7ede3f168f677ee6faf311ff6887aff31f660cfeecad5d87b4f18516321
        env:
        - name: BOOTSTRAP
          #value: kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092
          value: kafka-0.broker.kafka.svc.cluster.local:9092
        - name: ZOOKEEPER
          value: zookeeper.kafka.svc.cluster.local:2181
        # Test set up
        command:
        - /bin/bash
        - -e
        - /test/setup.sh
        # Test run, again and again
        readinessProbe:
          exec:
            command:
            - /bin/bash
            - -e
            - /test/run.sh
        # Test quit on nonzero exit
        livenessProbe:
          exec:
            command:
            - /bin/bash
            - -e
            - /test/continue.sh
        volumeMounts:
        - name: config
          mountPath: /test
      volumes:
      - name: config
        configMap:
          name: basic-with-kafkacat