This doc explains how to setup a development environment so you can get started contributing to Knative Eventing. Also take a look at the development workflow and the test docs.
Once you meet these requirements, you can install sources!
Before submitting a PR, see also CONTRIBUTING.md.
You must have the core of Knative Serving running on your cluster.
You must have Knative Eventing running on your cluster.
You must have ko installed.
The Go tools require that you clone the repository to the
src/knative.dev/eventing-contrib
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}/eventing-contrib.git
cd eventing-contrib
git remote add upstream [email protected]:knative/eventing-contrib.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 follows.
Once you've setup your development environment, install any of the sources Github Source, AWS SQS Source, Camel Source, Kafka Source with:
ko apply -f <source_name>/config # e.g. github/config
These commands are idempotent, so you can run them at any time to update your deployment.
If you applied the GitHub Source, you can see things running with:
$ kubectl -n knative-sources get pods
NAME READY STATUS RESTARTS AGE
github-controller-manager-0 1/1 Running 0 2h
You can access the Github eventing manager's logs with:
kubectl -n knative-sources logs \
$(kubectl \
-n knative-sources \
get pods \
-l control-plane=github-controller-manager \
-o name \
)
See camel/source/samples/README.md, kafka/source/README.md for instructions on installing the Camel Source and Kafka Source.
As you make changes to the code-base:
- If you change a package's deps (including adding external dep), then you
must run
./hack/update-deps.sh
. - If you change a type definition (<source_name>/pkg/apis/), then you must
run
./hack/update-codegen.sh
. This also runs./hack/update-deps.sh
.
These are both idempotent, and we expect that running these in the master
branch to produce no diffs.
To verify that your generated code is correct with the new type definition you
can run ./hack/verify-codegen.sh
. On OSX you will
need GNU diff
version 3.7 that you can install from brew
with
brew install diffutils
.
To check that the build and tests passes please see the test
documentation or simply run
./test/presubmit-tests.sh
.
Once the codegen and dependency information is correct, redeploy using the same
ko apply
command you used Installing a Source.
Or you can clean it up completely and start again.
Running tests as you make changes to the code-base is pretty simple. See the test docs.
You can delete Knative Sources
with:
ko delete -f <source_name>/config/