wiremock

by Delivery Hero

Helm chartv1.4.7App 2.26.0Verified publisher

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 ```

About this chart

wiremock

A service virtualization tool (some call it mock server) for testing purposes.

This is a templated deployment of WireMock 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 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 should be provided in ConfigMaps 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.

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.

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 is not publicly exposed, but can be accessed using port forwarding.

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 ConfigMaps, one can define a binary config map with a zip archive that contains the file in question.

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.

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

Homepage: http://wiremock.org/

How to install this chart

A simple install with default values, latest chart version and generated name:

helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/wiremock

To install a specific version of this chart:

helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/wiremock --version 1.4.7

To install the chart with the release name my-release:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/wiremock

To install with some set values:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/wiremock --set values_key1=value1 --set values_key2=value2

To install with custom values file:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/wiremock -f values.yaml

Source Code

Values

KeyTypeDefaultDescription
affinityobject{}
consumer.argslist[]custom WireMock startup arguments.
consumer.args_include_defaultbooltruewhether WireMock arguments for performance test setup should be included
consumer.environmentobject{}environment variables used in the WireMock container
consumer.environment_secretobject{}environment variables used in the WireMock container, stored as secrets
consumer.initContainerlist[]support for stubs with large files using binary container with zip archive.
consumer.initVolumelist[]custom extra volume for the initialization container providing the zip archive.
consumer.namestring"example"a name used for resources and settings in this WireMock
consumer.stubsobject{}ConfigMaps with WireMock stubs mappings and/or __files folders.
deploymentAnnotationsobject{}
extraLabelsobject{}
fullnameOverridestring""
hpa.cputhresholdint40
hpa.enabledbooltrue
hpa.maxpodsint40
hpa.minpodsint1
image.pullPolicystring"IfNotPresent"
image.pullSecretslist[]
image.repositorystring"rodolpheche/wiremock"
image.tagstring"2.26.0"
ingress.annotationsobject{}
ingress.block_adminbooltrueWhether to create an Ingress configuration snippet to block access to the admin API (recommended)
ingress.classNamestring""
ingress.enabledboolfalsewhether to create an Ingress
ingress.hosts[0].hoststring"chart-example.local"
ingress.hosts[0].paths[0].pathstring"/"
ingress.hosts[0].paths[0].pathTypestring"ImplementationSpecific"
ingress.tlslist[]
init.image.repositorystring"busybox"the docker repository and image to be used for the init container.
init.image.tagstring"latest"the docker image tag for the init container image
java.mmsstring"256M"
java.xmsstring"2G"
java.xmxstring"2G"
nameOverridestring""
nodeSelectorobject{}
pdb.enabledboolfalseWhether to create a PodDisruptionBudget
podAnnotationsobject{}
probes.livenessbooltrue
probes.readinessbooltrue
replicasint1
resources.limits.cpuint2
resources.limits.memorystring"3Gi"
resources.requests.cpuint1
resources.requests.memorystring"3Gi"
service.portint80
service.typestring"ClusterIP"
serviceAccount.annotationsobject{}
serviceAccount.enabledboolfalse
serviceAnnotationsobject{}
strategy.typestring"RollingUpdate"
tolerationslist[]

Maintainers

NameEmailUrl
msherohttps://github.com/mshero

Chart source and versions

Chart source: github.com/deliveryhero/helm-charts/wiremock

Older chart versions: github.com/deliveryhero/helm-charts/pkgs/container/helm-charts/wiremock

Deploy wiremock with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has wiremock on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartwiremock is pinned at v1.4.7 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply