Skip to content

Commit

Permalink
Merge from upstream release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiezhang committed Jul 7, 2017
2 parents 639e36a + fb09cdf commit 8eb8afe
Show file tree
Hide file tree
Showing 100 changed files with 2,586 additions and 444 deletions.
9 changes: 5 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
acs-engine
acs-engine.exe
_output/
.git/
./acs-engine
./acs-engine.exe
./_output
./.git
./test/acs-engine-test/acs-engine-test
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
FROM buildpack-deps:xenial

ENV GO_VERSION 1.8
ENV KUBECTL_VERSION 1.6.0
ENV AZURE_CLI_VERSION 2.0.7

RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install python-pip make build-essential curl openssl vim jq \
&& rm -rf /var/lib/apt/lists/*

ENV GO_VERSION 1.8
RUN mkdir /tmp/godeb \
&& curl "https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz" > /tmp/godeb/godeb.tar.gz \
&& (cd /tmp/godeb; tar zvxf godeb.tar.gz; ./godeb install "${GO_VERSION}") \
&& rm -rf /tmp/godeb

RUN pip install "azure-cli==${AZURE_CLI_VERSION}"
# See: https://github.com/Azure/azure-cli/blob/master/packaged_releases/bundled/README.md#using-the-bundled-installer
ENV AZURE_CLI_BUNDLE_VERSION 0.2.9
RUN mkdir /tmp/azurecli \
&& curl "https://azurecliprod.blob.core.windows.net/bundled/azure-cli_bundle_${AZURE_CLI_BUNDLE_VERSION}.tar.gz" > /tmp/azurecli/azure-cli_bundle.tar.gz \
&& (cd /tmp/azurecli \
&& tar -xvzf azure-cli_bundle.tar.gz \
&& azure-cli_bundle_*/installer --bin-dir /usr/local/bin) \
&& rm -rf /tmp/azurecli

RUN curl -fsSL https://get.docker.com/ | sh

ENV KUBECTL_VERSION 1.6.0
RUN curl "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" > /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl

Expand Down
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,22 @@ prereqs:
go get github.com/jteeuwen/go-bindata/...
glide install

_build:
build:
go generate -v $(GOFILES)
go build -v -ldflags="-X github.com/Azure/acs-engine/cmd.BuildSHA=${VERSION} -X github.com/Azure/acs-engine/cmd.BuildTime=${BUILD}"
cd test/acs-engine-test; go build -v

build: prereqs _build

test: prereqs test_fmt
test: test_fmt
go test -v $(GOFILES)

test_fmt: prereqs
test -z "$$(gofmt -s -l $(GOFILES) | tee /dev/stderr)"
.PHONY: test-style
test-style:
@scripts/validate-go.sh

validate-generated: prereqs
validate-generated:
./scripts/validate-generated.sh

fmt:
gofmt -s -l -w $(GOFILES)

lint: prereqs
go get -u github.com/golang/lint/golint
# TODO: fix lint errors, enable linting
# golint -set_exit_status

ci: validate-generated build test lint
ci: prereqs validate-generated build test lint

