|
1 |
| -# ACSEngine - Template generator |
| 1 | +# Azure Container Service ARM Template Generator |
2 | 2 |
|
3 |
| -Template generator builds a custom template based on user requirements. Examples exist under clusterdefinitions folder. |
| 3 | +## Overview |
4 | 4 |
|
5 |
| -# Building the Application |
| 5 | +`acs-engine` is a tool that produces ARM (Azure Resource Manager) templates for deploying various container orchestrators into Azure. |
| 6 | +The input to the tool is a cluster definition. The cluster definition is very similar to (in many cases the same as) the ARM template |
| 7 | +syntax used to deploy an Azure Container Service cluster. |
6 | 8 |
|
7 |
| -To build the application: |
| 9 | +## Development (Docker) |
8 | 10 |
|
9 |
| -1. set $GOPATH (example c:\gopath) |
10 |
| - (under Windows `SET GOPATH=c:\gopath`) |
11 |
| -2. `go get gopkg.in/yaml.v2` |
12 |
| -3. `go get github.com/ghodss/yaml` |
13 |
| -4. `cd $GOPATH/github.com/Azure/acs-engine` |
14 |
| -5. `go build` to produce the acsengine binary |
| 11 | +The easiest way to get started developing on `acs-engine` is to use Docker. |
| 12 | +If you already have Docker or "Docker for {Windows,Mac}" then you can get started |
| 13 | +without needing to install anything extra. |
15 | 14 |
|
16 |
| -# Developer Instructions |
| 15 | +* Windows (PowerShell): `.\scripts\devenv.ps1` |
| 16 | +* Linux (bash): `.\scripts\devenv.sh` |
17 | 17 |
|
18 |
| -If you want to develop and submit changes, follow these additional steps: |
| 18 | +This setup mounts the `acs-engine` source directory as a volume into the Docker container. |
| 19 | +This means that you can edit your source code normally in your favorite editor on your |
| 20 | +machine, while still being able to compile and test inside of the Docker container (the |
| 21 | +same environment used in our Continuous Integration system). |
19 | 22 |
|
20 |
| -1. Add $GOPATH\bin to your path |
21 |
| - (under Windows `SET PATH=%PATH%;%GOPATH%\bin`) |
22 |
| -2. `go get -u github.com/jteeuwen/go-bindata` |
| 23 | +[Here's a quick demo video showing the dev/build/test cycle with this setup.](https://www.youtube.com/watch?v=lc6UZmqxQMs) |
23 | 24 |
|
24 |
| -Then everytime you adjust content in parts directory: |
| 25 | +## Development (Native) |
25 | 26 |
|
26 |
| -1. `cd $GOPATH/github.com/Azure/acs-engine/pkg/acsengine` |
27 |
| -2. `go generate` to generate source files needed |
28 |
| -3. `cd $GOPATH/github.com/Azure/acs-engine` |
29 |
| -4. `go build` to produce the acsengine binary |
| 27 | +### Requirements |
| 28 | +- PowerShell (Windows) |
| 29 | +- `bash` + `make` (Linux) |
| 30 | +- `git` |
| 31 | +- `go` (with a properly configured GOPATH) |
30 | 32 |
|
31 |
| -# Generating a Template |
| 33 | +### Building (Linux) |
32 | 34 |
|
33 |
| -Once build run the generator with the command ```./acsengine |
34 |
| -CLUSTER_DEFINITION_FILE``` where ```CLUSTER_DEFINITION_FILE``` is the |
35 |
| -path to the cluster definition you want to use. The application |
36 |
| -outputs therequired ARM template. This can be piped to a file for |
37 |
| -later use (see below). |
| 35 | +```shell |
| 36 | +make build |
| 37 | +``` |
| 38 | + |
| 39 | +### Building (Windows, PowerShell) |
38 | 40 |
|
39 |
| -There are some example definition files in the folder `clusterdefinitions`. |
| 41 | +```shell |
| 42 | +cd ${env:GOPATH}/github.com/Azure/acs-engine |
| 43 | +go get . |
| 44 | +go build . |
| 45 | +``` |
40 | 46 |
|
41 |
| -# Using a Template |
42 | 47 |
|
43 |
| -Generated templates can be deployed using the Azure CLI or Powershell. |
| 48 | +## Contributing |
44 | 49 |
|
45 |
| -## Deploying with Powershell |
| 50 | +Please follow these instructions before submitting a PR: |
46 | 51 |
|
47 |
| -To deploy an ACS instance using Powershell and your generated template |
48 |
| -run the following two commands: |
| 52 | +1. Execute `make ci` to run the checkin validation tests. |
49 | 53 |
|
50 |
| -``` Powershell |
51 |
| -New-AzureRmResourceGroup -Name <RESOURCE_GROUP_NAME> -Location <LOCATION> -Force |
52 |
| -New-AzureRmResourceGroupDeployment -Name <DEPLOYMENT_NAME> -ResourceGroupName <RESOURCE_GROUP_NAME> RGName -TemplateFile <TEMPLATE_FILE> |
53 |
| -``` |
| 54 | +2. Manually test deployments if you are making modifications to the templates. |
| 55 | + For example, if you have to change the expected resulting templates then you |
| 56 | + should deploy the relevant example cluster definitions to ensure you're not |
| 57 | + introducing any sort of regression. |
54 | 58 |
|
55 |
| -## Deploying with Azure CLI |
| 59 | +## Usage (Template Generation) |
56 | 60 |
|
57 |
| -To deploy an ACS instance using the Azure CLI and your generated |
58 |
| -template run the following two commands: |
| 61 | +Usage is best demonstrated with an example: |
59 | 62 |
|
60 |
| -``` bash |
61 |
| -azure group create <RESOURCE_GROUP_NAME> <LOCATION> |
62 |
| -azure group deployment create <RESOURCE_GROUP_NAME> <DEPLOYMENT NAME> -f <TEMPLATE_FILE> |
| 63 | +```shell |
| 64 | +$ vim examples/kubernetes.classic.json |
63 | 65 |
|
| 66 | +# insert your preferred, unique DNS prefix |
| 67 | +# insert your SSH public key |
| 68 | + |
| 69 | +$ ./acs-engine examples/kubernetes.classic.json |
64 | 70 | ```
|
65 | 71 |
|
66 |
| -# Using a Docker container |
| 72 | +This produces a new directory inside `_output/` that contains an ARM template |
| 73 | +for deploying Kubernetes into Azure. (In the case of Kubernetes, some additional |
| 74 | +needed assets are generated and placed in the output directory.) |
| 75 | + |
| 76 | +## Usage (Deployment) |
67 | 77 |
|
68 |
| -The ```scripts``` directory contains helper scripts that will assist |
69 |
| -with the using a Docker container to work with the appication. |
| 78 | +Generated templates can be deployed using |
| 79 | +[the Azure CLI](https://github.com/Azure/azure-cli) or |
| 80 | +[Powershell](https://github.com/Azure/azure-powershell). |
70 | 81 |
|
71 |
| -## dev.sh |
| 82 | +### Deploying with Azure CLI |
72 | 83 |
|
73 |
| -Run a Go container with the application source code mounted into the |
74 |
| -container. You can edit the code in your favorite editor on the client |
75 |
| -while building and running the container. |
| 84 | +```bash |
| 85 | +$ az login |
76 | 86 |
|
77 |
| -## generate.sh |
| 87 | +$ az account set --name "<SUBSCRIPTION NAME OR ID>" |
78 | 88 |
|
79 |
| -Generate a template from a given configuration and store it in the |
80 |
| -```generated``` folder. For example, to generate a Swarm template use: |
| 89 | +$ az group create \ |
| 90 | + --name="<RESOURCE_GROUP_NAME>" \ |
| 91 | + --location="<LOCATION>" |
81 | 92 |
|
82 |
| -``` bash |
83 |
| -./scripts/generate.sh swarm.json |
| 93 | +$ az group deployment create \ |
| 94 | + --name="<DEPLOYMENT NAME>" \ |
| 95 | + --resource-group="<RESOURCE_GROUP_NAME>" \ |
| 96 | + --template-file="./_output/<INSTANCE>/azuredeploy.json" |
84 | 97 | ```
|
| 98 | + |
| 99 | +### Deploying with Powershell |
| 100 | + |
| 101 | +```powershell |
| 102 | +Add-AzureRmAccount |
| 103 | +
|
| 104 | +Select-AzureRmSubscription -SubscriptionID <SUBSCRIPTION_ID> |
| 105 | +
|
| 106 | +New-AzureRmResourceGroup ` |
| 107 | + -Name <RESOURCE_GROUP_NAME> ` |
| 108 | + -Location <LOCATION> |
| 109 | +
|
| 110 | +New-AzureRmResourceGroupDeployment ` |
| 111 | + -Name <DEPLOYMENT_NAME> ` |
| 112 | + -ResourceGroupName <RESOURCE_GROUP_NAME> ` |
| 113 | + -TemplateFile _output\<INSTANCE>\azuredeploy.json |
| 114 | +``` |
| 115 | + |
0 commit comments