Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
azure-aks: circleci/azure-aks@0.3.0
Use azure-aks
elements in your existing workflows and jobs.
Create an AKS cluster, test it, and tear it down.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
jobs:
test-cluster:
executor: azure-aks/default
parameters:
cluster-name:
description: |
Name of the AKS cluster
type: string
resource-group:
description: |
Resource group that the cluster is in
type: string
steps:
- azure-aks/update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
- run:
command: |
kubectl get services
name: Test cluster
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: my-aks-demo
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: my-aks-demo-rg
- test-cluster:
cluster-name: my-aks-demo
requires:
- azure-aks/create-cluster
resource-group: my-aks-demo-rg
- azure-aks/delete-cluster:
cluster-name: my-aks-demo
delete-resource-group: true
delete-service-principal: true
requires:
- test-cluster
resource-group: my-aks-demo-rg
Create a kubernetes deployment.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
jobs:
create-deployment:
executor: azure-aks/default
parameters:
cluster-name:
description: |
Name of the AKS cluster
type: string
resource-group:
description: |
Resource group that the cluster is in
type: string
steps:
- checkout
- azure-aks/update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
- kubernetes/create-or-update-resource:
resource-file-path: tests/nginx-deployment/deployment.yaml
resource-name: deployment/nginx-deployment
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: aks-demo-deployment
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: aks-demo-deployment-rg
- create-deployment:
cluster-name: aks-demo-deployment
requires:
- azure-aks/create-cluster
resource-group: aks-demo-deployment-rg
- azure-aks/update-container-image:
cluster-name: aks-demo-deployment
container-image-updates: nginx=nginx:1.9.1
post-steps:
- kubernetes/delete-resource:
resource-names: nginx-deployment
resource-types: deployment
wait: true
record: true
requires:
- create-deployment
resource-group: aks-demo-deployment-rg
resource-name: deployment/nginx-deployment
- azure-aks/delete-cluster:
cluster-name: aks-demo-deployment
delete-resource-group: true
delete-service-principal: true
requires:
- azure-aks/update-container-image
resource-group: aks-demo-deployment-rg
Install a helm chart on a cluster.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: my-aks-helm-demo
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: my-aks-helm-demo-rg
- azure-aks/install-helm-on-cluster:
cluster-name: my-aks-helm-demo
enable-cluster-wide-admin-access: true
requires:
- azure-aks/create-cluster
resource-group: my-aks-helm-demo-rg
- azure-aks/install-helm-chart:
chart: stable/grafana
cluster-name: my-aks-helm-demo
release-name: grafana-release
requires:
- azure-aks/install-helm-on-cluster
resource-group: my-aks-helm-demo-rg
- azure-aks/delete-helm-release:
cluster-name: my-aks-helm-demo
release-name: grafana-release
requires:
- azure-aks/install-helm-chart
resource-group: my-aks-helm-demo-rg
- azure-aks/delete-cluster:
cluster-name: my-aks-helm-demo
delete-resource-group: true
delete-service-principal: true
requires:
- azure-aks/delete-helm-release
resource-group: my-aks-helm-demo-rg
Creates an AKS cluster and optionally the required resource group. Requirements: Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
admin-username | Specify the name of the user account to create on node VMs for SSH access.
| No | '' | string |
client-secret | Name of environment variable that stores the secret associated with the service principal. Required if "service-principal" is specified.
| No | AZURE_SP_PASSWORD | env_var_name |
cluster-name | Name of the AKS cluster to be created
| Yes | - | string |
create-resource-group | Whether the specified resource group is to be created.
| No | false | boolean |
dns-name-prefix | Prefix for hostnames that are created.
If not specified, a hostname will be generated based on the managed cluster and resource group names.
| No | '' | string |
executor | Executor to use for this job.
| No | default | executor |
generate-ssh-keys | Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
| No | false | boolean |
kubernetes-version | Version of Kubernetes to use for creating the cluster, such as "1.11.8" or "1.12.6".
| No | '' | string |
location | Location that the AKS cluster will be created in.
The location is required if "create-resource-group" is set to true.
| No | '' | string |
no-output-timeout | Elapsed time that the cluster creation command can run on CircleCI without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
| No | 45m | string |
no-ssh-key | Do not use or create a local SSH key.
| No | true | boolean |
no-wait | Enable this to skip waiting for the long-running operation to finish.
| No | false | boolean |
node-count | Configures the number of nodes in the Kubernetes node pool.
A value of -1 will be ignored.
| No | -1 | integer |
node-osdisk-size | Size in GB of the OS disk for each node in the node pool. Minimum 30 GB.
A value of -1 will be ignored.
| No | -1 | integer |
node-vm-size | Size of Virtual Machines to create as Kubernetes nodes.
| No | '' | string |
resource-group | Resource group that the AKS cluster will be created in.
| Yes | - | string |
resource-group-tags | Space-separated tags in 'key[=value]' format, for the resource group to be created.
Only effective when create-resource-group is set to true.
| No | '' | string |
service-principal | Name of environment variable that stores the service principal used for authentication to Azure APIs.
| No | AZURE_SP | env_var_name |
show-az-command | Whether to show the az command(s) run.
| No | false | boolean |
skip-kubectl-install | Whether to skip the installation of kubectl.
| No | false | boolean |
ssh-key-value | Public key path or key contents to install on node VMs for SSH access.
| No | '' | string |
subscription | Name or ID of subscription.
| No | '' | string |
tags | Space-separated tags in 'key[=value]' format, for the cluster to be created.
| No | '' | string |
Deletes the AKS cluster and optionally the associated resources. Requirements: Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | Name of the AKS cluster to be deleted.
| Yes | - | string |
delete-resource-group | Whether the specified resource group is to be deleted.
| No | false | boolean |
delete-service-principal | Whether the service principal for the cluster should also be deleted.
| Yes | - | boolean |
executor | Executor to use for this job.
| No | default | executor |
get-admin-credentials | Get cluster administrator credentials instead of cluster user credentials.
| No | false | boolean |
no-output-timeout | Elapsed time that the cluster deletion command can run without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
| No | 30m | string |
no-wait | Enable this to skip waiting for the long-running operation to finish.
| No | false | boolean |
resource-group | Resource group that the AKS cluster is in.
| Yes | - | string |
show-az-command | Whether to show the az command(s) used.
| No | false | boolean |
subscription | Name or ID of subscription.
| No | '' | string |
Deletes a helm release. Requirements: helm should be installed on the cluster. Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | The name of the AKS cluster.
| Yes | - | string |
executor | Executor to use for this job.
| No | default | executor |
get-admin-credentials | Get cluster administrator credentials instead of cluster user credentials.
| No | false | boolean |
namespace | The kubernetes namespace that should be used.
| No | '' | string |
purge | Whether to remove the release from the store and make its name free for
later use
| No | false | boolean |
release-name | Specify the release to be deleted.
| Yes | - | string |
resource-group | Resource group that the AKS cluster is in.
| Yes | - | string |
subscription | Name or ID of subscription.
| No | '' | string |
tiller-namespace | Specify the namespace of Tiller
| No | '' | string |
timeout | Specify time in seconds to wait for any individual Kubernetes operation
(like Jobs for hooks)
A value of -1 will be ignored.
| No | -1 | integer |
tls | Enable TLS for the request
| No | false | boolean |
tls-ca-cert | Path to TLS CA certificate file
| No | '' | string |
tls-cert | Path to TLS certificate file
| No | '' | string |
tls-hostname | The server name used to verify the hostname on the returned
certificates from the server
| No | '' | string |
tls-key | Path to TLS key file
| No | '' | string |
tls-verify | Enable TLS for request and verify remote
| No | false | boolean |
Installs a helm chart into the AKS cluster. Requirements: Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
chart | Specify for installation a chart reference (e.g. stable/mariadb),
or a path to a packaged chart (e.g. ./nginx-1.2.3.tgz),
or a path to an unpacked chart directory (e.g. ./nginx)
or an absolute URL (e.g. https://example.com/charts/nginx-1.2.3.tgz)
| Yes | - | string |
cluster-name | The name of the AKS cluster.
| Yes | - | string |
executor | Executor to use for this job.
| No | default | executor |
get-admin-credentials | Get cluster administrator credentials instead of cluster user credentials.
| No | false | boolean |
namespace | The kubernetes namespace that should be used.
| No | '' | string |
release-name | Specify a name for the release.
| No | '' | string |
resource-group | Resource group that the AKS cluster is in.
| Yes | - | string |
subscription | Name or ID of subscription.
| No | '' | string |
tiller-namespace | Specify the namespace of Tiller
| No | '' | string |
tls | Enable TLS for the request
| No | false | boolean |
tls-ca-cert | Path to TLS CA certificate file
| No | '' | string |
tls-cert | Path to TLS certificate file
| No | '' | string |
tls-hostname | The server name used to verify the hostname on the returned
certificates from the server
| No | '' | string |
tls-key | Path to TLS key file
| No | '' | string |
tls-verify | Enable TLS for request and verify remote
| No | false | boolean |
values-to-override | Override values in a chart using the --set flag of the helm install
command. Format: key1=val1,key2=val2
| No | '' | string |
wait | Whether to wait for the installation to be complete
| No | true | boolean |
Installs helm onto the AKS cluster. Note: Parameters like tiller-tls need to be set to apply security configurations to the tiller configuration. Requirements: Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | The name of the AKS cluster.
| Yes | - | string |
enable-cluster-wide-admin-access | Allow tiller to have admin access to the entire AKS cluster
by creating a role binding with a cluster-admin role
and a service account with name as specified by the service-account
parameter or defaulting to "tiller".
Note: This is a convenience option but is typically not advisable
in a production cluster for security reasons.
| No | false | boolean |
executor | Executor to use for this job.
| No | default | executor |
get-admin-credentials | Get cluster administrator credentials for updating kubeconfig
instead of cluster user credentials.
| No | false | boolean |
resource-group | Resource group that the AKS cluster is in.
| Yes | - | string |
service-account | Name of service account to Tiller to use.
Note: A role binding which specifies a role
and a service account with the specified name, must
be created in advance, unless
enable-cluster-wide-admin-access is set to true.
| No | '' | string |
subscription | Name or ID of subscription.
| No | '' | string |
tiller-ca-cert | The path to CA root certificate
| No | '' | string |
tiller-namespace | Specify the namespace of Tiller
| No | '' | string |
tiller-tls | Install Tiller with TLS enabled
| No | false | boolean |
tiller-tls-cert | The path to TLS certificate file to install with Tiller
| No | '' | string |
tiller-tls-hostname | The server name used to verify the hostname on the returned
certificates from Tiller
| No | '' | string |
tiller-tls-key | The path to TLS key file to install with Tiller
| No | '' | string |
tiller-tls-verify | Install Tiller with TLS enabled and to verify remote certificates
| No | false | boolean |
wait | Block until Tiller is running and ready to receive requests
| No | true | boolean |
Updates the container image(s) of a resource on AKS. Requirements: Login to Azure is done via the azure-cli Orb and requires environment variables storing the Azure user or Service Principal credentials to be defined (See: https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | The name of the cluster where the resource is to be managed.
| No | '' | string |
container-image-updates | Specify a list of container image updates
(space-delimited name value pairs in the form
CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N)
to be applied to the resource via `kubectl set image`.
e.g. "busybox=busybox nginx=nginx:1.9.1"
| Yes | - | string |
executor | Executor to use for this job.
| No | default | executor |
get-admin-credentials | Get cluster administrator credentials instead of cluster user credentials.
| No | false | boolean |
get-rollout-status | Get the status of the rollout.
This can only be used for resource types that are valid
for usage with `kubectl rollout` subcommands.
| No | false | boolean |
namespace | The kubernetes namespace that should be used.
| No | '' | string |
pinned-revision-to-watch | Pin a specific revision to be watched and abort watching if it is rolled
over by another revision.
Only effective if get-rollout-status is set to true.
| No | '' | string |
record | Whether to record the update
| No | false | boolean |
resource-file-path | Path to file used to update the resource.
Either resource-file-path or resource-name need to be specified.
| No | '' | string |
resource-group | Resource group that the AKS cluster is in.
| No | '' | string |
resource-name | Resource name in the format TYPE/NAME e.g. deployment/nginx-deployment
Either resource-file-path or resource-name need to be specified.
This is required if get-rollout-status is set to true.
| No | '' | string |
show-kubectl-command | Whether to show the kubectl command used.
| No | false | boolean |
subscription | Name or ID of subscription.
| No | '' | string |
watch-rollout-status | Whether to watch the status of the latest rollout until it's done.
Only effective if get-rollout-status is set to true.
| No | true | boolean |
watch-timeout | The length of time to wait before ending the watch, zero means never.
Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
Only effective if get-rollout-status is set to true.
| No | '' | string |
Creates an AKS cluster and optionally the required resource group.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
admin-username | Specify the name of the user account to create on node VMs for SSH access.
| No | '' | string |
client-secret | Name of environment variable that stores the secret associated with the service principal. Required if "service-principal" is specified.
| No | AZURE_SP_PASSWORD | env_var_name |
cluster-name | Name of the AKS cluster to be created
| Yes | - | string |
create-resource-group | Whether the specified resource group is to be created.
| No | false | boolean |
dns-name-prefix | Prefix for hostnames that are created.
If not specified, a hostname will be generated based on the managed cluster and resource group names.
| No | '' | string |
generate-ssh-keys | Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
| No | false | boolean |
kubernetes-version | Version of Kubernetes to use for creating the cluster, such as "1.11.8" or "1.12.6".
| No | '' | string |
location | Location that the AKS cluster will be created in.
The location is required if "create-resource-group" is set to true.
| No | '' | string |
no-output-timeout | Elapsed time that the cluster creation command can run on CircleCI without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
| No | 45m | string |
no-ssh-key | Do not use or create a local SSH key.
| No | true | boolean |
no-wait | Enable this to skip waiting for the long-running operation to finish.
| No | false | boolean |
node-count | Configures the number of nodes in the Kubernetes node pool.
A value of -1 will be ignored.
| No | -1 | integer |
node-osdisk-size | Size in GB of the OS disk for each node in the node pool. Minimum 30 GB.
A value of -1 will be ignored.
| No | -1 | integer |
node-vm-size | Size of Virtual Machines to create as Kubernetes nodes.
| No | '' | string |
resource-group | Resource group that the AKS cluster will be created in.
| Yes | - | string |
resource-group-tags | Space-separated tags in 'key[=value]' format, for the resource group to be created.
Only effective when create-resource-group is set to true.
| No | '' | string |
service-principal | Name of environment variable that stores the service principal used for authentication to Azure APIs.
| No | AZURE_SP | env_var_name |
show-az-command | Whether to show the az command(s) run.
| No | false | boolean |
skip-kubectl-install | Whether to skip the installation of kubectl.
| No | false | boolean |
ssh-key-value | Public key path or key contents to install on node VMs for SSH access.
| No | '' | string |
subscription | Name or ID of subscription.
| No | '' | string |
tags | Space-separated tags in 'key[=value]' format, for the cluster.
| No | '' | string |
Deletes the cluster and optionally the associated resources.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | Name of the cluster to be deleted.
| Yes | - | string |
delete-resource-group | Whether the specified resource group is to be deleted.
| No | false | boolean |
delete-service-principal | Whether the service principal for the cluster should also be deleted.
| Yes | - | boolean |
no-output-timeout | Elapsed time that the cluster deletion command can run without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
| No | 30m | string |
no-wait | Enable this to skip waiting for the long-running operation to finish.
| No | false | boolean |
resource-group | Resource group that the cluster is in.
| Yes | - | string |
show-az-command | Whether to show the az command(s) used.
| No | false | boolean |
subscription | Name or ID of subscription.
| No | '' | string |
Allows the kubectl client to work with an AKS cluster. Updates the kubectl configuration file with AKS cluster access credentials.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cluster-name | The name of the cluster for which to create a kubeconfig entry.
| Yes | - | string |
file | Kubernetes configuration file to update. Use "-" to print YAML to stdout instead.
| No | '' | string |
get-admin-credentials | Get cluster administrator credentials instead of cluster user credentials.
| No | false | boolean |
install-kubectl | Whether to install kubectl
| No | false | boolean |
overwrite-existing | Whether to overwrite any existing cluster entry with the same name.
| No | false | boolean |
perform-login | Whether to perform a login with the Azure CLI.
(See https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal
for the required environment variables)
| No | false | boolean |
resource-group | Resource group that the AKS cluster belongs to.
| Yes | - | string |
subscription | Name or ID of subscription.
| No | '' | string |
Debian-based circleci/python Docker image to use
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
debian-release | - | No | stretch | string |
python-version | - | No | '3.7' | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
commands:
create-cluster:
description: |
Creates an AKS cluster and optionally the required resource group.
parameters:
admin-username:
default: ""
description: |
Specify the name of the user account to create on node VMs for SSH access.
type: string
client-secret:
default: AZURE_SP_PASSWORD
description: |
Name of environment variable that stores the secret associated with the service principal. Required if "service-principal" is specified.
type: env_var_name
cluster-name:
description: |
Name of the AKS cluster to be created
type: string
create-resource-group:
default: false
description: |
Whether the specified resource group is to be created.
type: boolean
dns-name-prefix:
default: ""
description: |
Prefix for hostnames that are created.
If not specified, a hostname will be generated based on the managed cluster and resource group names.
type: string
generate-ssh-keys:
default: false
description: |
Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
type: boolean
kubernetes-version:
default: ""
description: |
Version of Kubernetes to use for creating the cluster, such as "1.11.8" or "1.12.6".
type: string
location:
default: ""
description: |
Location that the AKS cluster will be created in.
The location is required if "create-resource-group" is set to true.
type: string
no-output-timeout:
default: 45m
description: |
Elapsed time that the cluster creation command can run on CircleCI without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
no-ssh-key:
default: true
description: |
Do not use or create a local SSH key.
type: boolean
no-wait:
default: false
description: |
Enable this to skip waiting for the long-running operation to finish.
type: boolean
node-count:
default: -1
description: |
Configures the number of nodes in the Kubernetes node pool.
A value of -1 will be ignored.
type: integer
node-osdisk-size:
default: -1
description: |
Size in GB of the OS disk for each node in the node pool. Minimum 30 GB.
A value of -1 will be ignored.
type: integer
node-vm-size:
default: ""
description: |
Size of Virtual Machines to create as Kubernetes nodes.
type: string
resource-group:
description: |
Resource group that the AKS cluster will be created in.
type: string
resource-group-tags:
default: ""
description: |
Space-separated tags in 'key[=value]' format, for the resource group to be created.
Only effective when create-resource-group is set to true.
type: string
service-principal:
default: AZURE_SP
description: |
Name of environment variable that stores the service principal used for authentication to Azure APIs.
type: env_var_name
show-az-command:
default: false
description: |
Whether to show the az command(s) run.
type: boolean
skip-kubectl-install:
default: false
description: |
Whether to skip the installation of kubectl.
type: boolean
ssh-key-value:
default: ""
description: |
Public key path or key contents to install on node VMs for SSH access.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
tags:
default: ""
description: |
Space-separated tags in 'key[=value]' format, for the cluster.
type: string
steps:
- unless:
condition: << parameters.skip-kubectl-install >>
steps:
- kubernetes/install
- when:
condition: << parameters.create-resource-group >>
steps:
- run:
command: |
LOCATION="<< parameters.location >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
TAGS="<< parameters.resource-group-tags >>"
if [ -n "${LOCATION}" ]; then
set -- "$@" --location "${LOCATION}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --name "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
if [ -n "${TAGS}" ]; then
set -- "$@" --tags "${TAGS}"
fi
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
az group create "$@"
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
name: Create AKS resource group
- run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
LOCATION="<< parameters.location >>"
SUBSCRIPTION="<< parameters.subscription >>"
SERVICE_PRINCIPAL="$<< parameters.service-principal >>"
CLIENT_SECRET="$<< parameters.client-secret >>"
NODE_COUNT="<< parameters.node-count >>"
NODE_OSDISK_SIZE="<< parameters.node-osdisk-size >>"
NODE_VM_SIZE="<< parameters.node-vm-size >>"
GENERATE_SSH_KEYS="<< parameters.generate-ssh-keys >>"
NO_SSH_KEY="<< parameters.no-ssh-key >>"
SSH_KEY_VALUE="<< parameters.ssh-key-value >>"
ADMIN_USERNAME="<< parameters.admin-username >>"
DNS_NAME_PREFIX="<< parameters.dns-name-prefix >>"
KUBERNETES_VERSION="<< parameters.kubernetes-version >>"
TAGS="<< parameters.tags >>"
NO_WAIT="<< parameters.no-wait >>"
if [ -n "${CLUSTER_NAME}" ]; then
set -- "$@" --name "${CLUSTER_NAME}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --resource-group "${RESOURCE_GROUP}"
fi
if [ -n "${LOCATION}" ]; then
set -- "$@" --location "${LOCATION}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
if [ -n "${SERVICE_PRINCIPAL}" ]; then
set -- "$@" --service-principal "${SERVICE_PRINCIPAL}"
fi
if [ -n "${CLIENT_SECRET}" ]; then
set -- "$@" --client-secret "${CLIENT_SECRET}"
fi
if [ "${NODE_COUNT}" != "-1" ]; then
set -- "$@" --node-count "${NODE_COUNT}"
fi
if [ "${NODE_OSDISK_SIZE}" != "-1" ]; then
set -- "$@" --node-osdisk-size "${NODE_OSDISK_SIZE}"
fi
if [ -n "${NODE_VM_SIZE}" ]; then
set -- "$@" --node-vm-size "${NODE_VM_SIZE}"
fi
if [ "${GENERATE_SSH_KEYS}" == "true" ]; then
set -- "$@" --generate-ssh-keys
fi
if [ "${NO_SSH_KEY}" == "true" ]; then
set -- "$@" --no-ssh-key
fi
if [ -n "${SSH_KEY_VALUE}" ]; then
set -- "$@" --ssh-key-value "${SSH_KEY_VALUE}"
fi
if [ -n "${ADMIN_USERNAME}" ]; then
set -- "$@" --admin-username "${ADMIN_USERNAME}"
fi
if [ -n "${DNS_NAME_PREFIX}" ]; then
set -- "$@" --dns-name-prefix "${DNS_NAME_PREFIX}"
fi
if [ -n "${KUBERNETES_VERSION}" ]; then
set -- "$@" --kubernetes-version "${KUBERNETES_VERSION}"
fi
if [ -n "${TAGS}" ]; then
set -- "$@" --tags "${TAGS}"
fi
if [ "${NO_WAIT}" == "true" ]; then
set -- "$@" --no-wait
fi
az aks create "$@"
name: Create AKS cluster
no_output_timeout: << parameters.no-output-timeout >>
- run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
if [ -n "${CLUSTER_NAME}" ]; then
set -- "$@" --name "${CLUSTER_NAME}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --resource-group "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
az aks show "$@"
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
name: Verify cluster
delete-cluster:
description: |
Deletes the cluster and optionally the associated resources.
parameters:
cluster-name:
description: |
Name of the cluster to be deleted.
type: string
delete-resource-group:
default: false
description: |
Whether the specified resource group is to be deleted.
type: boolean
delete-service-principal:
description: |
Whether the service principal for the cluster should also be deleted.
type: boolean
no-output-timeout:
default: 30m
description: |
Elapsed time that the cluster deletion command can run without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
no-wait:
default: false
description: |
Enable this to skip waiting for the long-running operation to finish.
type: boolean
resource-group:
description: |
Resource group that the cluster is in.
type: string
show-az-command:
default: false
description: |
Whether to show the az command(s) used.
type: boolean
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
steps:
- when:
condition: << parameters.delete-service-principal >>
steps:
run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
if [ -n "${CLUSTER_NAME}" ]; then
set -- "$@" --name "${CLUSTER_NAME}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --resource-group "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
set -- "$@" --query servicePrincipalProfile.clientId -o tsv
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
SERVICE_PRINCIPAL_ID=$(az aks show "$@")
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
echo "${SERVICE_PRINCIPAL_ID}" > cci_aks_orb_sp_id_${CLUSTER_NAME}_${RESOURCE_GROUP}
name: Get the id of the Service Principal for the cluster
- when:
condition: << parameters.delete-resource-group >>
steps:
- run:
command: |
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
NO_WAIT="<< parameters.no-wait >>"
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --name "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
if [ "${NO_WAIT}" == "true" ]; then
set -- "$@" --no-wait
fi
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
az group delete "$@" --yes
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
name: Delete AKS cluster and associated resources (e.g. resource group)
no_output_timeout: << parameters.no-output-timeout >>
- unless:
condition: << parameters.delete-resource-group >>
steps:
- run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
NO_WAIT="<< parameters.no-wait >>"
if [ -n "${CLUSTER_NAME}" ]; then
set -- "$@" --name "${CLUSTER_NAME}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --resource-group "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
if [ "${NO_WAIT}" == "true" ]; then
set -- "$@" --no-wait
fi
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
az aks delete "$@" --yes
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
name: Delete AKS cluster
no_output_timeout: << parameters.no-output-timeout >>
- when:
condition: << parameters.delete-service-principal >>
steps:
run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
SERVICE_PRINCIPAL_ID=$(cat cci_aks_orb_sp_id_${CLUSTER_NAME}_${RESOURCE_GROUP})
set -- "$@" --id "${SERVICE_PRINCIPAL_ID}"
<<# parameters.show-az-command >>set -x<</ parameters.show-az-command >>
az ad sp delete "$@"
<<# parameters.show-az-command >>set +x<</ parameters.show-az-command >>
name: Delete the Service Principal for the cluster
update-kubeconfig-with-credentials:
description: |
Allows the kubectl client to work with an AKS cluster.
Updates the kubectl configuration file with AKS cluster access credentials.
parameters:
cluster-name:
description: |
The name of the cluster for which to create a kubeconfig entry.
type: string
file:
default: ""
description: |
Kubernetes configuration file to update. Use "-" to print YAML to stdout instead.
type: string
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials instead of cluster user credentials.
type: boolean
install-kubectl:
default: false
description: |
Whether to install kubectl
type: boolean
overwrite-existing:
default: false
description: |
Whether to overwrite any existing cluster entry with the same name.
type: boolean
perform-login:
default: false
description: |
Whether to perform a login with the Azure CLI.
(See https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal
for the required environment variables)
type: boolean
resource-group:
description: |
Resource group that the AKS cluster belongs to.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
steps:
- azure-cli/install
- when:
condition: << parameters.perform-login >>
steps:
- azure-cli/login-with-user-or-service-principal
- when:
condition: << parameters.install-kubectl >>
steps:
- kubernetes/install
- run:
command: |
CLUSTER_NAME="<< parameters.cluster-name >>"
RESOURCE_GROUP="<< parameters.resource-group >>"
SUBSCRIPTION="<< parameters.subscription >>"
GET_ADMIN_CREDENTIALS="<< parameters.get-admin-credentials >>"
FILE="<< parameters.file >>"
OVERWRITE_EXISTING="<< parameters.overwrite-existing >>"
if [ -n "${CLUSTER_NAME}" ]; then
set -- "$@" --name "${CLUSTER_NAME}"
fi
if [ -n "${RESOURCE_GROUP}" ]; then
set -- "$@" --resource-group "${RESOURCE_GROUP}"
fi
if [ -n "${SUBSCRIPTION}" ]; then
set -- "$@" --subscription "${SUBSCRIPTION}"
fi
if [ "${GET_ADMIN_CREDENTIALS}" == "true" ]; then
set -- "$@" --admin
fi
if [ -n "${FILE}" ]; then
set -- "$@" --file "${FILE}"
fi
if [ "${OVERWRITE_EXISTING}" == "true" ]; then
set -- "$@" --overwrite-existing
fi
az aks get-credentials "$@"
name: Update the kubectl configuration file so that the cluster can be accessed
description: |
An orb for working with Azure AKS.
Project homepage: https://github.com/CircleCI-Public/azure-aks-orb
examples:
create-aks-cluster:
description: |
Create an AKS cluster, test it, and tear it down.
usage:
jobs:
test-cluster:
executor: azure-aks/default
parameters:
cluster-name:
description: |
Name of the AKS cluster
type: string
resource-group:
description: |
Resource group that the cluster is in
type: string
steps:
- azure-aks/update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
- run:
command: |
kubectl get services
name: Test cluster
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: my-aks-demo
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: my-aks-demo-rg
- test-cluster:
cluster-name: my-aks-demo
requires:
- azure-aks/create-cluster
resource-group: my-aks-demo-rg
- azure-aks/delete-cluster:
cluster-name: my-aks-demo
delete-resource-group: true
delete-service-principal: true
requires:
- test-cluster
resource-group: my-aks-demo-rg
create-k8s-deployment:
description: |
Create a kubernetes deployment.
usage:
jobs:
create-deployment:
executor: azure-aks/default
parameters:
cluster-name:
description: |
Name of the AKS cluster
type: string
resource-group:
description: |
Resource group that the cluster is in
type: string
steps:
- checkout
- azure-aks/update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
- kubernetes/create-or-update-resource:
resource-file-path: tests/nginx-deployment/deployment.yaml
resource-name: deployment/nginx-deployment
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: aks-demo-deployment
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: aks-demo-deployment-rg
- create-deployment:
cluster-name: aks-demo-deployment
requires:
- azure-aks/create-cluster
resource-group: aks-demo-deployment-rg
- azure-aks/update-container-image:
cluster-name: aks-demo-deployment
container-image-updates: nginx=nginx:1.9.1
post-steps:
- kubernetes/delete-resource:
resource-names: nginx-deployment
resource-types: deployment
wait: true
record: true
requires:
- create-deployment
resource-group: aks-demo-deployment-rg
resource-name: deployment/nginx-deployment
- azure-aks/delete-cluster:
cluster-name: aks-demo-deployment
delete-resource-group: true
delete-service-principal: true
requires:
- azure-aks/update-container-image
resource-group: aks-demo-deployment-rg
install-helm-chart:
description: |
Install a helm chart on a cluster.
usage:
orbs:
azure-aks: circleci/azure-aks@0.2.1
kubernetes: circleci/kubernetes@0.4.0
version: 2.1
workflows:
deployment:
jobs:
- azure-aks/create-cluster:
cluster-name: my-aks-helm-demo
create-resource-group: true
generate-ssh-keys: true
location: eastus
resource-group: my-aks-helm-demo-rg
- azure-aks/install-helm-on-cluster:
cluster-name: my-aks-helm-demo
enable-cluster-wide-admin-access: true
requires:
- azure-aks/create-cluster
resource-group: my-aks-helm-demo-rg
- azure-aks/install-helm-chart:
chart: stable/grafana
cluster-name: my-aks-helm-demo
release-name: grafana-release
requires:
- azure-aks/install-helm-on-cluster
resource-group: my-aks-helm-demo-rg
- azure-aks/delete-helm-release:
cluster-name: my-aks-helm-demo
release-name: grafana-release
requires:
- azure-aks/install-helm-chart
resource-group: my-aks-helm-demo-rg
- azure-aks/delete-cluster:
cluster-name: my-aks-helm-demo
delete-resource-group: true
delete-service-principal: true
requires:
- azure-aks/delete-helm-release
resource-group: my-aks-helm-demo-rg
executors:
azure-docker:
description: |
Microsoft's Azure CLI Docker image
docker:
- image: mcr.microsoft.com/azure-cli
default:
description: |
Debian-based circleci/python Docker image to use
docker:
- image: circleci/python:<<parameters.python-version>>-<<parameters.debian-release>>
parameters:
debian-release:
default: stretch
type: string
python-version:
default: "3.7"
type: string
jobs:
create-cluster:
description: |
Creates an AKS cluster and optionally the required resource group.
Requirements: Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
admin-username:
default: ""
description: |
Specify the name of the user account to create on node VMs for SSH access.
type: string
client-secret:
default: AZURE_SP_PASSWORD
description: |
Name of environment variable that stores the secret associated with the service principal. Required if "service-principal" is specified.
type: env_var_name
cluster-name:
description: |
Name of the AKS cluster to be created
type: string
create-resource-group:
default: false
description: |
Whether the specified resource group is to be created.
type: boolean
dns-name-prefix:
default: ""
description: |
Prefix for hostnames that are created.
If not specified, a hostname will be generated based on the managed cluster and resource group names.
type: string
executor:
default: default
description: |
Executor to use for this job.
type: executor
generate-ssh-keys:
default: false
description: |
Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
type: boolean
kubernetes-version:
default: ""
description: |
Version of Kubernetes to use for creating the cluster, such as "1.11.8" or "1.12.6".
type: string
location:
default: ""
description: |
Location that the AKS cluster will be created in.
The location is required if "create-resource-group" is set to true.
type: string
no-output-timeout:
default: 45m
description: |
Elapsed time that the cluster creation command can run on CircleCI without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
no-ssh-key:
default: true
description: |
Do not use or create a local SSH key.
type: boolean
no-wait:
default: false
description: |
Enable this to skip waiting for the long-running operation to finish.
type: boolean
node-count:
default: -1
description: |
Configures the number of nodes in the Kubernetes node pool.
A value of -1 will be ignored.
type: integer
node-osdisk-size:
default: -1
description: |
Size in GB of the OS disk for each node in the node pool. Minimum 30 GB.
A value of -1 will be ignored.
type: integer
node-vm-size:
default: ""
description: |
Size of Virtual Machines to create as Kubernetes nodes.
type: string
resource-group:
description: |
Resource group that the AKS cluster will be created in.
type: string
resource-group-tags:
default: ""
description: |
Space-separated tags in 'key[=value]' format, for the resource group to be created.
Only effective when create-resource-group is set to true.
type: string
service-principal:
default: AZURE_SP
description: |
Name of environment variable that stores the service principal used for authentication to Azure APIs.
type: env_var_name
show-az-command:
default: false
description: |
Whether to show the az command(s) run.
type: boolean
skip-kubectl-install:
default: false
description: |
Whether to skip the installation of kubectl.
type: boolean
ssh-key-value:
default: ""
description: |
Public key path or key contents to install on node VMs for SSH access.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
tags:
default: ""
description: |
Space-separated tags in 'key[=value]' format, for the cluster to be created.
type: string
steps:
- azure-cli/install
- azure-cli/login-with-user-or-service-principal
- create-cluster:
admin-username: << parameters.admin-username >>
client-secret: << parameters.client-secret >>
cluster-name: << parameters.cluster-name >>
create-resource-group: << parameters.create-resource-group >>
dns-name-prefix: << parameters.dns-name-prefix >>
generate-ssh-keys: << parameters.generate-ssh-keys >>
kubernetes-version: << parameters.kubernetes-version >>
location: << parameters.location >>
no-output-timeout: << parameters.no-output-timeout >>
no-ssh-key: << parameters.no-ssh-key >>
no-wait: << parameters.no-wait >>
node-count: << parameters.node-count >>
node-osdisk-size: << parameters.node-osdisk-size >>
node-vm-size: << parameters.node-vm-size >>
resource-group: << parameters.resource-group >>
resource-group-tags: << parameters.resource-group-tags >>
service-principal: << parameters.service-principal >>
show-az-command: << parameters.show-az-command >>
skip-kubectl-install: false
ssh-key-value: << parameters.ssh-key-value >>
subscription: << parameters.subscription >>
tags: << parameters.tags >>
delete-cluster:
description: |
Deletes the AKS cluster and optionally the associated resources.
Requirements: Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
cluster-name:
description: |
Name of the AKS cluster to be deleted.
type: string
delete-resource-group:
default: false
description: |
Whether the specified resource group is to be deleted.
type: boolean
delete-service-principal:
description: |
Whether the service principal for the cluster should also be deleted.
type: boolean
executor:
default: default
description: |
Executor to use for this job.
type: executor
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials instead of cluster user credentials.
type: boolean
no-output-timeout:
default: 30m
description: |
Elapsed time that the cluster deletion command can run without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
no-wait:
default: false
description: |
Enable this to skip waiting for the long-running operation to finish.
type: boolean
resource-group:
description: |
Resource group that the AKS cluster is in.
type: string
show-az-command:
default: false
description: |
Whether to show the az command(s) used.
type: boolean
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
steps:
- update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
get-admin-credentials: << parameters.get-admin-credentials >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
subscription: << parameters.subscription >>
- delete-cluster:
cluster-name: << parameters.cluster-name >>
delete-resource-group: << parameters.delete-resource-group >>
delete-service-principal: << parameters.delete-service-principal >>
no-output-timeout: << parameters.no-output-timeout >>
no-wait: << parameters.no-wait >>
resource-group: << parameters.resource-group >>
show-az-command: << parameters.show-az-command >>
subscription: << parameters.subscription >>
delete-helm-release:
description: |
Deletes a helm release.
Requirements: helm should be installed on the cluster.
Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
cluster-name:
description: |
The name of the AKS cluster.
type: string
executor:
default: default
description: |
Executor to use for this job.
type: executor
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials instead of cluster user credentials.
type: boolean
namespace:
default: ""
description: |
The kubernetes namespace that should be used.
type: string
purge:
default: false
description: |
Whether to remove the release from the store and make its name free for
later use
type: boolean
release-name:
description: |
Specify the release to be deleted.
type: string
resource-group:
description: |
Resource group that the AKS cluster is in.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
tiller-namespace:
default: ""
description: |
Specify the namespace of Tiller
type: string
timeout:
default: -1
description: |
Specify time in seconds to wait for any individual Kubernetes operation
(like Jobs for hooks)
A value of -1 will be ignored.
type: integer
tls:
default: false
description: |
Enable TLS for the request
type: boolean
tls-ca-cert:
default: ""
description: |
Path to TLS CA certificate file
type: string
tls-cert:
default: ""
description: |
Path to TLS certificate file
type: string
tls-hostname:
default: ""
description: |
The server name used to verify the hostname on the returned
certificates from the server
type: string
tls-key:
default: ""
description: |
Path to TLS key file
type: string
tls-verify:
default: false
description: |
Enable TLS for request and verify remote
type: boolean
steps:
- update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
get-admin-credentials: << parameters.get-admin-credentials >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
subscription: << parameters.subscription >>
- helm/delete-helm-release:
namespace: << parameters.namespace >>
purge: << parameters.purge >>
release-name: << parameters.release-name >>
tiller-namespace: << parameters.tiller-namespace >>
timeout: << parameters.timeout >>
tls: << parameters.tls >>
tls-ca-cert: << parameters.tls-ca-cert >>
tls-cert: << parameters.tls-cert >>
tls-hostname: << parameters.tls-hostname >>
tls-key: << parameters.tls-key >>
tls-verify: << parameters.tls-verify >>
install-helm-chart:
description: |
Installs a helm chart into the AKS cluster.
Requirements: Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
chart:
description: |
Specify for installation a chart reference (e.g. stable/mariadb),
or a path to a packaged chart (e.g. ./nginx-1.2.3.tgz),
or a path to an unpacked chart directory (e.g. ./nginx)
or an absolute URL (e.g. https://example.com/charts/nginx-1.2.3.tgz)
type: string
cluster-name:
description: |
The name of the AKS cluster.
type: string
executor:
default: default
description: |
Executor to use for this job.
type: executor
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials instead of cluster user credentials.
type: boolean
namespace:
default: ""
description: |
The kubernetes namespace that should be used.
type: string
release-name:
default: ""
description: |
Specify a name for the release.
type: string
resource-group:
description: |
Resource group that the AKS cluster is in.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
tiller-namespace:
default: ""
description: |
Specify the namespace of Tiller
type: string
tls:
default: false
description: |
Enable TLS for the request
type: boolean
tls-ca-cert:
default: ""
description: |
Path to TLS CA certificate file
type: string
tls-cert:
default: ""
description: |
Path to TLS certificate file
type: string
tls-hostname:
default: ""
description: |
The server name used to verify the hostname on the returned
certificates from the server
type: string
tls-key:
default: ""
description: |
Path to TLS key file
type: string
tls-verify:
default: false
description: |
Enable TLS for request and verify remote
type: boolean
values-to-override:
default: ""
description: |
Override values in a chart using the --set flag of the helm install
command. Format: key1=val1,key2=val2
type: string
wait:
default: true
description: |
Whether to wait for the installation to be complete
type: boolean
steps:
- update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
get-admin-credentials: << parameters.get-admin-credentials >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
subscription: << parameters.subscription >>
- helm/install-helm-chart:
chart: << parameters.chart >>
namespace: << parameters.namespace >>
release-name: << parameters.release-name >>
tiller-namespace: << parameters.tiller-namespace >>
tls: << parameters.tls >>
tls-ca-cert: << parameters.tls-ca-cert >>
tls-cert: << parameters.tls-cert >>
tls-hostname: << parameters.tls-hostname >>
tls-key: << parameters.tls-key >>
tls-verify: << parameters.tls-verify >>
values-to-override: << parameters.values-to-override >>
wait: << parameters.wait >>
install-helm-on-cluster:
description: |
Installs helm onto the AKS cluster.
Note: Parameters like tiller-tls need to be set to
apply security configurations to the tiller configuration.
Requirements: Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
cluster-name:
description: |
The name of the AKS cluster.
type: string
enable-cluster-wide-admin-access:
default: false
description: |
Allow tiller to have admin access to the entire AKS cluster
by creating a role binding with a cluster-admin role
and a service account with name as specified by the service-account
parameter or defaulting to "tiller".
Note: This is a convenience option but is typically not advisable
in a production cluster for security reasons.
type: boolean
executor:
default: default
description: |
Executor to use for this job.
type: executor
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials for updating kubeconfig
instead of cluster user credentials.
type: boolean
resource-group:
description: |
Resource group that the AKS cluster is in.
type: string
service-account:
default: ""
description: |
Name of service account to Tiller to use.
Note: A role binding which specifies a role
and a service account with the specified name, must
be created in advance, unless
enable-cluster-wide-admin-access is set to true.
type: string
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
tiller-ca-cert:
default: ""
description: |
The path to CA root certificate
type: string
tiller-namespace:
default: ""
description: |
Specify the namespace of Tiller
type: string
tiller-tls:
default: false
description: |
Install Tiller with TLS enabled
type: boolean
tiller-tls-cert:
default: ""
description: |
The path to TLS certificate file to install with Tiller
type: string
tiller-tls-hostname:
default: ""
description: |
The server name used to verify the hostname on the returned
certificates from Tiller
type: string
tiller-tls-key:
default: ""
description: |
The path to TLS key file to install with Tiller
type: string
tiller-tls-verify:
default: false
description: |
Install Tiller with TLS enabled and to verify remote certificates
type: boolean
wait:
default: true
description: |
Block until Tiller is running and ready to receive requests
type: boolean
steps:
- update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
get-admin-credentials: << parameters.get-admin-credentials >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
subscription: << parameters.subscription >>
- helm/install-helm-on-cluster:
enable-cluster-wide-admin-access: << parameters.enable-cluster-wide-admin-access >>
service-account: << parameters.service-account >>
tiller-ca-cert: << parameters.tiller-ca-cert >>
tiller-namespace: << parameters.tiller-namespace >>
tiller-tls: << parameters.tiller-tls >>
tiller-tls-cert: << parameters.tiller-tls-cert >>
tiller-tls-hostname: << parameters.tiller-tls-hostname >>
tiller-tls-key: << parameters.tiller-tls-key >>
tiller-tls-verify: << parameters.tiller-tls-verify >>
wait: << parameters.wait >>
update-container-image:
description: |
Updates the container image(s) of a resource on AKS.
Requirements: Login to Azure is done via the azure-cli Orb and
requires environment variables storing the Azure user
or Service Principal credentials to be defined (See:
https://circleci.com/orbs/registry/orb/circleci/azure-cli#commands-login-with-user-or-service-principal)
executor: << parameters.executor >>
parameters:
cluster-name:
default: ""
description: |
The name of the cluster where the resource is to be managed.
type: string
container-image-updates:
description: |
Specify a list of container image updates
(space-delimited name value pairs in the form
CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N)
to be applied to the resource via `kubectl set image`.
e.g. "busybox=busybox nginx=nginx:1.9.1"
type: string
executor:
default: default
description: |
Executor to use for this job.
type: executor
get-admin-credentials:
default: false
description: |
Get cluster administrator credentials instead of cluster user credentials.
type: boolean
get-rollout-status:
default: false
description: |
Get the status of the rollout.
This can only be used for resource types that are valid
for usage with `kubectl rollout` subcommands.
type: boolean
namespace:
default: ""
description: |
The kubernetes namespace that should be used.
type: string
pinned-revision-to-watch:
default: ""
description: |
Pin a specific revision to be watched and abort watching if it is rolled
over by another revision.
Only effective if get-rollout-status is set to true.
type: string
record:
default: false
description: |
Whether to record the update
type: boolean
resource-file-path:
default: ""
description: |
Path to file used to update the resource.
Either resource-file-path or resource-name need to be specified.
type: string
resource-group:
default: ""
description: |
Resource group that the AKS cluster is in.
type: string
resource-name:
default: ""
description: |
Resource name in the format TYPE/NAME e.g. deployment/nginx-deployment
Either resource-file-path or resource-name need to be specified.
This is required if get-rollout-status is set to true.
type: string
show-kubectl-command:
default: false
description: |
Whether to show the kubectl command used.
type: boolean
subscription:
default: ""
description: |
Name or ID of subscription.
type: string
watch-rollout-status:
default: true
description: |
Whether to watch the status of the latest rollout until it's done.
Only effective if get-rollout-status is set to true.
type: boolean
watch-timeout:
default: ""
description: |
The length of time to wait before ending the watch, zero means never.
Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
Only effective if get-rollout-status is set to true.
type: string
steps:
- update-kubeconfig-with-credentials:
cluster-name: << parameters.cluster-name >>
get-admin-credentials: << parameters.get-admin-credentials >>
install-kubectl: true
perform-login: true
resource-group: << parameters.resource-group >>
subscription: << parameters.subscription >>
- kubernetes/update-container-image:
container-image-updates: << parameters.container-image-updates >>
get-rollout-status: << parameters.get-rollout-status >>
namespace: << parameters.namespace >>
pinned-revision-to-watch: << parameters.pinned-revision-to-watch >>
record: << parameters.record >>
resource-file-path: << parameters.resource-file-path >>
resource-name: << parameters.resource-name >>
show-kubectl-command: << parameters.show-kubectl-command >>
watch-rollout-status: << parameters.watch-rollout-status >>
watch-timeout: << parameters.watch-timeout >>
orbs:
azure-cli: circleci/azure-cli@1.1.0
helm: circleci/helm@0.1.0
kubernetes: circleci/kubernetes@0.4.0
version: 2.1