-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Project Layout and Refactor Controller Package #357
Conversation
Following this common approach https://github.com/golang-standards/project-layout
If |
c5a1388
to
39b1338
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting to fix CI stages
CI fixed, build is fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments. Additionally,
Also, please update links to nginx-controller
folder in the following files:
- examples/customization/README.md in
log-format
andstream-log-format
cm keys - build.README.md. , ... in
of your license are located in the
nginx-controllerfolder:
The keys must be placed inkubernetes-ingress
now.
The helm-chart related files must be updated according with the new project layout:
- Chart.yaml: Update
https://github.com/nginxinc/kubernetes-ingress/tree/master/helm-chart
The install folder is not completely removed.
The code refactoring brought a lot of public uncommented method, so we now get linter warnings.
.gitignore
Outdated
osx-nginx-plus-ingress | ||
nginx-plus-ingress | ||
nginx-controller/nginx-controller | ||
cmd/nginx-ic/nginx-ic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is needed as it is the binary produced from go build
, but it should be nginx-ingress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that the following lines cover that:
nginx-ingress
!nginx-ingress/
CONTRIBUTING.md
Outdated
* The main code resides under `/nginx-controller` | ||
* The project dependencies reside in the `/vendor`. We use [dep](https://github.com/golang/dep) for managing dependencies. | ||
* The project follows a standard Go project layout | ||
* The main code is found at `cmd/nginx-ic/` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the actual folder is cmd/nginx-ingress/
Makefile
Outdated
@@ -46,3 +49,4 @@ endif | |||
|
|||
clean: | |||
rm -f nginx-ingress | |||
rm $(DOCKERFILE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When make is called with DOCKERFILE=DockerfileForPlus
, DockerfileForPlus is copied to /
. As a result, make clean
must also be called with DOCKERFILE=DockerfileForPlus
. Perhaps we can copy DockerfileForPlus
or any other as Dockerfile
?
@@ -71,7 +71,7 @@ NGINX Plus provides you with [advanced statistics](https://www.nginx.com/product | |||
* **JWTs** NGINX Plus can validate JSON Web Tokens (JWTs), providing a flexible authentication mechanism. | |||
* **Support** Support from NGINX Inc is available for NGINX Plus Ingress controller. | |||
|
|||
**Note**: Deployment of the Ingress controller for NGINX Plus requires you to do one extra step: build your own [Docker image](nginx-controller) using the certificate and key for your subscription. | |||
**Note**: Deployment of the Ingress controller for NGINX Plus requires you to do one extra step: build your own [Docker image](build) using the certificate and key for your subscription. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also update 2 links for the edge version for build your own image in the NGINX Ingress Controller Releases section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
links to the Helm chart as well in the same section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and a link to manifests in the same section
@@ -6,7 +6,7 @@ RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \ | |||
&& ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ | |||
&& ln -sf /proc/1/fd/2 /var/log/nginx/error.log | |||
|
|||
COPY nginx-ingress nginx/templates/nginx.ingress.tmpl nginx/templates/nginx.tmpl / | |||
COPY nginx-ingress internal/nginx/templates/nginx.ingress.tmpl internal/nginx/templates/nginx.tmpl / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DockerfileForAlpine and DockerfileForPlus require a similar update
build/README.md
Outdated
``` | ||
$ git clone https://github.com/nginxinc/kubernetes-ingress/ | ||
$ cd kubernetes-ingress/nginx-controller | ||
``` | ||
|
||
1. If you're using a stable release, check out the corresponding tag. For release 1.3.0, run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest removing this paragraph completely, cause it will check out the old structure
Makefile
Outdated
@@ -4,22 +4,24 @@ VERSION = edge | |||
TAG = $(VERSION) | |||
PREFIX = nginx/nginx-ingress | |||
|
|||
DOCKER_RUN = docker run --rm -v $(shell pwd)/../:/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress/nginx-controller/ | |||
DOCKER_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will DOCKER_TEST_RUN
make more sense as a name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not going to change this in this PR
@@ -10,7 +10,7 @@ This chart deploys the NGINX Ingress controller in your Kubernetes cluster. | |||
- Helm 2.8.x+. | |||
- Git. | |||
- If you’d like to use NGINX Plus: | |||
- Build an Ingress controller image with NGINX Plus and push it to your private registry by following the instructions from [here](../nginx-controller/README.md). | |||
- Build an Ingress controller image with NGINX Plus and push it to your private registry by following the instructions from [here](../../build/README.md). | |||
- Update the `controller.image.repository` field of the `values-plus.yaml` accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also remove If you're using a stable release, check out the corresponding tag. For release 1.3.0
paragraph.
Also, update Change your working directory to /helm-chart
, cd kubernetes-ingress/helm-chart
x2
docs/installation.md
Outdated
@@ -5,7 +5,7 @@ | |||
Make sure you have access to the Ingress controller image: | |||
|
|||
* For NGINX Ingress controller, use the image `nginx/nginx-ingress` from [DockerHub](https://hub.docker.com/r/nginx/nginx-ingress/). | |||
* For NGINX Plus Ingress controller, build your own image and push it to your private Docker registry by following the instructions from [here](../nginx-controller). | |||
* For NGINX Plus Ingress controller, build your own image and push it to your private Docker registry by following the instructions from [here](../build/README.md). | |||
|
|||
The installation manifests are located in the [install](../install) folder. In the steps below we assume that you will be running the commands from that folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename install to deployments
- Addresses all `golint` warnings including ones not caused by this PR - Moves install files to correct place - Updates docs with old references before structure - Fixes broken links (not caused by this PR) - Updates COPY command in other Dockerfiles
c44de2d
to
f12960e
Compare
Proposed changes
After the project restructure PR (this branch is branches from that one), this PR then pulls apart some of the complexity in the load balancer controller. Extracts handlers and builds them separately.
Checklist
Before creating a PR, run through this checklist and mark each as complete.