Development
January 16, 2023 ยท View on GitHub
This doc explains how to setup a development environment so you can get started
contributing to Knative net-gateway-api.
Before submitting a PR, see also:
Notes
If you use the konk script to setup your cluster, your cluster will be named knative. However, most of the scripts expect it to be the default kind name. Set the kind cluster name env export KIND_CLUSTER_NAME=knative to point to knative cluster. KO requires a registry which if you are developing locally you could use export KO_DOCKER_REPO=kind.local to use the local one on kind. Please see official KO documentation for more information.
Versions to be installed are listed in hack/test-env.sh.
Tests are currently wip. Please see README#tests
Requirements
- A running cluster
- Knative serving installed
ko(for development and testing)kubectl(for managing development environments)bashv4 or later. On macOS the default bash is too old, you can use Homebrew to install a later version.
Environment
To start your environment you'll need to set KO_DOCKER_REPO: The repository to which developer/test images should be pushed. Ex:
export KO_DOCKER_REPO='gcr.io/my-gcloud-project-id'
Notes
- If you are using Docker Hub to store your images your
KO_DOCKER_REPOvariable should bedocker.io/<username>. - Currently Docker Hub doesn't let you create subdirs under your username.
- You'll need to be authenticated with your
KO_DOCKER_REPObefore pushing images.- Google Container Registry:
gcloud auth configure-docker - Docker Hub:
docker login
- Google Container Registry:
Building the test images
NOTE: this is only required when you run conformance/e2e tests locally with go test commands, and may be required periodically.
The upload-test-images.sh script can be used to build and push the test images used by the conformance and e2e tests.
./test/upload-test-images.sh
Tests
Conformance and HA
- Calling the script without arguments will create a new cluster in your current GCP project (assuming you have one) and run the tests against it.
- Calling the script with
--run-testsand the variableKO_DOCKER_REPOset will immediately start the tests against the cluster currently configured forkubectl. - Use the script with
--kindto run the tests against a kind cluster.
Examples
./test/e2e-tests.sh --istio --run-tests --kind --skip-dump-on-failure
./test/e2e-tests.sh --contour --run-tests --kind --skip-dump-on-failure
Individual tests
To run an individual test use
# Prepare environment
cd test
source e2e-common.sh
initialize --istio --run-tests --kind --skip-dump-on-failure
cd ..
# Running a single conformance test
go_test_e2e -tags=e2e -parallel=1 ./test/conformance \
-enable-alpha \
-enable-beta \
-run ^TestIngressConformance/basics$ \
-ingressClass=gateway-api.ingress.networking.knative.dev