devenv:
./scripts/devenv.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ $ az group deployment create \
--name "<DEPLOYMENT NAME>" \
--resource-group "<RESOURCE_GROUP_NAME>" \
--template-file "./_output/<INSTANCE>/azuredeploy.json" \
--parameters "@./_output/<INSTANCE>/azuredeploy.parameters.json"
--parameters "./_output/<INSTANCE>/azuredeploy.parameters.json"
```

### Deploying with Powershell
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) {
// the caKey is not in the api model, and should be stored separately from the model
// we put these in the model after model is deserialized
dc.containerService.Properties.CertificateProfile.CaCertificate = string(caCertificateBytes)
dc.containerService.Properties.CertificateProfile.SetCAPrivateKey(string(caKeyBytes))
dc.containerService.Properties.CertificateProfile.CaPrivateKey = string(caKeyBytes)
}

dc.client, err = dc.authArgs.getClient()
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) {
prop.CertificateProfile = &api.CertificateProfile{}
}
prop.CertificateProfile.CaCertificate = string(caCertificateBytes)
prop.CertificateProfile.SetCAPrivateKey(string(caKeyBytes))
prop.CertificateProfile.CaPrivateKey = string(caKeyBytes)
}
}

Expand Down
17 changes: 12 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type authArgs struct {
ClientSecret string
CertificatePath string
PrivateKeyPath string
language string
}

func addAuthFlags(authArgs *authArgs, f *flag.FlagSet) {
Expand All @@ -70,6 +71,7 @@ func addAuthFlags(authArgs *authArgs, f *flag.FlagSet) {
f.StringVar(&authArgs.ClientSecret, "client-secret", "", "client secret (used with --auth-mode=client_secret)")
f.StringVar(&authArgs.CertificatePath, "certificate-path", "", "path to client certificate (used with --auth-method=client_certificate)")
f.StringVar(&authArgs.PrivateKeyPath, "private-key-path", "", "path to private key (used with --auth-method=client_certificate)")
f.StringVar(&authArgs.language, "language", "en-us", "language to return error messages in")
}

func (authArgs *authArgs) getClient() (*armhelpers.AzureClient, error) {
Expand All @@ -96,16 +98,21 @@ func (authArgs *authArgs) getClient() (*armhelpers.AzureClient, error) {
log.Fatal("failed to parse --azure-env as a valid target Azure cloud environment")
}

var client *armhelpers.AzureClient
switch authArgs.AuthMethod {
case "device":
return armhelpers.NewAzureClientWithDeviceAuth(env, authArgs.SubscriptionID.String())
client, err = armhelpers.NewAzureClientWithDeviceAuth(env, authArgs.SubscriptionID.String())
case "client_secret":
return armhelpers.NewAzureClientWithClientSecret(env, authArgs.SubscriptionID.String(), authArgs.ClientID.String(), authArgs.ClientSecret)
client, err = armhelpers.NewAzureClientWithClientSecret(env, authArgs.SubscriptionID.String(), authArgs.ClientID.String(), authArgs.ClientSecret)
case "client_certificate":
return armhelpers.NewAzureClientWithClientCertificate(env, authArgs.SubscriptionID.String(), authArgs.ClientID.String(), authArgs.CertificatePath, authArgs.PrivateKeyPath)
client, err = armhelpers.NewAzureClientWithClientCertificateFile(env, authArgs.SubscriptionID.String(), authArgs.ClientID.String(), authArgs.CertificatePath, authArgs.PrivateKeyPath)
default:
log.Fatalf("--auth-method: ERROR: method unsupported. method=%q.", authArgs.AuthMethod)
return nil, nil // unreachable
}

return nil, nil // unreachable
if err != nil {
return nil, err
}
client.AddAcceptLanguages([]string{authArgs.language})
return client, nil
}
68 changes: 68 additions & 0 deletions docs/developers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Developers Guide

This guide explains how to set up your environment for developing on
acs-engine.

## Prerequisites

- 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

## Contribution Guidelines

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

### Structure of the Code

The code for the acs-engine project is organized as follows:

- The individual programs are located in `cmd/`. Code inside of `cmd/`
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](https://github.com/Masterminds/glide) and stored in the
`vendor/` directory.

### Git Conventions

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:

1. Use `go get` to clone the acs-engine repository: `go get github.com/Azure/acs-engine`
2. Fork that repository into your GitHub account
3. Add your repository as a remote for `$GOPATH/github.com/Azure/acs-engine`
4. Create a new working branch (`git checkout -b feat/my-feature`) and
do your work on that branch.
5. When you are ready for us to review, push your branch to GitHub, and
then open a new pull request with us.

### Go Conventions

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](https://golang.org/doc/effective_go.html#formatting).
- The Go Wiki has a great article on [formatting](https://github.com/golang/go/wiki/CodeReviewComments).
36 changes: 36 additions & 0 deletions examples/kubernetesversions/kubernetes1.6.6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorVersion": "1.6.6"
},
"masterProfile": {
"count": 3,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet"
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
},
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
}
}
}
41 changes: 41 additions & 0 deletions examples/v20170701/dcos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"apiVersion": "2017-07-01",
"properties": {
"orchestratorProfile": {
"orchestratorType": "DCOS"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agentprivate",
"count": 1,
"vmSize": "Standard_D2_v2"
},
{
"name": "agentpublic",
"count": 1,
"vmSize": "Standard_D2_v2",
"dnsPrefix": "",
"ports": [
80,
443,
8080
]
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
}
}
}
36 changes: 36 additions & 0 deletions examples/v20170701/dockerce.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"apiVersion": "2017-07-01",
"properties": {
"orchestratorProfile": {
"orchestratorType": "DockerCE"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agentpublic",
"count": 3,
"vmSize": "Standard_D2_v2",
"dnsPrefix": "",
"ports": [
80,
443,
8080
]
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
}
}
}
41 changes: 41 additions & 0 deletions examples/v20170701/kubernetes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"apiVersion": "2017-07-01",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorVersion": "1.6.6"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 1,
"vmSize": "Standard_D2_v2"
},
{
"name": "agentpool1",
"count": 1,
"vmSize": "Standard_D3_v2",
"osType": "Windows"
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
},
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
}
}
}
1 change: 0 additions & 1 deletion examples/windows/kubernetes-manageddisks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"vmSize": "Standard_D2_v2",
"storageProfile" : "ManagedDisks",
"availabilityProfile": "AvailabilitySet",
"storageProfile": "StorageAccount",
"OSDiskSizeGB": 200,
"diskSizesGB": [128, 128, 128, 128],
"osType": "Windows"
Expand Down
2 changes: 1 addition & 1 deletion parts/configure-swarm-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ensureAzureNetwork()
echo "the network is not healthy, aborting install"
ifconfig
ip a
exit 2
exit 1
fi
# ensure the host ip can resolve
networkHealthy=1
Expand Down

0 comments on commit 8eb8afe

Please sign in to comment.