This guide explains how to set up your environment for developing on acs-engine.
- Go 1.6.0 or later
- Glide 0.12.0 or later
- kubectl 1.5 or later
- An Azure account (needed for deploying VMs and Azure infrastructure)
- Git
We welcome contributions. This project has set up some guidelines in order to ensure that (a) code quality remains high, (b) the project remains consistent, and (c) contributions follow the open source legal requirements. Our intent is not to burden contributors, but to build elegant and high-quality open source code so that our users will benefit.
Make sure you have read and understood the main CONTRIBUTING guide:
https://github.com/Azure/acs-engine/blob/master/CONTRIBUTING.md
The code for the acs-engine project is organized as follows:
- The individual programs are located in
cmd/
. Code inside ofcmd/
is not designed for library re-use. - Shared libraries are stored in
pkg/
. - The
tests/
directory contains a number of utility scripts. Most of these are used by the CI/CD pipeline. - The
docs/
folder is used for documentation and examples.
Go dependencies are managed with
Glide and stored in the
vendor/
directory.
We use Git for our version control system. The master
branch is the
home of the current development candidate. Releases are tagged.
We accept changes to the code via GitHub Pull Requests (PRs). One workflow for doing this is as follows:
- Use
go get
to clone the acs-engine repository:go get github.com/Azure/acs-engine
- Fork that repository into your GitHub account
- Add your repository as a remote for
$GOPATH/github.com/Azure/acs-engine
- Create a new working branch (
git checkout -b feat/my-feature
) and do your work on that branch. - When you are ready for us to review, push your branch to GitHub, and then open a new pull request with us.
Third party dependencies reside locally inside the repository under the vendor/
directory. We use glide to enforce our dependency graph, declared in glide.yaml in the project root.
If you wish to introduce a new third party dependency into acs-engine
, please file an issue, and include the canonical VCS path (e.g., github.com/Azure/azure-sdk-for-go
) along with either the desired release string expression to depend on (e.g., ~8.1.0
), or the commit hash to pin to a static commit (e.g., 4cdb38c072b86bf795d2c81de50784d9fdd6eb77
). A project maintainer will then own the effort to update the codebase with that dependency, including relevant updates to glide.yaml
and vendor/
.
As a rule we want to distinguish dependency update PRs from feature/bug PRs; we may ask that feature/bug PRs which include updates to vendor/
and/or contain any other dependency-related overhead to be triaged into separate PRs that can be managed independently, pre-requisite dependency changes in one, and features/bugs in another. The objective of enforcing these distinctions is to help focus the PR review process, and to make manageable the difficult task of rationalizing a multitude of parallel PRs in flight, many of which which may carry hard-to-reconcile dependency side-effects when aggressively updated with a fresh dependency graph as part of the PR payload.
We follow the Go coding style standards very closely. Typically, running
go fmt
will make your code beautiful for you.
We also typically follow the conventions recommended by go lint
and
gometalinter
. Run make test-style
to test the style conformance.
Read more:
- Effective Go introduces formatting.
- The Go Wiki has a great article on formatting.
Unit tests may be run locally via make test
.
End-to-end tests for the DCOS, Kubernetes and OpenShift orchestrators may be run
via make test-{dcos,kubernetes,openshift}
. The test process can optionally
deploy and tear down a cluster as part of the test (this is enabled by default).
You'll need access to an Azure subscription, as well as at least the following
environment variables to be set:
CLIENT_ID
: Azure client IDCLIENT_SECRET
: Azure client secretSUBSCRIPTION_ID
: Azure subscription UUIDTENANT_ID
: Azure tenant UUID
To test the OpenShift orchestrator, you'll need to enable programmatic deployment of the underlying image. In the Azure console, find the image under Home > New > Marketplace > Everything. Click "Want to deploy programmatically? Get started". Enable your subscription and click Save.
You'll also need to have oc
and kubectl
binaries locally in your PATH which
correspond to the cluster version being tested. Download the oc
binary, then
make a symlink or copy of it and name the new file kubectl
.
To have the test process deploy and tear down a cluster, set the following environment variables:
CLUSTER_DEFINITION=examples/openshift.json
DISTRO=openshift39_centos
LOCATION=eastus
Alternatively, to run tests on a pre-deployed OpenShift cluster, set the following environment variables:
CLEANUP_ON_EXIT=false
LOCATION=eastus
NAME=
: dnsPrefix of the pre-deployed cluster
Finally, you'll need to make sure that the apimodel.json corresponding to the
pre-deployed cluster is available at _output/$NAME.json
. If you previously
used acs-engine deploy
directly to deploy the cluster, you will need to run
cp _output/$NAME/apimodel.json _output/$NAME.json
.