-
Notifications
You must be signed in to change notification settings - Fork 4
/
kkv-example.yaml
214 lines (214 loc) · 7.8 KB
/
kkv-example.yaml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kkv-example
labels: &labels
type: kontrakt-test
app: kkv
test-name: example
spec:
replicas: 1
serviceName: kkv-example
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8081"
prometheus.io/path: "/stats/prometheus"
spec:
containers:
- name: kkv
image: builds-registry.ystack.svc.cluster.local/yolean/kafka-keyvalue
ports:
- containerPort: 8090
name: api
- containerPort: 5005
name: debugger
env:
- name: kafka_bootstrap
value: bootstrap.kafka:9092
- name: kafka_group_id
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: topic
value: kkv-test-bash
- name: kafka_offset_reset
value: earliest
- name: target
value: http://127.0.0.1:8080/204/__TOPIC__
#- name: target1
# value: http://127.0.0.1:8080/503?topic=__TOPIC__
#- name: target2
# value: http://127.0.0.1:23456/expectingconnectionrefused?topic=__TOPIC__
readinessProbe:
httpGet:
path: /q/health/ready
port: api
livenessProbe:
httpGet:
path: /q/health/live
port: api
initialDelaySeconds: 30
- name: envoy
image: envoyproxy/envoy:v1.10.0@sha256:bf7970f469c3d2cd54a472536342bd50df0ddf099ebd51024b7f13016c4ee3c4
ports:
- containerPort: 8080
- containerPort: 8081
readinessProbe:
httpGet:
path: /healthz
port: 8080
command:
- /usr/local/bin/envoy
- -l info
args:
- --config-yaml
- |
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 8080
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: kkvtest
access_log:
- name: envoy.file_access_log
filter:
not_health_check_filter: {}
config:
path: /logs/envoy-access.log
json_format:
start_time: "%START_TIME%"
req_method: "%REQ(:METHOD)%"
req_path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
resp_code: "%RESPONSE_CODE%"
resp_flags: "%RESPONSE_FLAGS%"
bytes_recv: "%BYTES_RECEIVED%"
bytes_sent: "%BYTES_SENT%"
duration: "%DURATION%"
agent: "%REQ(USER-AGENT)%"
content_type: "%REQ(CONTENT-TYPE)%"
content_length: "%REQ(CONTENT-LENGTH)%"
kkv_topic: "%REQ(X-KKV-TOPIC)%"
kkv_offsets: "%REQ(X-KKV-OFFSETS)%"
route_config:
name: boards_route
virtual_hosts:
- name: service
domains:
- "*"
routes:
- match:
prefix: "/stats"
route:
cluster: stats-from-admin
- match:
prefix: "/200"
direct_response:
status: 200
body:
inline_string: "Thanks for the update"
- match:
prefix: "/204"
direct_response:
status: 204
- match:
prefix: "/503"
direct_response:
status: 503
body:
inline_string: "Example unavailable response"
- match:
prefix: "/302"
redirect:
path_redirect: /200
response_code: FOUND
- match:
prefix: "/"
direct_response:
status: 404
body:
inline_string: "This KKV test server has endpoints like /200 and /204"
http_filters:
- name: envoy.health_check
config:
pass_through_mode: false
headers:
name: :path
exact_match: /healthz
- name: envoy.router
config: {}
clusters:
- name: stats-from-admin
connect_timeout: 0.25s
type: logical_dns
lb_policy: round_robin
load_assignment:
cluster_name: admin
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8081
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8081
volumeMounts:
- name: logs
mountPath: /logs
- name: logs-tailer
image: busybox@sha256:4b6ad3a68d34da29bf7c8ccb5d355ba8b4babcad1f99798204e7abb43e54ee3d
command:
- tail
- -f
- /logs/envoy-access.log
volumeMounts:
- name: logs
mountPath: /logs
- name: selfcheck
image: yolean/toil@sha256:82c8cc8d082f40753d2e409a670e1dc34455b0e2143adff285cc4102b1326d11
command:
- /bin/bash
- -cex
- |
echo "Running ad-hoc smoketests here"
curl -s --retry-connrefused --retry 5 http://127.0.0.1:8090/health/live
curl -s --retry 5 http://127.0.0.1:8090/health/ready
curl -s http://127.0.0.1:8090/cache/v1/keys
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/0
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/1
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/2
time=$(date -Is)
echo testtime=$time | kafkacat -b bootstrap.kafka:9092 -P -K '=' -t kkv-test-bash
curl -s http://127.0.0.1:8080/stats/prometheus | grep envoy_server_total_connections
echo "Waiting for evidence of an onupdate request ..."
tail -n 0 -f /logs/envoy-access.log | head -n 1
curl -s http://127.0.0.1:8080/stats/prometheus | grep envoy_server_total_connections
curl -s http://127.0.0.1:8090/cache/v1/raw/testtime
curl -s http://127.0.0.1:8090/cache/v1/values
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/0
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/1
curl -s http://127.0.0.1:8090/cache/v1/offset/kkv-test-bash/2
curl -s http://127.0.0.1:8080/stats/prometheus | grep envoy_server_total_connections
echo "Sleeping here, for exec to run manual testing"
sleep infinity
volumeMounts:
- name: logs
mountPath: /logs
volumes:
- name: logs
emptyDir: {}