This doc explains how to setup a development environment so you can get started
contributing to Knative
net-gateway-api
. Also take a look at:
- Create a GitHub account
- Setup GitHub access via SSH
- Install requirements
- Set up your shell environment
- Create and checkout a repo fork
Before submitting a PR, see also CONTRIBUTING.md.
You must install these tools:
go
: The language Knativenet-gateway-api
is built ingit
: For source controldep
: For managing external dependencies.
To get started you'll need to set these environment variables (we recommend
adding them to your .bashrc
):
-
GOPATH
: If you don't have one, simply pick a directory and addexport GOPATH=...
-
$GOPATH/bin
onPATH
: This is so that tooling installed viago get
will work properly.
.bashrc
example:
export GOPATH="$HOME/go"
export PATH="${PATH}:${GOPATH}/bin"
The Go tools require that you clone the repository to the
src/knative.dev/net-gateway-api
directory in your
GOPATH
.
To check out this repository:
-
Create your own fork of this repo
-
Clone it to your machine:
mkdir -p ${GOPATH}/src/knative.dev
cd ${GOPATH}/src/knative.dev
git clone [email protected]:${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
Adding the upstream
remote sets you up nicely for regularly
syncing your fork.
Once you reach this point you are ready to do a full build and deploy as described below.
Currently this repo tests with Istio and Contour. Please follow Test with Istio or Test with Contour.
kubectl apply -f test/config/
source ./hack/test-env.sh
kubectl apply -f config/100-gateway-api.yaml
Run the following command to install Istio:
NOTE You can find the Istio version to be installed in ./hack/test-env.sh
.
curl -sL https://istio.io/downloadIstioctl | sh -
$HOME/.istioctl/bin/istioctl install -y
kubectl apply -f ./third_party/istio/gateway/
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 knative-extensions#23.
kubectl apply -f test/config/
source ./hack/test-env.sh
This step is not necessary for Contour as contour operator installs Gateway API CRDs.
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
.
kubectl apply -f "https://raw.githubusercontent.com/projectcontour/contour-operator/${CONTOUR_VERSION}/examples/operator/operator.yaml"
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 -
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]}"
Some tests are still not available. Please see knative-extensions#36.