tavern
by Buttahtoast
Unofficial Tavern Helm Chart
About this chart
Tavern
Unofficial Tavern Helm Chart
The chart is under active development and may contain bugs/unfinished documentation. Any testing/contributions are welcome! :)
Homepage: https://tavern.readthedocs.io/en/latest/
Maintainers
| Name | Url | |
|---|---|---|
| oliverbaehler | [email protected] | |
| chifu1234 | [email protected] |
Source Code
Requirements
| Repository | Name | Version |
|---|---|---|
| https://bedag.github.io/helm-charts | manifests | >= 0.4.0 < 1.0.0 |
Major Changes
Major Changes to functions are documented with the version affected. Before upgrading the dependency version, check this section out!
| Change | Chart Version | Description | Commits/PRs |
|---|---|---|---|
Values
| Key | Type | Default | Description |
|---|---|---|---|
| commonLabels | object | {} | Common Labels are added to each kubernetes resource manifest. |
| extraResources | list | [] | Enter Extra Resources managed by the release |
| fullnameOverride | string | "" | Overwrite lib.utils.common.fullname output |
| global.imagePullPolicy | string | "" | Global Docker Image Pull Policy declaration. Will overwrite all child .pullPolicy fields. |
| global.imagePullSecrets | list | [] | Global Docker Image Pull Secrets declaration. Added to local Docker Image Pull Secrets. |
| global.imageRegistry | string | "" | Global Docker Image Registry declaration. Will overwrite all child .registry fields. |
| job.activeDeadlineSeconds | int | nil | Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer. |
| job.affinity | object | {} | Pod Affinity |
| job.annotations | object | {} | Configure CronJob Annotations |
| job.apiVersion | string | "" | Configure the api version used for the CronJob resource. |
| job.args | object | {} | Configure arguments for executed command |
| job.backoffLimit | int | 6 | Specifies the number of retries before marking this job failed. |
| job.command | object | {} | Configure executed container command |
| job.completions | int | nil | Specifies the desired number of successfully finished pods the job should be run with More Info. |
| job.concurrencyPolicy | string | nil | Specifies how to treat concurrent executions of a Job. Valid values are: - "Allow" (default): allows CronJobs to run concurrently; - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; - "Replace": cancels currently running job and replaces it with a new one. |
| job.containerFields | object | {} | Extra fields used on the container definition |
| job.containerName | string | .Chart.Name | Configure Container Name |
| job.enabled | bool | true | Enable CronJob Resource |
| job.environment | object | {} | Configure Environment Variables (Refer to values.yaml) |
| job.extraFields | object | {} | Extra fields used on the Job resource |
| job.failedJobsHistoryLimit | int | 1 | The number of failed finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified. |
| job.forceRedeploy | bool | false | |
| job.image.pullPolicy | string | nil | Configure Docker Pull Policy. Will be overwritten if set by global variable. |
| job.image.registry | string | "docker.io" | Configure Docker Registry. Will be overwritten if set by global variable. |
| job.image.repository | string | "buttahtoast/docker-tavern" | Configure Docker Repository |
| job.image.tag | string | Tag defaults to .Chart.Appversion, if not set | Configure Docker Image tag |
| job.imagePullSecrets | list | [] | Define ImagePullSecrets. Will be overwritten if set by global variable. |
| job.initContainers | list | [] | Pod initContainers |
| job.labels | object | {} | Configure CronJob additional Labels |
| job.lifecycle | object | {} | Container Lifecycle |
| job.livenessProbe | object | {} | Container LivenessProbe |
| job.nodeSelector | object | {} | Pod NodeSelector |
| job.parallelism | int | nil | manualSelector controls generation of pod labels and pod selectors. Leave manualSelector unset unless you are certain what you are doing. |
| job.podAnnotations | object | {} | Pod annotations are only added for the pod |
| job.podFields | object | {} | Add extra field to the Pod Template if not available as value. |
| job.podLabels | object | {} | Pod labels are only added for the pod |
| job.podSecurityContext | object | {"fsGroup":1500,"runAsGroup":1500,"runAsUser":1500} | Pod SecurityContext |
| job.ports | list | [] | Configure Container Ports |
| job.priorityClassName | string | "" | Pod priorityClassName |
| job.readinessProbe | object | {} | Container ReadinessProbe |
| job.resources | object | {} | Configure Container Resource |
| job.restartPolicy | string | "OnFailure" | Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy |
| job.schedule | string | "0 * * * *" | The schedule in Cron format, see https://crontab.guru/. |
| job.securityContext | object | {} | Container SecurityContext |
| job.selector | object | {} | A label query over pods that should match the pod count. Normally, the system sets this field for you. |
| job.serviceAccount.annotations | object | {} | Annotations to add to the service account |
| job.serviceAccount.apiVersion | string | v1 | Configure the api version used |
| job.serviceAccount.automountServiceAccountToken | bool | true | AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. |
| job.serviceAccount.create | bool | false | Specifies whether a service account should be created |
| job.serviceAccount.enabled | bool | false | Specifies whether a service account is enabled or not |
| job.serviceAccount.globalPullSecrets | bool | false | Evaluate global set pullsecrets and mount, if set |
| job.serviceAccount.imagePullSecrets | list | [] | ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. |
| job.serviceAccount.labels | object | {} | Merges given labels with common labels |
| job.serviceAccount.name | string | bedag-lib.fullname | If not set and create is true, a name is generated using the fullname template |
| job.serviceAccount.secrets | list | [] | Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount |
| job.sidecars | list | [] | Allows to add sidecars to your [maincar]](https://kubernetes.io/docs/concepts/workloads/pods/#using-pods) |
| job.startingDeadlineSeconds | string | nil | Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones. |
| job.startupProbe | object | {} | Container StartupProbe |
| job.successfulJobsHistoryLimit | string | 3 | The number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified. |
| job.suspend | string | false | The number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified. |
| job.tolerations | object | {} | Pod Tolerations |
| job.ttlSecondsAfterFinished | string | nil | ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). |
| job.volumeMounts | list | [] | Configure Container volumeMounts |
| job.volumes | list | [] | Additional Volumes |
| kubeCapabilities | string | $.Capabilities.KubeVersion.GitVersion | Overwrite the Kube GitVersion |
| nameOverride | string | "" | Overwrite "lib.internal.common.name" output |
| overwriteLabels | object | {} | Overwrites default labels, but not resource specific labels and common labels |
| proxy.httpProxy.host | string | "" | Configure HTTP Proxy Hostname/IP (without protocol://) |
| proxy.httpProxy.port | int | nil | Configure HTTP Proxy Port |
| proxy.httpProxy.protocol | string | http | Configure HTTP Proxy Protocol (http/https) |
| proxy.httpsProxy.host | string | "" | Configure HTTPS Proxy Hostname/IP (without protocol://) |
| proxy.httpsProxy.port | int | nil | Configure HTTPS Proxy Port |
| proxy.httpsProxy.protocol | string | http | Configure HTTPS Proxy Protocol (http/https) |
| proxy.noProxy | list | [] | Configure No Proxy Hosts noProxy: [ "localhost", "127.0.0.1" ] |
| selectorLabels | object | {} | Define default selectorLabels |
| stageTemplates | list | [] | Tavern Test Stage Templates (See the examples) |
| tavern.asCronjob | bool | false | Runs Tavern as Cronjob, instead of Job |
| tavern.debug | bool | false | Enables logging on DEBUG level |
| tavern.defaultMode | string | "0550" | Default File mode for Test Suite mounts |
| tavern.test_directory | string | "/tavern" | Directory where all your tests are mounted |
| testTemplates | list | [] | Tavern Test Suite Templates (See the examples) |
| tests | list | [{"name":"vanilla_test","secret":true,"test":"test_name: Make sure cookie is required to log in\n\nincludes:\n - !include common.yaml\n\nstages:\n - name: Try to check user info without login information\n request:\n url: \"{host}/userinfo\"\n method: GET\n response:\n status_code: 401\n json:\n error: \"no login information\"\n headers:\n content-type: application/json\n","vanilla":true}] | Tavern Test Suites which will be executed |
| tests[0].name | string | "vanilla_test" | Test Suite Name |
| tests[0].secret | bool | true | Test Suite Secret |
| tests[0].test | string | see values.yaml | Tavern Test Definition |
| timezone | string | "Europe/Zurich" | Define Container Timezone (Sets TZ Environment) |
Implementing Tests
Tavern tests are implemented under the key $.Values.tests. Each element of this key represents a dedicated tavern test suite (dedicated configmap etc.). This is mainly because a configmap can maximum be up to 1MiB of data, therefor it makes sense to split each test suite into dedicate configmaps. See the values.yaml as well as the example to see how it works!.
Using Templates
This chart provides the functionality to create templates, which can be re referenced. The templates allow you to implement go sprig logic and therefor might dramatically improve your tavern test suites.
NOTE: While tavern statements use single { .. } I had to replace the go sprig \{\{ .. }} as well with single { .. } because of the documenting engine.
Stage
Tavern Stage templates are defined under the $.Values.stageTemplates key. You can define as many templates as you want below this key, just use the following semantic:
stageTemplates:
## Tavern template Name (Required)
- name: "stagetplname"
## Local Variables
values:
constant_url: "https://google.com"
## Here goes your tavern stage template
template: |
request:
url: '{ $.tavern.constant_url }/{ default "/user" $.tavern.endpoint | trimAll "/" }'
method: GET
auth:
- "{tavern.env_vars.BASIC_AUTH_USER}"
- "{tavern.env_vars.BASIC_AUTH_PASSWD}"
headers:
content-type: "application/json"
response:
status_code:
- 200
- 301
## Tavern template Name (Required)
- name: "stagetplname2"
## Here goes your tavern stage template
template: |
...
Reference
Referencing in a tavern test suite (same goes for test suite templates):
tests:
- name: "Simple Suite"
values:
endpoint: "products"
test:
stages:
Deploy tavern with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tavern 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charttavern is pinned at v0.3.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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