Skip to content
Permalink
Browse files

Introducing Heptio Contour

Contour is an Ingress controller for Kubernetes that works by deploying
the Envoy proxy as a reverse proxy and load balancer.

Signed-off-by: Dave Cheney <dave@cheney.net>
  • Loading branch information...
davecheney committed Oct 30, 2017
0 parents commit 788feabc67c4da76cd1ae3c9ac1998b43cb0e2f3
Showing with 5,144 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +36 −0 CODE_OF_CONDUCT.md
  3. +180 −0 CONTRIBUTING.md
  4. +14 −0 Dockerfile
  5. +299 −0 Gopkg.lock
  6. +27 −0 Gopkg.toml
  7. +128 −0 README.md
  8. +5 −0 SUPPORT.md
  9. +150 −0 cmd/contour/contour.go
  10. +11 −0 deployment/common/common.yaml
  11. +3 −0 deployment/common/gen-warning.yaml
  12. +52 −0 deployment/common/rbac.yaml
  13. +16 −0 deployment/common/service.yaml
  14. +11 −0 deployment/deployment-json-v1/01-common.yaml
  15. +60 −0 deployment/deployment-json-v1/02-contour.yaml
  16. +52 −0 deployment/deployment-json-v1/02-rbac.yaml
  17. +16 −0 deployment/deployment-json-v1/02-service.yaml
  18. +11 −0 deployment/ds-hostnet/01-common.yaml
  19. +54 −0 deployment/ds-hostnet/02-contour.yaml
  20. +52 −0 deployment/ds-hostnet/02-rbac.yaml
  21. +11 −0 deployment/ds-json-v1/01-common.yaml
  22. +50 −0 deployment/ds-json-v1/02-contour.yaml
  23. +52 −0 deployment/ds-json-v1/02-rbac.yaml
  24. +16 −0 deployment/ds-json-v1/02-service.yaml
  25. +47 −0 deployment/example-workload/kuard.yaml
  26. +7 −0 deployment/render.sh
  27. +80 −0 deployment/render/daemonset-norbac.yaml
  28. +132 −0 deployment/render/daemonset-rbac.yaml
  29. +90 −0 deployment/render/deployment-norbac.yaml
  30. +142 −0 deployment/render/deployment-rbac.yaml
  31. +107 −0 design/api-design.md
  32. +16 −0 design/roadmap.md
  33. +11 −0 docs/README.md
  34. +61 −0 docs/about.md
  35. +22 −0 docs/architecture.md
  36. BIN docs/deploy-aws-nlb-img/configure-asg.png
  37. BIN docs/deploy-aws-nlb-img/nlb-create.png
  38. BIN docs/deploy-aws-nlb-img/security-group.png
  39. BIN docs/deploy-aws-nlb-img/step-1-az.png
  40. BIN docs/deploy-aws-nlb-img/step-2-routing.png
  41. +97 −0 docs/deploy-aws-nlb.md
  42. +118 −0 docs/deploy-options.md
  43. +21 −0 docs/tagging.md
  44. +152 −0 internal/contour/cache.go
  45. +90 −0 internal/contour/cds.go
  46. +241 −0 internal/contour/cds_test.go
  47. +79 −0 internal/contour/grpc.go
  48. +70 −0 internal/contour/grpc_test.go
  49. +185 −0 internal/contour/json.go
  50. +373 −0 internal/contour/json_test.go
  51. +129 −0 internal/contour/rds.go
  52. +398 −0 internal/contour/rds_test.go
  53. +64 −0 internal/contour/sds.go
  54. +136 −0 internal/contour/sds_test.go
  55. +158 −0 internal/envoy/config.go
  56. +157 −0 internal/envoy/config_test.go
  57. +251 −0 internal/envoy/types.go
  58. +194 −0 internal/k8s/adapter.go
  59. +42 −0 internal/log/log.go
  60. +82 −0 internal/log/stdlog/stdlog.go
  61. +23 −0 internal/log/stdlog/stdlog_test.go
  62. +61 −0 internal/workgroup/group.go
@@ -0,0 +1,2 @@
*.swp
*.swo
@@ -0,0 +1,36 @@
# Heptio Community Code of Conduct

## Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering
an open and welcoming community, we pledge to respect all people who contribute
through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are not
aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers
commit themselves to fairly and consistently applying these principles to every aspect
of managing this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer(s).

