-
Notifications
You must be signed in to change notification settings - Fork 287
/
Chart.yaml
85 lines (68 loc) · 3.35 KB
/
Chart.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
apiVersion: v1
name: wiremock
version: "1.4.4"
appVersion: "2.26.0"
home: http://wiremock.org/
icon: http://wiremock.org/images/wiremock-concept-icon-01.png
sources:
- https://github.com/tomakehurst/wiremock
- https://github.com/rodolpheche/wiremock-docker
maintainers:
- name: mshero
email: [email protected]
description: |
A service virtualization tool (some call it mock server) for testing purposes.
This is a templated deployment of [WireMock](http://wiremock.org/) for mocking services during test scenario execution
for load tests as well as for manual and automated QA purposes.
By default the chart will install WireMock with only a `/status` mapping for readiness probes.
One can utilize it's HTTP API as well as the file configuration documented in the
[Running as a Standalone Process](http://wiremock.org/docs/running-standalone/) described in the "Configuring via JSON
over HTTP" and "JSON file configuration" chapters.
The JSON file configuration is the recommended setup and the [stub mappings](http://wiremock.org/docs/stubbing/)
should be provided in `ConfigMap`s one per folder.
> :warning: both folders `mappings` and `__files` are optional but each folder requires it's own `ConfigMap`. The
`-mappings` and `-files` suffixes are obligate.
```console
kubectl create configmap my-service1-stubs-mappings --from-file=path/to/your/service1/mappings
kubectl create configmap my-service1-stubs-files --from-file=path/to/your/service1/__files
kubectl create configmap my-service2-stubs-mappings --from-file=path/to/your/service2/mappings
kubectl create configmap my-service2-stubs-files --from-file=path/to/your/service2/__files
```
Install the chart passing the `stubs` as a value omitting the suffixes as both `mappings` and `__files` folders are
handled transparently during initialization depending on their existence.
```console
helm install my-wiremock deliveryhero/wiremock \
--set consumer=my-consumer
--set "consumer.stubs.my-service1-stubs=/mnt/my-service1-stubs" \
--set "consumer.stubs.my-service2-stubs=/mnt/my-service2-stubs"
```
WireMock's [admin API](http://wiremock.org/docs/api/) is not publicly exposed, but can be accessed using port forwarding.
```console
kubectl port-forward my-wiremock-123456789a-bcdef 8080
```
The HTTP API can then be accessed using `http://localhost:8080/__admin/docs/` where a swagger UI is availabe.
> :warning: this does not work out for multi instance setups as there is no synchronization of mappings created using
the HTTP API between multiple instances.
In case JSON files need to be provided, which are too large for usual `ConfigMap`s, one can define a binary config map
with a zip archive that contains the file in question.
```console
gzip large.json
kubectl create configmap my-binary-stub --from-file=large.json.gz
```
The resulting archive can be best installed in the wiremock using a `values.yaml` file.
```yaml
consumer:
initContainer:
- name: unzip-large-file
image: busybox:latest
command: ["sh", "-c", "cp /archive/large.json.gz /working/mappings; gunzip /working/mappings/large.json.gz"]
volumeMounts:
- mountPath: /working
name: working
- mountPath: /archive
name: my-binary-stub
initVolume:
- name: my-binary-stub
configMap:
name: my-binary-stub
```