Skip to content

Commit 8d96a93

Browse files
committed
merged from upstream master
2 parents fd2a409 + e3587cb commit 8d96a93

File tree

3,198 files changed

+984324
-2179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,198 files changed

+984324
-2179
lines changed

.circleci/config.yml

+50-19
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
test:
99
working_directory: /go/src/github.com/Azure/acs-engine
1010
docker:
11-
- image: quay.io/deis/go-dev:v1.2.0
11+
- image: quay.io/deis/go-dev:v1.8.1
1212
environment:
1313
GOPATH: /go
1414
steps:
@@ -34,7 +34,7 @@ jobs:
3434
swarm-e2e:
3535
working_directory: /go/src/github.com/Azure/acs-engine
3636
docker:
37-
- image: quay.io/deis/go-dev:v1.2.0
37+
- image: quay.io/deis/go-dev:v1.8.1
3838
environment:
3939
GOPATH: /go
4040
steps:
@@ -61,7 +61,7 @@ jobs:
6161
dcos-e2e:
6262
working_directory: /go/src/github.com/Azure/acs-engine
6363
docker:
64-
- image: quay.io/deis/go-dev:v1.2.0
64+
- image: quay.io/deis/go-dev:v1.8.1
6565
environment:
6666
GOPATH: /go
6767
steps:
@@ -70,6 +70,7 @@ jobs:
7070
echo 'export TIMEOUT=20m' >> $BASH_ENV
7171
echo 'export CLUSTER_DEFINITION=examples/dcos.json' >> $BASH_ENV
7272
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_DCOS}' >> $BASH_ENV
73+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
7374
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_DCOS}' >> $BASH_ENV
7475
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_DCOS}' >> $BASH_ENV
7576
- run:
@@ -83,7 +84,7 @@ jobs:
8384
swarmmode-e2e:
8485
working_directory: /go/src/github.com/Azure/acs-engine
8586
docker:
86-
- image: quay.io/deis/go-dev:v1.2.0
87+
- image: quay.io/deis/go-dev:v1.8.1
8788
environment:
8889
GOPATH: /go
8990
steps:
@@ -110,7 +111,7 @@ jobs:
110111
k8s-1.7-release-e2e:
111112
working_directory: /go/src/github.com/Azure/acs-engine
112113
docker:
113-
- image: quay.io/deis/go-dev:v1.2.0
114+
- image: quay.io/deis/go-dev:v1.8.1
114115
environment:
115116
GOPATH: /go
116117
steps:
@@ -120,12 +121,17 @@ jobs:
120121
echo 'export ORCHESTRATOR_RELEASE=1.7' >> $BASH_ENV
121122
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/release/default/definition.json' >> $BASH_ENV
122123
echo 'export CREATE_VNET=true' >> $BASH_ENV
124+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
125+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
123126
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
124127
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
125128
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
129+
- run:
130+
name: compile
131+
command: make build-binary
126132
- run:
127133
name: ginkgo k8s e2e tests
128-
command: make build-binary test-kubernetes
134+
command: make test-kubernetes
129135
no_output_timeout: "30m"
130136
- store_artifacts:
131137
path: /go/src/github.com/Azure/acs-engine/_logs
@@ -134,21 +140,26 @@ jobs:
134140
k8s-windows-1.7-release-e2e:
135141
working_directory: /go/src/github.com/Azure/acs-engine
136142
docker:
137-
- image: quay.io/deis/go-dev:v1.2.0
143+
- image: quay.io/deis/go-dev:v1.8.1
138144
environment:
139145
GOPATH: /go
140146
steps:
141147
- checkout
142148
- run: |
143149
echo 'export TIMEOUT=30m' >> $BASH_ENV
144150
echo 'export ORCHESTRATOR_RELEASE=1.7' >> $BASH_ENV
145-
echo 'export CLUSTER_DEFINITION=examples/windows/kubernetes.json' >> $BASH_ENV
151+
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/windows/definition.json' >> $BASH_ENV
152+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
153+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
146154
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
147155
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
148156
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
157+
- run:
158+
name: compile
159+
command: make build-binary
149160
- run:
150161
name: ginkgo k8s windows e2e tests
151-
command: make build-binary test-kubernetes
162+
command: make test-kubernetes
152163
no_output_timeout: "30m"
153164
- store_artifacts:
154165
path: /go/src/github.com/Azure/acs-engine/_logs
@@ -157,7 +168,7 @@ jobs:
157168
k8s-1.9-release-e2e:
158169
working_directory: /go/src/github.com/Azure/acs-engine
159170
docker:
160-
- image: quay.io/deis/go-dev:v1.2.0
171+
- image: quay.io/deis/go-dev:v1.8.1
161172
environment:
162173
GOPATH: /go
163174
steps:
@@ -167,12 +178,17 @@ jobs:
167178
echo 'export ORCHESTRATOR_RELEASE=1.9' >> $BASH_ENV
168179
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/release/default/definition.json' >> $BASH_ENV
169180
echo 'export CREATE_VNET=true' >> $BASH_ENV
181+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
182+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
170183
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
171184
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
172185
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
186+
- run:
187+
name: compile
188+
command: make build-binary
173189
- run:
174190
name: ginkgo k8s e2e tests
175-
command: make build-binary test-kubernetes
191+
command: make test-kubernetes
176192
no_output_timeout: "30m"
177193
- store_artifacts:
178194
path: /go/src/github.com/Azure/acs-engine/_logs
@@ -181,7 +197,7 @@ jobs:
181197
k8s-1.8-release-e2e:
182198
working_directory: /go/src/github.com/Azure/acs-engine
183199
docker:
184-
- image: quay.io/deis/go-dev:v1.2.0
200+
- image: quay.io/deis/go-dev:v1.8.1
185201
environment:
186202
GOPATH: /go
187203
steps:
@@ -191,12 +207,17 @@ jobs:
191207
echo 'export ORCHESTRATOR_RELEASE=1.8' >> $BASH_ENV
192208
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/release/default/definition.json' >> $BASH_ENV
193209
echo 'export CREATE_VNET=true' >> $BASH_ENV
210+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
211+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
194212
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
195213
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
196214
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
215+
- run:
216+
name: compile
217+
command: make build-binary
197218
- run:
198219
name: ginkgo k8s e2e tests
199-
command: make build-binary test-kubernetes
220+
command: make test-kubernetes
200221
no_output_timeout: "30m"
201222
- store_artifacts:
202223
path: /go/src/github.com/Azure/acs-engine/_logs
@@ -205,21 +226,26 @@ jobs:
205226
k8s-windows-1.8-release-e2e:
206227
working_directory: /go/src/github.com/Azure/acs-engine
207228
docker:
208-
- image: quay.io/deis/go-dev:v1.2.0
229+
- image: quay.io/deis/go-dev:v1.8.1
209230
environment:
210231
GOPATH: /go
211232
steps:
212233
- checkout
213234
- run: |
214235
echo 'export TIMEOUT=30m' >> $BASH_ENV
215236
echo 'export ORCHESTRATOR_RELEASE=1.8' >> $BASH_ENV
216-
echo 'export CLUSTER_DEFINITION=examples/windows/kubernetes.json' >> $BASH_ENV
237+
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/windows/definition.json' >> $BASH_ENV
238+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
239+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
217240
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
218241
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
219242
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
243+
- run:
244+
name: compile
245+
command: make build-binary
220246
- run:
221247
name: ginkgo k8s windows e2e tests
222-
command: make build-binary test-kubernetes
248+
command: make test-kubernetes
223249
no_output_timeout: "30m"
224250
- store_artifacts:
225251
path: /go/src/github.com/Azure/acs-engine/_logs
@@ -228,21 +254,26 @@ jobs:
228254
k8s-windows-1.9-release-e2e:
229255
working_directory: /go/src/github.com/Azure/acs-engine
230256
docker:
231-
- image: quay.io/deis/go-dev:v1.2.0
257+
- image: quay.io/deis/go-dev:v1.8.1
232258
environment:
233259
GOPATH: /go
234260
steps:
235261
- checkout
236262
- run: |
237263
echo 'export TIMEOUT=30m' >> $BASH_ENV
238264
echo 'export ORCHESTRATOR_RELEASE=1.9' >> $BASH_ENV
239-
echo 'export CLUSTER_DEFINITION=examples/windows/kubernetes.json' >> $BASH_ENV
265+
echo 'export CLUSTER_DEFINITION=examples/e2e-tests/kubernetes/windows/definition.json' >> $BASH_ENV
266+
echo 'export CLEANUP_ON_EXIT=false' >> $BASH_ENV
267+
echo 'export RETAIN_SSH=false' >> $BASH_ENV
240268
echo 'export SUBSCRIPTION_ID=${SUBSCRIPTION_ID_E2E_KUBERNETES}' >> $BASH_ENV
241269
echo 'export CLIENT_ID=${SERVICE_PRINCIPAL_CLIENT_ID_E2E_KUBERNETES}' >> $BASH_ENV
242270
echo 'export CLIENT_SECRET=${SERVICE_PRINCIPAL_CLIENT_SECRET_E2E_KUBERNETES}' >> $BASH_ENV
271+
- run:
272+
name: compile
273+
command: make build-binary
243274
- run:
244275
name: ginkgo k8s windows e2e tests
245-
command: make build-binary test-kubernetes
276+
command: make test-kubernetes
246277
no_output_timeout: "30m"
247278
- store_artifacts:
248279
path: /go/src/github.com/Azure/acs-engine/_logs

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
acs-engine.exe
22
acs-engine
3+
debug
34
_output/
45
_input/
56
.vscode

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ GITTAG := $(VERSION_SHORT)
2525
endif
2626

