|
| 1 | +# AWS Load Balancer Controller Development Guide |
| 2 | + |
| 3 | +We'll walk you through the setup to start contributing to the AWS Load Balancer |
| 4 | +Controller project. No matter if you're contributing code or docs, |
| 5 | +follow the steps below to set up your development environment. |
| 6 | + |
| 7 | +!!! tip "Issue before PR" |
| 8 | + Of course we're happy about code drops via PRs, however, in order to give |
| 9 | + us time to plan ahead and also to avoid disappointment, consider creating |
| 10 | + an issue first and submit a PR later. This also helps us to coordinate |
| 11 | + between different contributors and should in general help keeping everyone |
| 12 | + happy. |
| 13 | + |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Please ensure that you have [properly installed Go][install-go]. |
| 18 | + |
| 19 | +[install-go]: https://golang.org/doc/install |
| 20 | + |
| 21 | +!!! note "Go version" |
| 22 | + We recommend to use a Go version of `1.14` or above for development. |
| 23 | + |
| 24 | +## Fork upstream repository |
| 25 | + |
| 26 | +The first step in setting up your AWS Load Balancer controller development |
| 27 | +environment is to fork the upstream AWS Load Balancer controller repository to your |
| 28 | +personal Github account. |
| 29 | + |
| 30 | + |
| 31 | +## Ensure source code organization directories exist |
| 32 | + |
| 33 | +Make sure in your `$GOPATH/src` that you have directories for the |
| 34 | +`sigs.k8s.io` organization: |
| 35 | + |
| 36 | +```bash |
| 37 | +mkdir -p $GOPATH/src/github.com/sigs.k8s.io |
| 38 | +``` |
| 39 | + |
| 40 | + |
| 41 | +## `git clone` forked repository and add upstream remote |
| 42 | + |
| 43 | +For the forked repository, you will `git clone` the repository into |
| 44 | +the appropriate folder in your `$GOPATH`. Once `git clone`'d, you will want to |
| 45 | +set up a Git remote called "upstream" (remember that "origin" will be pointing |
| 46 | +at your forked repository location in your personal Github space). |
| 47 | + |
| 48 | +You can use this script to do this for you: |
| 49 | + |
| 50 | +```bash |
| 51 | +GITHUB_ID="your GH username" |
| 52 | + |
| 53 | +cd $GOPATH/src/github.com/sigs.k8s.io |
| 54 | +git clone [email protected]: $GITHUB_ID/aws-load-balancer-controller |
| 55 | +cd aws-load-balancer-controller/ |
| 56 | +git remote add upstream [email protected]:kubernetes-sigs/aws-load-balancer-controller |
| 57 | +git fetch --all |
| 58 | + |
| 59 | +``` |
| 60 | + |
| 61 | +## Create your local branch |
| 62 | + |
| 63 | +Next, you create a local branch where you work on your feature or bug fix. |
| 64 | +Let's say you want to enhance the docs, so set `BRANCH_NAME=docs-improve` and |
| 65 | +then: |
| 66 | + |
| 67 | +``` |
| 68 | +git fetch --all && git checkout -b $BRANCH_NAME upstream/main |
| 69 | +``` |
| 70 | + |
| 71 | +## Commit changes |
| 72 | + |
| 73 | +Make your changes locally, commit and push using: |
| 74 | + |
| 75 | +``` |
| 76 | +git commit -a -m "improves the docs a lot" |
| 77 | +
|
| 78 | +git push origin $BRANCH_NAME |
| 79 | +``` |
| 80 | + |
| 81 | +## Create a pull request |
| 82 | + |
| 83 | +Finally, submit a pull request against the upstream source repository. |
| 84 | + |
| 85 | +We monitor the GitHub repo and try to follow up with comments within a working |
| 86 | +day. |
| 87 | + |
| 88 | + |
| 89 | +## Building the controller |
| 90 | + |
| 91 | +To build the controller binary, run the following command. |
| 92 | + |
| 93 | +```bash |
| 94 | +make controller |
| 95 | +``` |
| 96 | + |
| 97 | +To install CRDs into a Kubernetes cluster, run the following command. |
| 98 | + |
| 99 | +```bash |
| 100 | +make install |
| 101 | +``` |
| 102 | + |
| 103 | +To uninstall CRD from a Kubernetes cluster, run the following command. |
| 104 | + |
| 105 | +```bash |
| 106 | +make uninstall |
| 107 | +``` |
| 108 | + |
| 109 | +To build the container image for the controller and push to a container registry, run the following command. |
| 110 | + |
| 111 | +```bash |
| 112 | +make docker-push |
| 113 | +``` |
| 114 | + |
| 115 | +To deploy the CRDs and the container image to a Kubernetes cluster, run the following command. |
| 116 | + |
| 117 | +```bash |
| 118 | +make deploy |
| 119 | +``` |
0 commit comments