blob: a95ae060c43f31da16b0ef1f680d3fe289f8aa5f (
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
104
105
|
# kubectl apply -f test/metrics.yml && kubectl scale --replicas=0 deploy/metrics && kubectl scale --replicas=1 deploy/metrics
# kubectl exec -ti metrics-... -- tail -f /tmp/loglast | grep time_total
---
kind: ConfigMap
metadata:
name: metrics
namespace: test-kafka
apiVersion: v1
data:
curl-format.txt: |-
\n
# ### curl stats ###\n
time_namelookup %{time_namelookup}\n
time_connect %{time_connect}\n
time_appconnect %{time_appconnect}\n
time_pretransfer %{time_pretransfer}\n
time_redirect %{time_redirect}\n
time_starttransfer %{time_starttransfer}\n
\n
time_total{url="%{url_effective}"} %{time_total}\n
\n
http_code{url="%{url_effective}"} %{http_code}\n
size_download{url="%{url_effective}"} %{size_download}\n
content_type %{content_type}\n
setup.sh: |-
touch /tmp/testlog
tail -f /tmp/testlog
continue.sh: |-
exit 0
run.sh: |-
exec >> /tmp/testlog
exec 2>&1
date -u -Iseconds | tee /tmp/loglast
curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \
http://kafka-0.broker.kafka.svc.cluster.local:5556/metrics \
| tee -a /tmp/loglast \
| grep http_code \
| grep 200
curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \
http://zoo-0.zoo.kafka.svc.cluster.local:5556/metrics \
| tee -a /tmp/loglast \
| grep http_code \
| grep 200
curl -w "@/test/curl-format.txt" -s --max-time $MAX_RESPONSE_TIME \
http://pzoo-1.pzoo.kafka.svc.cluster.local:5556/metrics \
| tee -a /tmp/loglast \
| grep http_code \
| grep 200
exit 0
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: metrics
namespace: test-kafka
spec:
replicas: 1
template:
metadata:
labels:
test-target: kafka
test-type: readiness
spec:
containers:
- name: testcase
image: solsson/curl@sha256:8c0c5d669b3dd67932da934024252af59fb9d0fa0e5118b5a737b35c5e1487bf
env:
- name: MAX_RESPONSE_TIME
value: "5"
# 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: metrics
|