Skip to content

End-to-End Tests ​

The e2e tests in test/e2e/ deploy two real Shoot clusters against a Gardener landscape and validate that the traefik extension works correctly for both ingress providers:

  • KubernetesIngress — Traefik as ingress controller (ingress class traefik)
  • KubernetesIngressNGINX — NGINX as ingress controller (ingress class nginx)

Each test creates a Shoot, deploys a traefik/whoami workload, creates an Ingress, and validates HTTP connectivity through the load balancer.

Prerequisites ​

  • A running Gardener landscape (virtual garden API server)
  • A Project namespace with a valid CredentialsBinding pointing to a cloud provider account
  • KUBECONFIG pointing to the virtual garden API server (not a shoot kubeconfig)
  • go 1.24+ and make

Running Locally ​

Minimal invocation (local provider) ​

sh
export KUBECONFIG=/path/to/virtual-garden/kubeconfig
make test-e2e

AWS example ​

The following command mirrors the setup used in CI:

sh
export KUBECONFIG=~/go/src/github.com/gardener/gardener/dev-setup/kubeconfigs/virtual-garden/kubeconfig
export PROJECT_NAMESPACE=garden
export CLOUD_PROFILE_NAME=aws
export PROVIDER_TYPE=aws
export REGION=eu-central-1
export CREDENTIALS_BINDING=aws
export WORKER_MACHINE_TYPE=m5.large
export WORKER_ZONE=eu-central-1a
export WORKER_VOLUME_SIZE=50Gi
export WORKER_VOLUME_TYPE=gp3
export NODES_CIDR=10.250.0.0/16
export SHOOT_BASE_NAME=traefik-e2e-$(whoami | cut -c1-4)
make test-e2e

Note: SHOOT_BASE_NAME is automatically truncated so that len(projectName) + len(shootName) <= 21 (Gardener's hard limit). Using $(whoami | cut -c1-4) helps avoid name collisions when multiple developers run tests on the same landscape simultaneously.

Running a single test context ​

Use Ginkgo's --label-filter or --focus flag via go test:

sh
# Only the KubernetesIngress context
go test -v -timeout 120m -count=1 ./test/e2e/... \
  --ginkgo.focus "KubernetesIngress provider"

# Only the KubernetesIngressNGINX context
go test -v -timeout 120m -count=1 ./test/e2e/... \
  --ginkgo.focus "KubernetesIngressNGINX provider"

Environment Variable Reference ​

VariableRequiredDefaultDescription
KUBECONFIGYes—Path to the virtual garden kubeconfig
PROJECT_NAMESPACENogarden-localGardener project namespace (e.g. garden-myproject)
CLOUD_PROFILE_NAMENolocalCloud profile name in Gardener
CLOUD_PROFILE_KINDNoCloudProfileKind of the cloud profile (CloudProfile or NamespacedCloudProfile)
CREDENTIALS_BINDINGNolocalName of the CredentialsBinding object in the project
PROVIDER_TYPENolocalInfrastructure provider type (e.g. aws, azure, gcp)
REGIONNolocalCloud region for the shoot (e.g. eu-central-1)
NETWORKING_TYPENocalicoCNI plugin (calico, cilium, etc.)
WORKER_MACHINE_TYPENolocalMachine type for worker nodes (e.g. m5.large)
WORKER_CRI_NAMENocontainerdContainer runtime (containerd)
KUBERNETES_VERSIONNo—Kubernetes version; omit to use cloud profile default
NODES_CIDRNo10.0.0.0/16CIDR for worker nodes
SHOOT_BASE_NAMENotraefik-e2eBase name for test shoots (auto-truncated)
SHOOT_DOMAINNo—DNS domain suffix; shoot FQDN becomes <name>.<domain>
WORKER_VOLUME_SIZENo—Root volume size (e.g. 50Gi); omit to use provider default
WORKER_VOLUME_TYPENo—Root volume type (e.g. gp3); omit to use provider default
AWS-specific
WORKER_ZONENo—Availability zone for InfrastructureConfig subnet layout (e.g. eu-central-1a)
WORKER_SPEC_ZONESNo—Comma-separated zones for the worker spec; falls back to WORKER_ZONE
VPC_CIDRNoNODES_CIDRVPC CIDR for InfrastructureConfig; defaults to NODES_CIDR
WORKER_ZONE_WORKERS_CIDRNo10.250.0.0/19Subnet CIDR for worker nodes in the zone
WORKER_ZONE_PUBLIC_CIDRNo10.250.96.0/22Subnet CIDR for public traffic in the zone
WORKER_ZONE_INTERNAL_CIDRNo10.250.112.0/22Subnet CIDR for internal traffic in the zone
Advanced overrides
INFRASTRUCTURE_CONFIGNo—Raw JSON InfrastructureConfig; overrides auto-generation
WORKERS_CONFIGNo—Raw JSON ProviderConfig for the worker; provider-specific

Required Permissions ​

The user bound to the KUBECONFIG must have the following permissions in the project namespace:

ResourceVerbs
shootscreate, get, list, watch, patch, delete
shoots/adminkubeconfigcreate

The adminkubeconfig subresource is used to fetch a short-lived admin kubeconfig for the created shoot clusters without relying on the legacy <shoot>.kubeconfig Secret.

A typical Gardener Project membership with the admin role grants all of the above.

GitHub Actions ​

The workflow in .github/workflows/e2e-tests.yaml runs on:

  • Every pull request against the repository (only when E2E_KUBECONFIG_BASE64 is configured)
  • Every release (called from .github/workflows/release.yaml)
  • Manual trigger via workflow_dispatch

Configuring secrets and variables ​

In the GitHub repository settings, add the following:

TypeNameValue
SecretE2E_KUBECONFIG_BASE64base64 -i /path/to/virtual-garden/kubeconfig
VariableE2E_PROJECT_NAMESPACEe.g. garden-myproject
VariableE2E_CLOUD_PROFILE_NAMEe.g. aws
VariableE2E_CLOUD_PROFILE_KINDCloudProfile
VariableE2E_CREDENTIALS_BINDINGe.g. core-e2e-aws
VariableE2E_PROVIDER_TYPEe.g. aws
VariableE2E_REGIONe.g. eu-central-1
VariableE2E_NETWORKING_TYPEe.g. calico
VariableE2E_WORKER_MACHINE_TYPEe.g. m5.large
VariableE2E_WORKER_CRI_NAMEcontainerd
VariableE2E_NODES_CIDRe.g. 10.250.0.0/16

Any variable that is not set falls back to the default value shown in the environment variable reference above.

When E2E_KUBECONFIG_BASE64 is absent (e.g. on forks), the workflow skips the e2e steps without failing.

Prow ​

A .prow.yaml is provided for use with Gardener's Prow instance:

  • Presubmit (e2e-traefik-extension): optional, not always run. Triggered manually or via /test e2e-traefik-extension in a PR comment. Runs when code under cmd/, pkg/, test/, charts/, go.mod, go.sum, Makefile, or Dockerfile changes.
  • Periodic (e2e-traefik-extension-periodic): runs every 24 hours on the main branch.

Credentials are injected automatically via the preset-gardener-e2e-kubeconfig: "true" label — no manual secret configuration is needed in Prow.

Update the env values in .prow.yaml to match your Prow landscape (project namespace, cloud profile, credentials binding, etc.) before enabling the jobs.

Last updated: