Skip to content

Make container registry configurable for examples and e2e tests #9191

@vdemeester

Description

@vdemeester

Problem

Examples and e2e tests currently use hardcoded container registries (like gcr.io/christiewilson-catfactory), which causes:

  1. Registry rate limiting when running tests repeatedly - especially with Docker Hub (docker.io) which limits anonymous users to 100 pulls per 6 hours and authenticated users to 200 pulls per 6 hours
  2. Slow test execution due to remote registry pulls
  3. Friction for local development - developers can't easily use local registries

While the test framework has a substituteEnv function that replaces registries with KO_DOCKER_REPO during test execution, this only works for automated tests, not for manually running examples.

Proposed Solution

Make it easy to configure which registry to use for examples and tests. This would allow developers to:

  • Use local registries (like kind.local, registry.local:5000) to avoid rate limits
  • Speed up test/example execution by using cached local images
  • Test in air-gapped or restricted environments

Possible approaches:

  1. Helper script - Create ./hack/run-example.sh that applies registry substitution before running examples
  2. Documentation - Add clear instructions to examples/README.md for using sed or similar tools
  3. Extract utility - Make the existing substituteEnv function available as a standalone tool

Current Workaround

The test/examples_test.go file has a substituteEnv function (lines 79-96) that replaces gcr.io/christiewilson-catfactory with KO_DOCKER_REPO, but it's only accessible during test execution. Users must manually edit YAML files to change registries.

Benefits

  • Avoid registry rate limiting during development/testing
  • Faster test execution with local registries
  • Better developer experience for running examples locally
  • Support for air-gapped/restricted environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testingIssues or PRs related to testinghelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/documentationCategorizes issue or PR as related to documentation.kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions