tavern

by Buttahtoast

Helm chartv0.3.3App 1.1.0Verified publisher

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

NameEmailUrl
oliverbaehler[email protected]
chifu1234[email protected]

Source Code

Requirements

RepositoryNameVersion
https://bedag.github.io/helm-chartsmanifests>= 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!

ChangeChart VersionDescriptionCommits/PRs

Values

KeyTypeDefaultDescription
commonLabelsobject{}Common Labels are added to each kubernetes resource manifest.
extraResourceslist[]Enter Extra Resources managed by the release
fullnameOverridestring""Overwrite lib.utils.common.fullname output
global.imagePullPolicystring""Global Docker Image Pull Policy declaration. Will overwrite all child .pullPolicy fields.
global.imagePullSecretslist[]Global Docker Image Pull Secrets declaration. Added to local Docker Image Pull Secrets.
global.imageRegistrystring""Global Docker Image Registry declaration. Will overwrite all child .registry fields.
job.activeDeadlineSecondsintnilSpecifies 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.affinityobject{}Pod Affinity
job.annotationsobject{}Configure CronJob Annotations
job.apiVersionstring""Configure the api version used for the CronJob resource.
job.argsobject{}Configure arguments for executed command
job.backoffLimitint6Specifies the number of retries before marking this job failed.
job.commandobject{}Configure executed container command
job.completionsintnilSpecifies the desired number of successfully finished pods the job should be run with More Info.
job.concurrencyPolicystringnilSpecifies 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.containerFieldsobject{}Extra fields used on the container definition
job.containerNamestring.Chart.NameConfigure Container Name
job.enabledbooltrueEnable CronJob Resource
job.environmentobject{}Configure Environment Variables (Refer to values.yaml)
job.extraFieldsobject{}Extra fields used on the Job resource
job.failedJobsHistoryLimitint1The number of failed finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified.
job.forceRedeployboolfalse
job.image.pullPolicystringnilConfigure Docker Pull Policy. Will be overwritten if set by global variable.
job.image.registrystring"docker.io"Configure Docker Registry. Will be overwritten if set by global variable.
job.image.repositorystring"buttahtoast/docker-tavern"Configure Docker Repository
job.image.tagstringTag defaults to .Chart.Appversion, if not setConfigure Docker Image tag
job.imagePullSecretslist[]Define ImagePullSecrets. Will be overwritten if set by global variable.
job.initContainerslist[]Pod initContainers
job.labelsobject{}Configure CronJob additional Labels
job.lifecycleobject{}Container Lifecycle
job.livenessProbeobject{}Container LivenessProbe
job.nodeSelectorobject{}Pod NodeSelector
job.parallelismintnilmanualSelector controls generation of pod labels and pod selectors. Leave manualSelector unset unless you are certain what you are doing.
job.podAnnotationsobject{}Pod annotations are only added for the pod
job.podFieldsobject{}Add extra field to the Pod Template if not available as value.
job.podLabelsobject{}Pod labels are only added for the pod
job.podSecurityContextobject{"fsGroup":1500,"runAsGroup":1500,"runAsUser":1500}Pod SecurityContext
job.portslist[]Configure Container Ports
job.priorityClassNamestring""Pod priorityClassName
job.readinessProbeobject{}Container ReadinessProbe
job.resourcesobject{}Configure Container Resource
job.restartPolicystring"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.schedulestring"0 * * * *"The schedule in Cron format, see https://crontab.guru/.
job.securityContextobject{}Container SecurityContext
job.selectorobject{}A label query over pods that should match the pod count. Normally, the system sets this field for you.
job.serviceAccount.annotationsobject{}Annotations to add to the service account
job.serviceAccount.apiVersionstringv1Configure the api version used
job.serviceAccount.automountServiceAccountTokenbooltrueAutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted.
job.serviceAccount.createboolfalseSpecifies whether a service account should be created
job.serviceAccount.enabledboolfalseSpecifies whether a service account is enabled or not
job.serviceAccount.globalPullSecretsboolfalseEvaluate global set pullsecrets and mount, if set
job.serviceAccount.imagePullSecretslist[]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.labelsobject{}Merges given labels with common labels
job.serviceAccount.namestringbedag-lib.fullnameIf not set and create is true, a name is generated using the fullname template
job.serviceAccount.secretslist[]Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount
job.sidecarslist[]Allows to add sidecars to your [maincar]](https://kubernetes.io/docs/concepts/workloads/pods/#using-pods)
job.startingDeadlineSecondsstringnilOptional 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.startupProbeobject{}Container StartupProbe
job.successfulJobsHistoryLimitstring3The number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified.
job.suspendstringfalseThe number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified.
job.tolerationsobject{}Pod Tolerations
job.ttlSecondsAfterFinishedstringnilttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed).
job.volumeMountslist[]Configure Container volumeMounts
job.volumeslist[]Additional Volumes
kubeCapabilitiesstring$.Capabilities.KubeVersion.GitVersionOverwrite the Kube GitVersion
nameOverridestring""Overwrite "lib.internal.common.name" output
overwriteLabelsobject{}Overwrites default labels, but not resource specific labels and common labels
proxy.httpProxy.hoststring""Configure HTTP Proxy Hostname/IP (without protocol://)
proxy.httpProxy.portintnilConfigure HTTP Proxy Port
proxy.httpProxy.protocolstringhttpConfigure HTTP Proxy Protocol (http/https)
proxy.httpsProxy.hoststring""Configure HTTPS Proxy Hostname/IP (without protocol://)
proxy.httpsProxy.portintnilConfigure HTTPS Proxy Port
proxy.httpsProxy.protocolstringhttpConfigure HTTPS Proxy Protocol (http/https)
proxy.noProxylist[]Configure No Proxy Hosts noProxy: [ "localhost", "127.0.0.1" ]
selectorLabelsobject{}Define default selectorLabels
stageTemplateslist[]Tavern Test Stage Templates (See the examples)
tavern.asCronjobboolfalseRuns Tavern as Cronjob, instead of Job
tavern.debugboolfalseEnables logging on DEBUG level
tavern.defaultModestring"0550"Default File mode for Test Suite mounts
tavern.test_directorystring"/tavern"Directory where all your tests are mounted
testTemplateslist[]Tavern Test Suite Templates (See the examples)
testslist[{"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].namestring"vanilla_test"Test Suite Name
tests[0].secretbooltrueTest Suite Secret
tests[0].teststringsee values.yamlTavern Test Definition
timezonestring"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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttavern is pinned at v0.3.3 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