This Code of Conduct is adapted from the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md) and [Contributor Covenant](http://contributor-covenant.org/version/1/2/0/), version 1.2.0.
@@ -0,0 +1,180 @@
# Contributing

Thanks for taking the time to join our community and start contributing.
These guidelines will help you get started with the Contour project.
Please note that we require [DCO signoff](#dco-sign-off).

## Building from source

This section describes how to build Contour from source.

### Prerequisites

1. *Install Go*

Contour requires [Go 1.9][1] or later. We also assume that you're familar with Go's [`GOPATH` workspace][3] convention, and have the appropriate environment variables set.

2. *Install `dep`*

Contour uses [`dep`][2] for dependency management. `dep` is a fast moving project so even if you have installed it previously, it's a good idea to update to the latest version using the `go get -u` flag.

```
go get -u github.com/golang/dep/cmd/dep
```

### Fetch the source

Contour uses `dep`[2] for dependency management, but to reduce the size of the repository, it does not currently include a copy of its dependencies. This might change in the future, but for now use the following command to fetch the source for Contour and its dependencies.

```
go get -d github.com/heptio/contour
cd $GOPATH/src/heptio/contour
dep ensure -vendor-only
```

Go is very particular when it comes to the location of the source code in your `$GOPATH`. The easiest way to make the `go` tool happy is to rename Heptio's remote location to something else, and substitute your fork for `origin`. For example, to set `origin` to your fork, run this command subtituting your GitHub username where apprpriate.

```
git remote rename origin upstream
git remote add origin git@github.com:davecheney/contour.git
```

This ensures that the source code on disk remains at `$GOPATH/src/github.com/heptio/contour` while the remote repository is configured for your fork.

The remainder of this document assumes your terminal's working directory is `$GOPATH/src/github.com/heptio/contour`.

### Building

To build Contour, run:

```
go build ./cmd/contour
```

This assumes your working directory is set to `$GOPATH/src/github.com/heptio/contour`. If you're somewhere else in the filesystem you can instead run:

```
go build github.com/heptio/contour/cmd/contour
```

This produces a `contour` binary in your current working directory.

_TIP_: You may prefer to use `go install` rather than `go build` to cache build artifacts and reduce future compile times. In this case the binary is placed in `$GOPATH/bin/contour`.

### Running the unit tests

Once you have Contour building, you can run all the unit tests for the project:

```
go test ./...
```

This assumes your working directory is set to `$GOPATH/src/github.com/heptio/contour`.
If you're working from a different directory, you can instead run:

```
go test github.com/heptio/contour/...
```

To run the tests for a single package, change to package directory and run:

```
go test .
```

_TIP_: If you are running the tests often, you can run `go test -i github.com/heptio/contour/...` occasionally to reduce test compilation times.

## Contribution workflow

This section describes the process for contributing a bugfix or new feature. It follows from the previous section, so if you haven't set up your Go workspace and built Contour from source, do that first.

### Before you submit a pull request

This project operates according to the _talk, then code_ rule. If you plan to submit a pull request for anything more than a typo or obvious bug fix you _should_ first [raise an issue][6] to discuss your proposal, before you submit any code.

### Pre commit CI

Before a change is submitted it should pass all the pre commit CI jobs. If there are unrelated test failures the change can be merged if you provide a reference to an issue that tracks the test failure.

Once a change lands in master it will be built and available at this tag, `gcr.io/heptio-images/contour:master`. You can read more about the available contour images in the [tagging][7] document.

### Build an image

To build an image of your change using Contour's `Dockerfile`, run these commands (replacing the repository host and tag with your own):

```
docker build -t docker.io/davecheney/contour:latest .
docker push docker.io/davecheney/contour:latest
```

### Verify your change

To verify your change by deploying the image you built, take one of the [deployment manifests][7], edit it to point to your new image, and deploy to your Kubernetes cluster.

## DCO Sign off

All authors to the project retain copyright to their work. However, to ensure
that they are only submitting work that they have rights to, we are requiring
everyone to acknowldge this by signing their work.

Any copyright notices in this repository should specify the authors as "The
project authors".

To sign your work, just add a line like this at the end of your commit message:

```
Signed-off-by: Joe Beda <joe@heptio.com>
```

This can easily be done with the `--signoff` option to `git commit`.

By doing this you state that you can certify the following (from https://developercertificate.org/):

```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```

[1]: https://golang.org/dl/
[2]: https://github.com/golang/dep
[3]: https://golang.org/doc/code.html
[4]: https://golang.org/pkg/testing/
[5]: https://developercertificate.org/
[6]: https://github.com/heptio/contour/issues
[6]: docs/tagging.md
[7]: docs/deploy-options.md
@@ -0,0 +1,14 @@
FROM golang:1.9
WORKDIR /go/src/github.com/heptio/contour

RUN go get github.com/golang/dep/cmd/dep
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure -v -vendor-only

COPY cmd cmd
COPY internal internal
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-w -s" -v github.com/heptio/contour/cmd/contour

FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=0 /go/bin/contour /bin/contour

0 comments on commit 788feab

Please sign in to comment.
You can’t perform that action at this time.