Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Latest commit

 

History

History
138 lines (98 loc) · 4.15 KB

DEVELOPMENT.md

File metadata and controls

138 lines (98 loc) · 4.15 KB

Development

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.

Getting started

  1. Setup Knative Serving
  2. Setup Knative Eventing
  3. Create and checkout a repo fork

Once you meet these requirements, you can install sources!

Before submitting a PR, see also CONTRIBUTING.md.

Requirements

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.

Checkout your fork

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:

  1. Create your own fork of this repo
  2. Clone it to your machine:
mkdir -p ${GOPATH}/src/knative.dev
cd ${GOPATH}/src/knative.dev
git clone git@github.com:${YOUR_GITHUB_USERNAME}/eventing-contrib.git
cd eventing-contrib
git remote add upstream git@github.com: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.

Installing Sources

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.

Iterating

As you make changes to the code-base:

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.

Tests

Running tests as you make changes to the code-base is pretty simple. See the test docs.

Clean up

You can delete Knative Sources with:

ko delete -f <source_name>/config/