Optional Replay Annotations
Just add annotations to your deployment and the operator will take care of the rest.
Here are additional annotations for customizing your replay
Annotation | Description | Supported Values |
---|---|---|
replay.speedscale.com/env-id | Name of the TrafficReplay Custom Resource tied to a replay for this workload | Strings, automatically assigned |
replay.speedscale.com/snapshot-id | ID of the Snapshot that is used to recreate traffic. | UUIDs for Snapshots |
replay.speedscale.com/testconfig-id | ID of the test configuration used to recreate to traffic. | String of valid test configuration. Default: standard |
replay.speedscale.com/build-tag | Link a unique tag, build hash, etc. to the Speedscale report. That way you can connect the report results to the version of the code that was tested. | String |
replay.speedscale.com/mode | Defines how a replay will test the system. |
|
replay.speedscale.com/timeout | Specifies a timeout for a replay. Ignored when replay mode is responder-only | Duration |
replay.speedscale.com/secrets | Use this setting to provide a list of secrets for the replay system to load (ex: JWT passwords). | Comma separated list of strings |
replay.speedscale.com/cleanup | Cleans up provisioned resources after a traffic replay. |
|
replay.speedscale.com/sut-url | Use this setting to override the URL the generator automatically determines (useful if you have customized your service definition). | URL |
replay.speedscale.com/collect-logs | Collect logs from the system under test. | Boolean Default: "true" |
replay.speedscale.com/generator-low-data | Forces the generator into a high efficiency/low data output mode. This is ideal for high volume performance tests. | Boolean Default: "false" |
replay.speedscale.com/responder-low-data | Forces the responder into a high efficiency/low data output mode. This is ideal for high volume performance tests. | Boolean Default: "false" |
replay.speedscale.com/timeout | Specifies a timeout for a replay. Ignored when replay mode is responder-only | Duration |
note
The operator will remove all listed replay annotations from the workload during admission review and move them into an associated TrafficReplay
Custom Resource.
This prevents side effects such as the operator observing and executing the same replay after it has finished.
It also allows subsequent runs of the same replay by applying the same manifests, or incorporating the annotations into a GitOps workflow.
note
For version 2 of the operator, be sure to check the table of changes for updated annotations. Unless otherwise noted, these annotations can be applied prior to installing version 2 without interference.
Tag Annotation
Here a simple example from Gitlab where we use sed to insert the build tag into the yaml before deploying to the Kubernetes test cluster:
deploy_speedscale:
stage: deploy
image: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
script:
- sed s/CIBuild/$(echo $CI_COMMIT_TAG)/g ./k8s/moto-api.yaml > ./k8s/moto-api-corrected.yaml
- kubectl -n mototest1 apply -f ./k8s/moto-api-corrected.yaml
Secret configuration
If your application uses short lived JWTs, you need to provide a JWT secret that Speedscale can use to resign tokens. For example, if your service receives HTTP calls that contain a JWT authorization with 10 minute expiration (exp) setting, that JWT will be invalid by the time it is used for replay. To solve this, add the following annotations (insert your own secret names):
replay.speedscale.com/secrets: "jwtsecret,jwtsecret2,jwtsecret3"
This will cause the Kubernetes operator to add each secret (comma separated) to the generator. Note that you need to include the secret filename to the tokenizer configuration (ask Speedscale how to do this, it isn't in the docs yet). The filename for each secret in the tokenizer will be in the format
/home/speedscale/secret/SECRETNAME/SECRETFILENAME
Environment Cleanup
The operator can be configured to automatically delete:
- The Speedscale created components (generator, responder, etc.)
- The System Under Test (i.e. your deployment)
You can stop this behavior to retain logs, etc by adding the following annotation to your deployment:
replay.speedscale.com/cleanup: "none"