Skip to content

Commit

Permalink
Merge changes from upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
rnburn committed Oct 24, 2017
2 parents dcfb059 + 280ec72 commit c26af26
Show file tree
Hide file tree
Showing 1,185 changed files with 289,680 additions and 14,341 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ Session.vim
# coverage artifacts
.coverprofile
/gover.coverprofile

e2e-tests
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ go:

go_import_path: k8s.io/ingress-nginx

env:
global:
- CHANGE_MINIKUBE_NONE_USER=true
- KUBERNETES_VERSION=v1.7.5
- DOCKER=docker

jobs:
include:
- stage: Static Check
Expand All @@ -25,3 +31,9 @@ jobs:
- go get github.com/modocache/gover
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- make cover
- stage: e2e
before_script:
- make e2e-image
- test/e2e/up.sh
script:
- make e2e-test
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Follow either of the two links above to access the appropriate CLA and instructi

## Finding Things That Need Help

If you're new to the project and want to help, but don't know where to start, we have a semi-curated list of issues that should not need deep knowledge of the system. [Have a look and see if anything sounds interesting](https://github.com/kubernetes/ingress/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22help+wanted%22). Alternatively, read some of the docs on other controllers and try to write your own, file and fix any/all issues that come up, including gaps in documentation!
If you're new to the project and want to help, but don't know where to start, we have a semi-curated list of issues that should not need deep knowledge of the system. [Have a look and see if anything sounds interesting](https://github.com/kubernetes/ingress-nginx/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22help+wanted%22). Alternatively, read some of the docs on other controllers and try to write your own, file and fix any/all issues that come up, including gaps in documentation!

## Contributing a Patch

1. If you haven't already done so, sign a Contributor License Agreement (see details above).
1. Read the [Ingress development guide](docs/dev/README.md).
1. Read the [Ingress development guide](docs/development.md).
1. Fork the desired repo, develop and test your code changes.
1. Submit a pull request.

Expand Down
134 changes: 89 additions & 45 deletions Gopkg.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

[[constraint]]
name = "github.com/imdario/mergo"
version = "0.2.2"
version = "0.2.4"

[[constraint]]
branch = "master"
Expand Down Expand Up @@ -91,20 +91,20 @@

[[constraint]]
branch = "master"
name = "k8s.io/api"
name = "k8s.io/apiserver"

[[constraint]]
branch = "master"
name = "k8s.io/apimachinery"
name = "k8s.io/api"
revision = "409c3b2393cd3359f275bd8b883b4d9c5aec41f6"

[[constraint]]
branch = "master"
name = "k8s.io/apiserver"
name = "k8s.io/apimachinery"
revision = "e9a29eff7d472df0f7da9ead5ab59b74e74a07ec"

[[constraint]]
branch = "master"
name = "k8s.io/client-go"
revision = "076e344c86e52f088b78615f815b245f6d613537"

[[constraint]]
name = "k8s.io/kubernetes"
version = "1.8.0"
revision = "88975e98d6f4a84929a243abeb772de16399a4e9"
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

all: push

BUILDTAGS=
Expand Down Expand Up @@ -35,7 +49,7 @@ IMAGE = $(REGISTRY)/$(IMGNAME)
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)

# Set default base image dynamically for each arch
BASEIMAGE?=gcr.io/google_containers/nginx-slim-$(ARCH):0.26
BASEIMAGE?=gcr.io/google_containers/nginx-slim-$(ARCH):0.27

ifeq ($(ARCH),arm)
QEMUARCH=arm
Expand Down Expand Up @@ -116,15 +130,23 @@ fmt:

lint:
@echo "+ $@"
@go list -f '{{if len .TestGoFiles}}"golint {{.Dir}}/..."{{end}}' $(shell go list ${PKG}/... | grep -v vendor) | xargs -L 1 sh -c
@go list -f '{{if len .TestGoFiles}}"golint {{.Dir}}/..."{{end}}' $(shell go list ${PKG}/... | grep -v vendor | grep -v '/test/e2e') | xargs -L 1 sh -c

test: fmt lint vet
@echo "+ $@"
@go test -v -race -tags "$(BUILDTAGS) cgo" $(shell go list ${PKG}/... | grep -v vendor)
@go test -v -race -tags "$(BUILDTAGS) cgo" $(shell go list ${PKG}/... | grep -v vendor | grep -v '/test/e2e')

e2e-image: sub-container-amd64
TAG=$(TAG) IMAGE=$(MULTI_ARCH_IMG) docker tag $(IMAGE):$(TAG) $(IMAGE):test
docker images

e2e-test:
@go test -o e2e-tests -c ./test/e2e
@KUBECONFIG=${HOME}/.kube/config INGRESSNGINXCONFIG=${HOME}/.kube/config ./e2e-tests

cover:
@echo "+ $@"
@go list -f '{{if len .TestGoFiles}}"go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"{{end}}' $(shell go list ${PKG}/... | grep -v vendor) | xargs -L 1 sh -c
@go list -f '{{if len .TestGoFiles}}"go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"{{end}}' $(shell go list ${PKG}/... | grep -v vendor | grep -v '/test/e2e') | xargs -L 1 sh -c
gover
goveralls -coverprofile=gover.coverprofile -service travis-ci -repotoken ${COVERALLS_TOKEN}

Expand All @@ -135,8 +157,12 @@ vet:
release: all-container all-push
echo "done"

.PHONY: docker-build
.PHONY: docker-build
docker-build: all-container

.PHONY: docker-push
docker-push: all-push
.PHONY: docker-push
docker-push: all-push

.PHONY: check_dead_links
check_dead_links:
docker run -t -v $$PWD:/tmp rubygem/awesome_bot --allow-dupe --allow-redirect $(shell find $$PWD -name "*.md" -mindepth 1 -printf '%P\n' | grep -v vendor | grep -v Changelog.md)
18 changes: 9 additions & 9 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ This setup requires to choose in which layer (L4 or L7) we want to configure the
For L4:

```console
kubectl apply -f provider/aws/service-l4.yaml
kubectl apply -f provider/aws/patch-configmap-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/service-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l4.yaml
```

For L7:
Expand All @@ -85,7 +85,7 @@ Then execute:

```console
kubectl apply -f provider/aws/service-l7.yaml
kubectl apply -f provider/aws/patch-configmap-l7.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/aws/patch-configmap-l7.yaml
```

This example creates an ELB with just two listeners, one in port 80 and another in port 443
Expand All @@ -95,13 +95,13 @@ This example creates an ELB with just two listeners, one in port 80 and another
If the ingress controller uses RBAC run:

```console
kubectl apply -f provider/patch-service-with-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-with-rbac.yaml
```

If not run:

```console
kubectl apply -f provider/patch-service-without-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-without-rbac.yaml
```

### GCE - GKE
Expand All @@ -114,13 +114,13 @@ curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/pr
If the ingress controller uses RBAC run:

```console
kubectl apply -f provider/patch-service-with-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-with-rbac.yaml
```

If not run:

```console
kubectl apply -f provider/patch-service-without-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-without-rbac.yaml
```

**Important Note:** proxy protocol is not supported in GCE/GKE
Expand All @@ -135,13 +135,13 @@ curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/pr
If the ingress controller uses RBAC run:

```console
kubectl apply -f provider/patch-service-with-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-with-rbac.yaml
```

If not run:

```console
kubectl apply -f provider/patch-service-without-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/patch-service-without-rbac.yaml
```

**Important Note:** proxy protocol is not supported in GCE/GKE
Expand Down
2 changes: 1 addition & 1 deletion deploy/provider/azure/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
targetPort: http
- name: https
port: 443
targetPort: http
targetPort: https
10 changes: 9 additions & 1 deletion docs/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@ Key:
| `base-url-scheme` | Specify the scheme of the `<base>` tags. | | nginx
| `preserve-host` | Whether to pass the client request host (`true`) or the origin hostname (`false`) in the HTTP Host field. | | trafficserver

## CORS Related
| Name | Meaning | Default | Controller
| --- | --- | --- | --- |
| `enable-cors` | Enable CORS headers in response. | false | nginx, voyager
| `cors-allow-origin` | Specifies the Origin allowed in CORS (Access-Control-Allow-Origin) | * | nginx
| `cors-allow-headers` | Specifies the Headers allowed in CORS (Access-Control-Allow-Headers) | DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization | nginx
| `cors-allow-methods` | Specifies the Methods allowed in CORS (Access-Control-Allow-Methods) | GET, PUT, POST, DELETE, PATCH, OPTIONS | nginx
| `cors-allow-credentials` | Specifies the Access-Control-Allow-Credentials | true | nginx

## Miscellaneous

| Name | Meaning | Default | Controller
| --- | --- | --- | --- |
| `configuration-snippet` | Arbitrary text to put in the generated configuration file. | | nginx
| `enable-cors` | Enable CORS headers in response. | | nginx, voyager
| `limit-connections` | Limit concurrent connections per IP address[1]. | | nginx, voyager
| `limit-rps` | Limit requests per second per IP address[1]. | | nginx, voyager
| `limit-rpm` | Limit requests per minute per IP address. | | nginx, voyager
Expand Down
126 changes: 126 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Getting Started

This document explains how to get started with developing for NGINX Ingress controller.
It includes how to build, test, and release ingress controllers.

## Dependencies

The build uses dependencies in the `vendor` directory, which
must be installed before building a binary/image. Occasionally, you
might need to update the dependencies.

This guide requires you to install the [dep](https://github.com/golang/dep) dependency tool.

Check the version of `dep` you are using and make sure it is up to date.

```console
$ dep version
dep:
version : devel
build date :
git hash :
go version : go1.9
go compiler : gc
platform : linux/amd64
```

If you have an older version of `dep`, you can update it as follows:

```console
$ go get -u github.com/golang/dep
```

This will automatically save the dependencies to the `vendor/` directory.

```console
$ cd $GOPATH/src/ingress-nginx
$ dep ensure
$ dep ensure -update
$ dep prune
```

## Building

All ingress controllers are built through a Makefile. Depending on your
requirements you can build a raw server binary, a local container image,
or push an image to a remote repository.

In order to use your local Docker, you may need to set the following environment variables:

```console
# "gcloud docker" (default) or "docker"
$ export DOCKER=<docker>

# "gcr.io/google_containers" (default), "index.docker.io", or your own registry
$ export REGISTRY=<your-docker-registry>
```

To find the registry simply run: `docker system info | grep Registry`

### Nginx Controller

Build a raw server binary
```console
$ make build
```

[TODO](https://github.com/kubernetes/ingress-nginx/issues/387): add more specific instructions needed for raw server binary.

Build a local container image

```console
$ make docker-build TAG=<tag> PREFIX=$USER/ingress-controller
```

Push the container image to a remote repository

```console
$ make docker-push TAG=<tag> PREFIX=$USER/ingress-controller
```

## Deploying

There are several ways to deploy the ingress controller onto a cluster.
Please check the [deployment guide](../deploy/README.md)

## Testing

To run unit-tests, just run

```console
$ cd $GOPATH/src/k8s.io/ingress-nginx
$ make test
```

If you have access to a Kubernetes cluster, you can also run e2e tests using ginkgo.

```console
$ cd $GOPATH/src/k8s.io/ingress-nginx
$ make e2e-test
```

## Releasing

All Makefiles will produce a release binary, as shown above. To publish this
to a wider Kubernetes user base, push the image to a container registry, like
[gcr.io](https://cloud.google.com/container-registry/). All release images are hosted under `gcr.io/google_containers` and
tagged according to a [semver](http://semver.org/) scheme.

An example release might look like:
```
$ make release
```

Please follow these guidelines to cut a release:

* Update the [release](https://help.github.com/articles/creating-releases/)
page with a short description of the major changes that correspond to a given
image tag.
* Cut a release branch, if appropriate. Release branches follow the format of
`controller-release-version`. Typically, pre-releases are cut from HEAD.
All major feature work is done in HEAD. Specific bug fixes are
cherry-picked into a release branch.
* If you're not confident about the stability of the code,
[tag](https://help.github.com/articles/working-with-tags/) it as alpha or beta.
Typically, a release branch should have stable code.

Loading

0 comments on commit c26af26

Please sign in to comment.