-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⬆️ Bump Gateway API version to v0.5.0-rc1 (#315)
* Upgrade Gateway API import paths + deps to v0.5.0-rc1 * ParentRef -> ParentReference * ConditionRouteAccepted -> RouteConditionAccepted * Update CRDs, config, instructions + point to local CRDs * Fix path to config files * ingressv2 -> gateway-api * Fix my dyslexic moment * Remove deprecated type Our injection generated code was not being generated correctly anyway. * Revert removal of generated injection code + fix Pulling from main for now which now contains the correct `ReferencePolicyList.Items.[]ReferencePolicy` spec. * Refactor tests + improve docs + revert config dir - Reverted: - third_party/gateway-api/ -> config/ - Refactored out test configuration for different vendor into a common setup file - Improved docs for installation (README) (closes #292) and for development/testing (DEVELOPMENT). * Codegen * Set shell flags same as e2e-common.sh (none) * Trying to please the shell gods * Set same bash settings * Setup config on presubmit of tests * Try to fix test override * Fix linter failure * This is a test * Fix failing test * Re-add namespace * Remove tmp * Fix conformance tests * Unrefactor for now * Exporting here is a problem, fix * Fix conformance tests, round 2 * No waiting for conformance tests * Fix e2e tests * Fix * Fix? * 🤞 * 🤞🤞🤞 * Test refactor * Fix bash flag * Add ns to istio test * Add (maybe) needed source
- Loading branch information
Carlisia Thompson
committed
Jul 11, 2022
1 parent
c538b87
commit c82e90c
Showing
183 changed files
with
14,175 additions
and
2,291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
# Temporary output of build tools | ||
bazel-* | ||
*.out | ||
|
||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,187 +1,77 @@ | ||
# Development | ||
|
||
This doc explains how to setup a development environment so you can get started | ||
[contributing](https://www.knative.dev/contributing/) to Knative | ||
`net-gateway-api`. Also take a look at: | ||
contributing to Knative `net-gateway-api`. | ||
|
||
Before submitting a PR, see also: | ||
- [CONTRIBUTING.md](./CONTRIBUTING.md). | ||
- [The pull request workflow](https://knative.dev/community/contributing/reviewing/) | ||
|
||
## Getting started | ||
|
||
1. Create [a GitHub account](https://github.com/join) | ||
1. Setup | ||
[GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) | ||
1. Install [requirements](#requirements) | ||
1. Set up your [shell environment](#environment-setup) | ||
1. [Create and checkout a repo fork](#checkout-your-fork) | ||
|
||
Before submitting a PR, see also [CONTRIBUTING.md](./CONTRIBUTING.md). | ||
|
||
### Requirements | ||
|
||
You must install these tools: | ||
|
||
1. [`go`](https://golang.org/doc/install): The language Knative `net-gateway-api` | ||
is built in | ||
1. [`git`](https://help.github.com/articles/set-up-git/): For source control | ||
1. [`dep`](https://github.com/golang/dep): For managing external dependencies. | ||
|
||
### Environment setup | ||
|
||
To get started you'll need to set these environment variables (we recommend | ||
adding them to your `.bashrc`): | ||
|
||
1. `GOPATH`: If you don't have one, simply pick a directory and add | ||
`export GOPATH=...` | ||
|
||
1. `$GOPATH/bin` on `PATH`: This is so that tooling installed via `go get` will | ||
work properly. | ||
|
||
`.bashrc` example: | ||
|
||
```shell | ||
export GOPATH="$HOME/go" | ||
export PATH="${PATH}:${GOPATH}/bin" | ||
``` | ||
|
||
### Checkout your fork | ||
## 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](https://github.com/google/ko#local-publishing-options) for more information. | ||
|
||
The Go tools require that you clone the repository to the | ||
`src/knative.dev/net-gateway-api` directory in your | ||
[`GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH). | ||
Versions to be installed are listed in [`hack/test-env.sh`](hack/test-env.sh). | ||
|
||
To check out this repository: | ||
Tests are currently wip. Please see [README#tests](README.md#tests) | ||
|
||
1. Create your own | ||
[fork of this repo](https://help.github.com/articles/fork-a-repo/) | ||
## Requirements | ||
1. A running cluster | ||
2. [Knative serving installed](README.md#install-knative-serving) | ||
3. [`ko`](https://github.com/google/ko) (for development and testing) | ||
4. [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/) (for managing development environments) | ||
5. [`bash`](https://www.gnu.org/software/bash/) v4 or later. On macOS the default bash is too old, you can use [Homebrew](https://brew.sh) to install a later version. | ||
|
||
1. Clone it to your machine: | ||
## Environment | ||
To start your environment you'll need to set `KO_DOCKER_REPO`: The repository to which developer/test images should be pushed. Ex: | ||
|
||
```shell | ||
mkdir -p ${GOPATH}/src/knative.dev | ||
cd ${GOPATH}/src/knative.dev | ||
git clone git@github.com:${YOUR_GITHUB_USERNAME}/net-gateway-api.git | ||
cd net-gateway-api | ||
git remote add upstream https://github.com/knative-sandbox/net-gateway-api.git | ||
git remote set-url --push upstream no_push | ||
export KO_DOCKER_REPO='gcr.io/my-gcloud-project-id' | ||
``` | ||
|
||
_Adding the `upstream` remote sets you up nicely for regularly | ||
[syncing your fork](https://help.github.com/articles/syncing-a-fork/)._ | ||
### Notes | ||
- If you are using Docker Hub to store your images your `KO_DOCKER_REPO` variable should be `docker.io/<username>`. | ||
- Currently Docker Hub doesn't let you create subdirs under your username. | ||
- You'll need to be authenticated with your `KO_DOCKER_REPO` before pushing images. | ||
- Google Container Registry: `gcloud auth configure-docker` | ||
- Docker Hub: `docker login` | ||
|
||
Once you reach this point you are ready to do a full build and deploy as | ||
described below. | ||
## 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. | ||
|
||
### Execute conformance tests | ||
The [`upload-test-images.sh`](test/upload-test-images.sh) script can be used to build and push the test images used by the conformance and e2e tests. | ||
|
||
Currently this repo tests with Istio and Contour. Please follow | ||
[Test with Istio](#test-with-istio) or [Test with Contour](#test-with-contour). | ||
|
||
### Test with Istio | ||
|
||
#### Prepare test resources such as namespaces | ||
To run the script for all end to end test images: | ||
|
||
```bash | ||
./test/upload-test-images.sh | ||
``` | ||
kubectl apply -f test/config/ | ||
``` | ||
|
||
#### Load tested environment versions | ||
|
||
``` | ||
source ./hack/test-env.sh | ||
``` | ||
## Tests | ||
### Conformance | ||
#### Istio | ||
`./test/kind-conformance-istio.sh` | ||
|
||
#### Install Gateway API CRDs | ||
#### Contour | ||
`./test/kind-conformance-contour.sh` | ||
|
||
``` | ||
kubectl apply -k "github.com/kubernetes-sigs/gateway-api/config/crd?ref=${GATEWAY_API_VERSION}" | ||
``` | ||
### e2e | ||
Calling a script without arguments will create a new cluster in your current GCP project (assuming you have one) and run the tests against it. | ||
|
||
#### Deploy Istio | ||
Calling a script with `--run-tests` and the variable `KO_DOCKER_REPO` set will immediately start the tests against the cluster currently configured for `kubectl`. | ||
|
||
Run the following command to install Istio: | ||
#### All tests | ||
To run conformance tests for all vendors, run: `./test/e2e-tests.sh` | ||
|
||
__NOTE__ You can find the Istio version to be installed in `./hack/test-env.sh`. | ||
|
||
```shell | ||
curl -sL https://istio.io/downloadIstioctl | sh - | ||
$HOME/.istioctl/bin/istioctl install -y | ||
#### Individual tests | ||
To run an individual | ||
```bash | ||
cd test | ||
source e2e-common.sh | ||
test_setup | ||
cd .. | ||
``` | ||
|
||
#### Deploy GatewayClass and Gateway | ||
Then run one of the available tests: | ||
|
||
``` | ||
kubectl apply -f ./third_party/istio/gateway/ | ||
``` | ||
|
||
#### Execute test | ||
|
||
```shell | ||
GATEWAY_OVERRIDE=istio-ingressgateway | ||
GATEWAY_NAMESPACE_OVERRIDE=istio-system | ||
IPS=( $(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}') ) | ||
|
||
go test -v -tags=e2e -count=1 ./test/conformance/ingressv2/ -run "TestIngressConformance/basics" \ | ||
--ingressClass=istio \ | ||
--ingressendpoint="${IPS[0]}" | ||
``` | ||
|
||
Some tests are still not available. Please see | ||
https://github.com/knative-sandbox/net-gateway-api/issues/23. | ||
|
||
### Test with Contoour | ||
|
||
#### Prepare test resources such as namespaces | ||
|
||
``` | ||
kubectl apply -f test/config/ | ||
``` | ||
|
||
#### Load tested environment versions | ||
|
||
``` | ||
source ./hack/test-env.sh | ||
``` | ||
|
||
#### Install Gateway API CRDs | ||
|
||
This step is not necessary for Contour as contour operator installs Gateway API | ||
CRDs. | ||
|
||
#### Deploy Contour | ||
|
||
Run the following command to install Contour and its operator. | ||
|
||
__NOTE__ You can find the Contour version to be installed in `./hack/test-env.sh`. | ||
|
||
```shell | ||
kubectl apply -f "https://raw.githubusercontent.com/projectcontour/contour-operator/${CONTOUR_VERSION}/examples/operator/operator.yaml" | ||
``` | ||
|
||
#### Deploy GatewayClass and Gateway | ||
|
||
``` | ||
ko resolve -f ./third_party/contour/gateway/gateway-external.yaml | \ | ||
sed 's/LoadBalancerService/NodePortService/g' | \ | ||
kubectl apply -f - | ||
ko resolve -f ./third_party/contour/gateway/gateway-internal.yaml | \ | ||
kubectl apply -f - | ||
``` | ||
|
||
#### Execute test | ||
|
||
```shell | ||
GATEWAY_OVERRIDE=envoy | ||
GATEWAY_NAMESPACE_OVERRIDE=contour-external | ||
LOCAL_GATEWAY_OVERRIDE=envoy | ||
LOCAL_GATEWAY_NAMESPACE_OVERRIDE=contour-internal | ||
IPS=( $(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}') ) | ||
|
||
go test -v -tags=e2e -count=1 ./test/conformance/ingressv2/ -run "TestIngressConformance/hosts/basics" \ | ||
--ingressClass=contour \ | ||
--ingressendpoint="${IPS[0]}" | ||
``` | ||
`./test/kind-e2e-istio.sh` | ||
|
||
Some tests are still not available. Please see | ||
https://github.com/knative-sandbox/net-gateway-api/issues/36. | ||
`./test/kind-e2e-contour.sh` |
Oops, something went wrong.