Просмотр исходного кода

Add a README with a record/replay example

Lu Stadler лет назад: 7
Родитель
Сommit
2b1abe7510
1 измененных файлов с 35 добавлено и 0 удалено
  1. 35 0
      go/fake-http/README.md

+ 35 - 0
go/fake-http/README.md

1
# fake-http
2
3
## Example: Record and replay kubernetes traffic
4
5
This needs a running Minikube instance, which can be started with
6
`minikube start`.
7
8
```
9
$ fake-http -proxy-url=https://$(minikube ip):8443 -proxy-client-cert ~/.minikube/client.crt -proxy-client-key ~/.minikube/client.key
10
2018/06/09 13:21:19 Listening on http://localhost:8080
11
2018/06/09 13:21:19 See http://localhost:8080/_help
12
...
13
14
# switch to another terminal
15
16
# set up "fake-minikube" context
17
$ kubectl set-cluster fake-minikube --server=http://localhost:8080
18
$ kubectl set-context fake-minikube --cluster=fake-minikube --user minikube
19
20
$ kubectl --context=fake-minikube get pods
21
NAME                         READY     STATUS    RESTARTS   AGE
22
hellogo-2387138299-p83qw     1/1       Running   2          266d
23
hellonode-1839943766-t2hsv   1/1       Running   2          266d
24
```
25
26
Now have a look at the requests kubectl made: <http://localhost:8080>.
27
28
Or, save the log and replay it later:
29
30
```
31
$ curl -H 'Accept: application/yaml' http://localhost:8080/_log > minikube.yaml
32
33
# replay later
34
$ fake-http minikube.yaml
35
```