Thank you for taking the time out to contribute to AMKO!
This guide will walk you through the process of making your first commit and how to effectively get it merged upstream.
To get started, let's ensure you have completed the following prerequisites for contributing to AMKO:
- Read and observe the code of conduct.
- Sign the CLA.
- Check out the Architecture document for AMKO's architecture.
- Set up necessary accounts.
- Set up your development environment.
Now that you're setup, skip ahead to learn how to contribute.
We welcome contributions from everyone but we can only accept them if you sign our Contributor License Agreement (CLA). If you would like to contribute and you have not signed it, our CLA-bot will walk you through the process when you open a Pull Request. For questions about the CLA process, see the FAQ or submit a question through the GitHub issue tracker.
At minimum, you need the following accounts for effective participation:
- Github: Committing any change requires you to have a github account.
There are multiple ways in which you can contribute, either by contributing code in the form of new features or bug-fixes or non-code contributions like helping with code reviews, triaging of bugs, documentation updates, filing new issues or writing blogs/manuals etc.
Developers work in their own forked copy of the repository and when ready, submit pull requests to have their changes considered and merged into the project's repository.
- Fork your own copy of the repository to your GitHub account by clicking on
Fork
button on AMKO github repository. - Clone the forked repository on your local setup.
Add a remote upstream to track upstream AMKO repository.
git clone https://github.com/$user/global-load-balancing-services-for-kubernetes
Never push to upstream mastergit remote add upstream https://github.com/vmware/global-load-balancing-services-for-kubernetes
git remote set-url --push upstream no_push
- Create a topic branch.
git checkout -b branchName
- Make changes and commit it locally.
git add <modifiedFile> git commit
- Update the "Unreleased" section of the CHANGELOG for any significant change that impacts users.
- Keeping branch in sync with upstream.
git checkout branchName git fetch upstream git rebase upstream/master
- Push local branch to your forked repository.
git push -f $remoteBranchName branchName
- Create a Pull request on GitHub.
Visit your fork at
https://github.com/vmware/global-load-balancing-services-for-kubernetes
and clickCompare & Pull Request
button next to yourremoteBranchName
branch.
Once you have opened a Pull Request (PR), reviewers will be assigned to your PR and they may provide review comments which you need to address. Commit changes made in response to review comments to the same branch on your fork. Once a PR is ready to merge, squash any fix review feedback, typo and merged sorts of commits.
To make it easier for reviewers to review your PR, consider the following:
- Follow the golang coding conventions
- Follow git commit guidelines.
- Follow logging guidelines.
To build the AMKO Docker image together with all AMKO bits, you can simply do:
- Checkout your feature branch.
- Run
make docker
The second step will compile the AMKO code in a golang
container, and build
a photon os
Docker image that includes all the generated binaries. Docker
must be installed on your local machine in advance. Ensure your docker has multi-stage-build
support.
Alternatively, you can build the AMKO code in your local Go environment. The
AMKO uses the Go modules support which was introduced in Go 1.11. It
facilitates dependency tracking and no longer requires projects to live inside
the $GOPATH
.
To develop locally, you can follow these steps:
- Install Go 1.13
- Checkout your feature branch and
cd
into it. - To build all Go files and install, run
make build
- To run all Go unit tests, run
make test
AMKO can be tested from your laptop. Assuming that you have setup the following:
- At least one Avi Controller with GSLB setup.
- Created a multi-cluster kubeconfig file.
- Deployed AKO on member clusters.
Please follow the instructions to start AMKO:
-
Set the following environment variables:
export KUBECONFIG="/path/to/kubeconfig" export GSLB_CONFIG=`cat /path/to/multi-cluster-kube-config`
-
Run
./bin/amko
You can control additional settings by exporting respective variables from inside the deployment file.
AMKO uses Jenkins pipelines currently to run a set of tests. All tests are presently hosted inside VMware internal network:
- PR builder jobs, that run
make test
. Without this passing, you can't get the PR to merge. - Daily smoke tests.
- Nightly Functional Test suites that runs AMKO tests using a real controller/kubernetes/openshift setup.
- Create a branch in your forked repo
git checkout -b revertName
- Sync the branch with upstream
git fetch upstream git rebase upstream/master
- Create a revert based on the SHA of the commit.
git revert SHA
- Push this new commit.
git push $remoteRevertName revertName
- Create a Pull Request on GitHub.
Visit your fork at
https://github.com/avinetworks/ako
and clickCompare & Pull Request
button next to yourremoteRevertName
branch.