2727
REPO_PATH := github.com/Azure/acs-engine
28-
DEV_ENV_IMAGE := quay.io/deis/go-dev:v1.2.0
28+
DEV_ENV_IMAGE := quay.io/deis/go-dev:v1.8.1
2929
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
3030
DEV_ENV_OPTS := --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} ${DEV_ENV_VARS}
3131
DEV_ENV_CMD := docker run ${DEV_ENV_OPTS} ${DEV_ENV_IMAGE}

cmd/deploy.go

+20-19
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,20 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) error {
111111
Locale: dc.locale,
112112
},
113113
}
114+
115+
if dc.location == "" {
116+
return fmt.Errorf(fmt.Sprintf("--location must be specified"))
117+
}
114118
// skip validating the model fields for now
115119
dc.containerService, dc.apiVersion, err = apiloader.LoadContainerServiceFromFile(dc.apimodelPath, false, false, nil)
116120
if err != nil {
117121
return fmt.Errorf(fmt.Sprintf("error parsing the api model: %s", err.Error()))
118122
}
119123

120-
if dc.location == "" {
121-
return fmt.Errorf(fmt.Sprintf("--location must be specified"))
124+
if dc.containerService.Location == "" {
125+
dc.containerService.Location = dc.location
126+
} else if dc.containerService.Location != dc.location {
127+
return fmt.Errorf(fmt.Sprintf("--location does not match api model location"))
122128
}
123129

124130
dc.client, err = dc.authArgs.getClient()
@@ -154,15 +160,13 @@ func autofillApimodel(dc *deployCmd) {
154160
if dc.dnsPrefix == "" {
155161
log.Fatalf("apimodel: missing masterProfile.dnsPrefix and --dns-prefix was not specified")
156162
}
163+
log.Warnf("apimodel: missing masterProfile.dnsPrefix will use %q", dc.dnsPrefix)
164+
dc.containerService.Properties.MasterProfile.DNSPrefix = dc.dnsPrefix
165+
}
157166

158-
dnsPrefix := dc.dnsPrefix
159-
if dc.autoSuffix {
160-
suffix := strconv.FormatInt(time.Now().Unix(), 16)
161-
dnsPrefix = dnsPrefix + "-" + suffix
162-
}
163-
164-
log.Warnf("apimodel: missing masterProfile.dnsPrefix will use %q", dnsPrefix)
165-
dc.containerService.Properties.MasterProfile.DNSPrefix = dnsPrefix
167+
if dc.autoSuffix {
168+
suffix := strconv.FormatInt(time.Now().Unix(), 16)
169+
dc.containerService.Properties.MasterProfile.DNSPrefix += "-" + suffix
166170
}
167171

168172
if dc.outputDirectory == "" {
@@ -217,14 +221,11 @@ func autofillApimodel(dc *deployCmd) {
217221
log.Warnf("created application with applicationID (%s) and servicePrincipalObjectID (%s).", applicationID, servicePrincipalObjectID)
218222

219223
log.Warnln("apimodel: ServicePrincipalProfile was empty, assigning role to application...")
220-
for {
221-
err = dc.client.CreateRoleAssignmentSimple(dc.resourceGroup, servicePrincipalObjectID)
222-
if err != nil {
223-
log.Debugf("Failed to create role assignment (will retry): %q", err)
224-
time.Sleep(3 * time.Second)
225-
continue
226-
}
227-
break
224+
225+
err = dc.client.CreateRoleAssignmentSimple(dc.resourceGroup, servicePrincipalObjectID)
226+
if err != nil {
227+
log.Fatalf("apimodel: could not create or assign ServicePrincipal: %q", err)
228+
228229
}
229230

230231
dc.containerService.Properties.ServicePrincipalProfile = &api.ServicePrincipalProfile{
@@ -256,7 +257,7 @@ func (dc *deployCmd) run() error {
256257
log.Fatalln("failed to initialize template generator: %s", err.Error())
257258
}
258259

259-
template, parameters, certsgenerated, err := templateGenerator.GenerateTemplate(dc.containerService, acsengine.DefaultGeneratorCode)
260+
template, parameters, certsgenerated, err := templateGenerator.GenerateTemplate(dc.containerService, acsengine.DefaultGeneratorCode, false)
260261
if err != nil {
261262
log.Fatalf("error generating template %s: %s", dc.apimodelPath, err.Error())
262263
os.Exit(1)

cmd/deploy_test.go

+49-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@ const ExampleAPIModel = `{
2626
}
2727
`
2828

29+
const ExampleAPIModelWithDNSPrefix = `{
30+
"apiVersion": "vlabs",
31+
"properties": {
32+
"orchestratorProfile": { "orchestratorType": "Kubernetes", "kubernetesConfig": { "useManagedIdentity": %s, "etcdVersion" : "2.3.8" } },
33+
"masterProfile": { "count": 1, "dnsPrefix": "mytestcluster", "vmSize": "Standard_D2_v2" },
34+
"agentPoolProfiles": [ { "name": "linuxpool1", "count": 2, "vmSize": "Standard_D2_v2", "availabilityProfile": "AvailabilitySet" } ],
35+
"windowsProfile": { "adminUsername": "azureuser", "adminPassword": "replacepassword1234$" },
36+
"linuxProfile": { "adminUsername": "azureuser", "ssh": { "publicKeys": [ { "keyData": "" } ] }
37+
},
38+
"servicePrincipalProfile": { "clientId": "%s", "secret": "%s" }
39+
}
40+
}
41+
`
42+
2943
func getExampleAPIModel(useManagedIdentity bool, clientID, clientSecret string) string {
44+
return getAPIModel(ExampleAPIModel, useManagedIdentity, clientID, clientSecret)
45+
}
46+
47+
func getAPIModel(baseAPIModel string, useManagedIdentity bool, clientID, clientSecret string) string {
3048
return fmt.Sprintf(
31-
ExampleAPIModel,
49+
baseAPIModel,
3250
strconv.FormatBool(useManagedIdentity),
3351
clientID,
3452
clientSecret)
@@ -46,6 +64,36 @@ func TestAutofillApimodelAllowsPrespecifiedCreds(t *testing.T) {
4664
testAutodeployCredentialHandling(t, false, "clientID", "clientSecret")
4765
}
4866

67+
func TestAutoSufixWithDnsPrefixInApiModel(t *testing.T) {
68+
apiloader := &api.Apiloader{
69+
Translator: nil,
70+
}
71+
72+
apimodel := getAPIModel(ExampleAPIModelWithDNSPrefix, false, "clientID", "clientSecret")
73+
cs, ver, err := apiloader.DeserializeContainerService([]byte(apimodel), false, false, nil)
74+
if err != nil {
75+
t.Fatalf("unexpected error deserializing the example apimodel: %s", err)
76+
}
77+
deployCmd := &deployCmd{
78+
apimodelPath: "./this/is/unused.json",
79+
outputDirectory: "_test_output",
80+
location: "westus",
81+
autoSuffix: true,
82+
containerService: cs,
83+
apiVersion: ver,
84+
85+
client: &armhelpers.MockACSEngineClient{},
86+
}
87+
autofillApimodel(deployCmd)
88+
89+
defer os.RemoveAll(deployCmd.outputDirectory)
90+
91+
if deployCmd.containerService.Properties.MasterProfile.DNSPrefix == "mytestcluster" {
92+
t.Fatalf("expected %s-{timestampsuffix} but got %s", "mytestcluster", deployCmd.containerService.Properties.MasterProfile.DNSPrefix)
93+
}
94+
95+
}
96+
4997
func testAutodeployCredentialHandling(t *testing.T, useManagedIdentity bool, clientID, clientSecret string) {
5098
apiloader := &api.Apiloader{
5199
Translator: nil,

cmd/generate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (gc *generateCmd) run() error {
144144
log.Fatalln("failed to initialize template generator: %s", err.Error())
145145
}
146146

147-
template, parameters, certsGenerated, err := templateGenerator.GenerateTemplate(gc.containerService, acsengine.DefaultGeneratorCode)
147+
template, parameters, certsGenerated, err := templateGenerator.GenerateTemplate(gc.containerService, acsengine.DefaultGeneratorCode, false)
148148
if err != nil {
149149
log.Fatalf("error generating template %s: %s", gc.apimodelPath, err.Error())
150150
os.Exit(1)

cmd/orchestrators_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var _ = Describe("The orchestrators command", func() {
4040
It("should succeed", func() {
4141
command := &orchestratorsCmd{
4242
orchestrator: "kubernetes",
43-
version: "1.7.12",
43+
version: "1.7.13",
4444
}
4545

4646
err := command.run(nil, nil)

0 commit comments

Comments
 (0)