forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convertertoapi.go
1199 lines (1103 loc) · 44 KB
/
convertertoapi.go
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
package api
import (
"github.com/Azure/acs-engine/pkg/api/common"
"github.com/Azure/acs-engine/pkg/api/v20160330"
"github.com/Azure/acs-engine/pkg/api/v20160930"
"github.com/Azure/acs-engine/pkg/api/v20170131"
"github.com/Azure/acs-engine/pkg/api/v20170701"
"github.com/Azure/acs-engine/pkg/api/vlabs"
"github.com/Azure/acs-engine/pkg/helpers"
)
///////////////////////////////////////////////////////////
// The converter exposes functions to convert the top level
// ContainerService resource
//
// All other functions are internal helper functions used
// for converting.
///////////////////////////////////////////////////////////
// ConvertV20160930ContainerService converts a v20160930 ContainerService to an unversioned ContainerService
func ConvertV20160930ContainerService(v20160930 *v20160930.ContainerService) *ContainerService {
c := &ContainerService{}
c.ID = v20160930.ID
c.Location = helpers.NormalizeAzureRegion(v20160930.Location)
c.Name = v20160930.Name
if v20160930.Plan != nil {
c.Plan = &ResourcePurchasePlan{}
convertV20160930ResourcePurchasePlan(v20160930.Plan, c.Plan)
}
c.Tags = map[string]string{}
for k, v := range v20160930.Tags {
c.Tags[k] = v
}
c.Type = v20160930.Type
c.Properties = &Properties{}
convertV20160930Properties(v20160930.Properties, c.Properties)
return c
}
// ConvertV20160330ContainerService converts a v20160330 ContainerService to an unversioned ContainerService
func ConvertV20160330ContainerService(v20160330 *v20160330.ContainerService) *ContainerService {
c := &ContainerService{}
c.ID = v20160330.ID
c.Location = helpers.NormalizeAzureRegion(v20160330.Location)
c.Name = v20160330.Name
if v20160330.Plan != nil {
c.Plan = &ResourcePurchasePlan{}
convertV20160330ResourcePurchasePlan(v20160330.Plan, c.Plan)
}
c.Tags = map[string]string{}
for k, v := range v20160330.Tags {
c.Tags[k] = v
}
c.Type = v20160330.Type
c.Properties = &Properties{}
convertV20160330Properties(v20160330.Properties, c.Properties)
return c
}
// ConvertV20170131ContainerService converts a v20170131 ContainerService to an unversioned ContainerService
func ConvertV20170131ContainerService(v20170131 *v20170131.ContainerService) *ContainerService {
c := &ContainerService{}
c.ID = v20170131.ID
c.Location = helpers.NormalizeAzureRegion(v20170131.Location)
c.Name = v20170131.Name
if v20170131.Plan != nil {
c.Plan = &ResourcePurchasePlan{}
convertV20170131ResourcePurchasePlan(v20170131.Plan, c.Plan)
}
c.Tags = map[string]string{}
for k, v := range v20170131.Tags {
c.Tags[k] = v
}
c.Type = v20170131.Type
c.Properties = &Properties{}
convertV20170131Properties(v20170131.Properties, c.Properties)
return c
}
// ConvertV20170701ContainerService converts a v20170701 ContainerService to an unversioned ContainerService
func ConvertV20170701ContainerService(v20170701 *v20170701.ContainerService) *ContainerService {
c := &ContainerService{}
c.ID = v20170701.ID
c.Location = helpers.NormalizeAzureRegion(v20170701.Location)
c.Name = v20170701.Name
if v20170701.Plan != nil {
c.Plan = &ResourcePurchasePlan{}
convertV20170701ResourcePurchasePlan(v20170701.Plan, c.Plan)
}
c.Tags = map[string]string{}
for k, v := range v20170701.Tags {
c.Tags[k] = v
}
c.Type = v20170701.Type
c.Properties = &Properties{}
convertV20170701Properties(v20170701.Properties, c.Properties)
return c
}
// ConvertVLabsContainerService converts a vlabs ContainerService to an unversioned ContainerService
func ConvertVLabsContainerService(vlabs *vlabs.ContainerService) *ContainerService {
c := &ContainerService{}
c.ID = vlabs.ID
c.Location = helpers.NormalizeAzureRegion(vlabs.Location)
c.Name = vlabs.Name
if vlabs.Plan != nil {
c.Plan = &ResourcePurchasePlan{}
convertVLabsResourcePurchasePlan(vlabs.Plan, c.Plan)
}
c.Tags = map[string]string{}
for k, v := range vlabs.Tags {
c.Tags[k] = v
}
c.Type = vlabs.Type
c.Properties = &Properties{}
convertVLabsProperties(vlabs.Properties, c.Properties)
return c
}
// convertV20160930ResourcePurchasePlan converts a v20160930 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertV20160930ResourcePurchasePlan(v20160930 *v20160930.ResourcePurchasePlan, api *ResourcePurchasePlan) {
api.Name = v20160930.Name
api.Product = v20160930.Product
api.PromotionCode = v20160930.PromotionCode
api.Publisher = v20160930.Publisher
}
// convertV20160330ResourcePurchasePlan converts a v20160330 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertV20160330ResourcePurchasePlan(v20160330 *v20160330.ResourcePurchasePlan, api *ResourcePurchasePlan) {
api.Name = v20160330.Name
api.Product = v20160330.Product
api.PromotionCode = v20160330.PromotionCode
api.Publisher = v20160330.Publisher
}
// convertV20170131ResourcePurchasePlan converts a v20170131 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertV20170131ResourcePurchasePlan(v20170131 *v20170131.ResourcePurchasePlan, api *ResourcePurchasePlan) {
api.Name = v20170131.Name
api.Product = v20170131.Product
api.PromotionCode = v20170131.PromotionCode
api.Publisher = v20170131.Publisher
}
// convertV20170701ResourcePurchasePlan converts a v20170701 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertV20170701ResourcePurchasePlan(v20170701 *v20170701.ResourcePurchasePlan, api *ResourcePurchasePlan) {
api.Name = v20170701.Name
api.Product = v20170701.Product
api.PromotionCode = v20170701.PromotionCode
api.Publisher = v20170701.Publisher
}
// convertVLabsResourcePurchasePlan converts a vlabs ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertVLabsResourcePurchasePlan(vlabs *vlabs.ResourcePurchasePlan, api *ResourcePurchasePlan) {
api.Name = vlabs.Name
api.Product = vlabs.Product
api.PromotionCode = vlabs.PromotionCode
api.Publisher = vlabs.Publisher
}
func convertV20160930Properties(v20160930 *v20160930.Properties, api *Properties) {
api.ProvisioningState = ProvisioningState(v20160930.ProvisioningState)
if v20160930.OrchestratorProfile != nil {
api.OrchestratorProfile = &OrchestratorProfile{}
convertV20160930OrchestratorProfile(v20160930.OrchestratorProfile, api.OrchestratorProfile)
}
if v20160930.MasterProfile != nil {
api.MasterProfile = &MasterProfile{}
convertV20160930MasterProfile(v20160930.MasterProfile, api.MasterProfile)
}
api.AgentPoolProfiles = []*AgentPoolProfile{}
for _, p := range v20160930.AgentPoolProfiles {
apiProfile := &AgentPoolProfile{}
// api.OrchestratorProfile already be filled in correctly
if api.OrchestratorProfile.IsKubernetes() {
// we only allow AvailabilitySet for kubernetes's agentpool
convertV20160930AgentPoolProfile(p, AvailabilitySet, apiProfile)
} else {
// other orchestrators all use VMSS
convertV20160930AgentPoolProfile(p, VirtualMachineScaleSets, apiProfile)
}
api.AgentPoolProfiles = append(api.AgentPoolProfiles, apiProfile)
}
if v20160930.LinuxProfile != nil {
api.LinuxProfile = &LinuxProfile{}
convertV20160930LinuxProfile(v20160930.LinuxProfile, api.LinuxProfile)
}
if v20160930.WindowsProfile != nil {
api.WindowsProfile = &WindowsProfile{}
convertV20160930WindowsProfile(v20160930.WindowsProfile, api.WindowsProfile)
}
if v20160930.DiagnosticsProfile != nil {
api.DiagnosticsProfile = &DiagnosticsProfile{}
convertV20160930DiagnosticsProfile(v20160930.DiagnosticsProfile, api.DiagnosticsProfile)
}
if v20160930.JumpboxProfile != nil {
api.JumpboxProfile = &JumpboxProfile{}
convertV20160930JumpboxProfile(v20160930.JumpboxProfile, api.JumpboxProfile)
}
if v20160930.ServicePrincipalProfile != nil {
api.ServicePrincipalProfile = &ServicePrincipalProfile{}
convertV20160930ServicePrincipalProfile(v20160930.ServicePrincipalProfile, api.ServicePrincipalProfile)
}
if v20160930.CustomProfile != nil {
api.CustomProfile = &CustomProfile{}
convertV20160930CustomProfile(v20160930.CustomProfile, api.CustomProfile)
}
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 1 {
addDCOSPublicAgentPool(api)
}
}
func convertV20160330Properties(v20160330 *v20160330.Properties, api *Properties) {
api.ProvisioningState = ProvisioningState(v20160330.ProvisioningState)
if v20160330.OrchestratorProfile != nil {
api.OrchestratorProfile = &OrchestratorProfile{}
convertV20160330OrchestratorProfile(v20160330.OrchestratorProfile, api.OrchestratorProfile)
}
if v20160330.MasterProfile != nil {
api.MasterProfile = &MasterProfile{}
convertV20160330MasterProfile(v20160330.MasterProfile, api.MasterProfile)
}
api.AgentPoolProfiles = []*AgentPoolProfile{}
for _, p := range v20160330.AgentPoolProfiles {
apiProfile := &AgentPoolProfile{}
convertV20160330AgentPoolProfile(p, apiProfile)
api.AgentPoolProfiles = append(api.AgentPoolProfiles, apiProfile)
}
if v20160330.LinuxProfile != nil {
api.LinuxProfile = &LinuxProfile{}
convertV20160330LinuxProfile(v20160330.LinuxProfile, api.LinuxProfile)
}
if v20160330.WindowsProfile != nil {
api.WindowsProfile = &WindowsProfile{}
convertV20160330WindowsProfile(v20160330.WindowsProfile, api.WindowsProfile)
}
if v20160330.DiagnosticsProfile != nil {
api.DiagnosticsProfile = &DiagnosticsProfile{}
convertV20160330DiagnosticsProfile(v20160330.DiagnosticsProfile, api.DiagnosticsProfile)
}
if v20160330.JumpboxProfile != nil {
api.JumpboxProfile = &JumpboxProfile{}
convertV20160330JumpboxProfile(v20160330.JumpboxProfile, api.JumpboxProfile)
}
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 1 {
addDCOSPublicAgentPool(api)
}
}
func convertV20170131Properties(v20170131 *v20170131.Properties, api *Properties) {
api.ProvisioningState = ProvisioningState(v20170131.ProvisioningState)
if v20170131.OrchestratorProfile != nil {
api.OrchestratorProfile = &OrchestratorProfile{}
convertV20170131OrchestratorProfile(v20170131.OrchestratorProfile, api.OrchestratorProfile, v20170131.HasWindows())
}
if v20170131.MasterProfile != nil {
api.MasterProfile = &MasterProfile{}
convertV20170131MasterProfile(v20170131.MasterProfile, api.MasterProfile)
}
api.AgentPoolProfiles = []*AgentPoolProfile{}
for _, p := range v20170131.AgentPoolProfiles {
apiProfile := &AgentPoolProfile{}
// api.OrchestratorProfile already be filled in correctly
if api.OrchestratorProfile.IsKubernetes() {
// we only allow AvailabilitySet for kubernetes's agentpool
convertV20170131AgentPoolProfile(p, AvailabilitySet, apiProfile)
} else {
// other orchestrators all use VMSS
convertV20170131AgentPoolProfile(p, VirtualMachineScaleSets, apiProfile)
}
api.AgentPoolProfiles = append(api.AgentPoolProfiles, apiProfile)
}
if v20170131.LinuxProfile != nil {
api.LinuxProfile = &LinuxProfile{}
convertV20170131LinuxProfile(v20170131.LinuxProfile, api.LinuxProfile)
}
if v20170131.WindowsProfile != nil {
api.WindowsProfile = &WindowsProfile{}
convertV20170131WindowsProfile(v20170131.WindowsProfile, api.WindowsProfile)
}
if v20170131.DiagnosticsProfile != nil {
api.DiagnosticsProfile = &DiagnosticsProfile{}
convertV20170131DiagnosticsProfile(v20170131.DiagnosticsProfile, api.DiagnosticsProfile)
}
if v20170131.JumpboxProfile != nil {
api.JumpboxProfile = &JumpboxProfile{}
convertV20170131JumpboxProfile(v20170131.JumpboxProfile, api.JumpboxProfile)
}
if v20170131.ServicePrincipalProfile != nil {
api.ServicePrincipalProfile = &ServicePrincipalProfile{}
convertV20170131ServicePrincipalProfile(v20170131.ServicePrincipalProfile, api.ServicePrincipalProfile)
}
if v20170131.CustomProfile != nil {
api.CustomProfile = &CustomProfile{}
convertV20170131CustomProfile(v20170131.CustomProfile, api.CustomProfile)
}
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 1 {
addDCOSPublicAgentPool(api)
}
}
func convertV20170701Properties(v20170701 *v20170701.Properties, api *Properties) {
api.ProvisioningState = ProvisioningState(v20170701.ProvisioningState)
if v20170701.OrchestratorProfile != nil {
api.OrchestratorProfile = &OrchestratorProfile{}
convertV20170701OrchestratorProfile(v20170701.OrchestratorProfile, api.OrchestratorProfile, v20170701.HasWindows())
}
if v20170701.MasterProfile != nil {
api.MasterProfile = &MasterProfile{}
convertV20170701MasterProfile(v20170701.MasterProfile, api.MasterProfile)
}
api.AgentPoolProfiles = []*AgentPoolProfile{}
for _, p := range v20170701.AgentPoolProfiles {
apiProfile := &AgentPoolProfile{}
// api.OrchestratorProfile already be filled in correctly
if api.OrchestratorProfile.IsKubernetes() {
// we only allow AvailabilitySet for kubernetes's agentpool
convertV20170701AgentPoolProfile(p, AvailabilitySet, apiProfile)
} else {
// other orchestrators all use VMSS
convertV20170701AgentPoolProfile(p, VirtualMachineScaleSets, apiProfile)
// by default vlabs will use managed disks for all orchestrators but kubernetes as it has encryption at rest.
if len(p.StorageProfile) == 0 {
apiProfile.StorageProfile = ManagedDisks
}
}
api.AgentPoolProfiles = append(api.AgentPoolProfiles, apiProfile)
}
if v20170701.LinuxProfile != nil {
api.LinuxProfile = &LinuxProfile{}
convertV20170701LinuxProfile(v20170701.LinuxProfile, api.LinuxProfile)
}
if v20170701.WindowsProfile != nil {
api.WindowsProfile = &WindowsProfile{}
convertV20170701WindowsProfile(v20170701.WindowsProfile, api.WindowsProfile)
}
if v20170701.ServicePrincipalProfile != nil {
api.ServicePrincipalProfile = &ServicePrincipalProfile{}
convertV20170701ServicePrincipalProfile(v20170701.ServicePrincipalProfile, api.ServicePrincipalProfile)
}
if v20170701.CustomProfile != nil {
api.CustomProfile = &CustomProfile{}
convertV20170701CustomProfile(v20170701.CustomProfile, api.CustomProfile)
}
}
func convertVLabsProperties(vlabs *vlabs.Properties, api *Properties) {
api.ProvisioningState = ProvisioningState(vlabs.ProvisioningState)
if vlabs.OrchestratorProfile != nil {
api.OrchestratorProfile = &OrchestratorProfile{}
convertVLabsOrchestratorProfile(vlabs, api.OrchestratorProfile)
}
if vlabs.MasterProfile != nil {
api.MasterProfile = &MasterProfile{}
convertVLabsMasterProfile(vlabs.MasterProfile, api.MasterProfile)
}
api.AgentPoolProfiles = []*AgentPoolProfile{}
for _, p := range vlabs.AgentPoolProfiles {
apiProfile := &AgentPoolProfile{}
convertVLabsAgentPoolProfile(p, apiProfile)
// by default vlabs will use managed disks for all orchestrators but kubernetes as it has encryption at rest.
if !api.OrchestratorProfile.IsKubernetes() && !api.OrchestratorProfile.IsOpenShift() {
if len(p.StorageProfile) == 0 {
apiProfile.StorageProfile = ManagedDisks
}
}
api.AgentPoolProfiles = append(api.AgentPoolProfiles, apiProfile)
}
if vlabs.LinuxProfile != nil {
api.LinuxProfile = &LinuxProfile{}
convertVLabsLinuxProfile(vlabs.LinuxProfile, api.LinuxProfile)
}
api.ExtensionProfiles = []*ExtensionProfile{}
for _, p := range vlabs.ExtensionProfiles {
apiExtensionProfile := &ExtensionProfile{}
convertVLabsExtensionProfile(p, apiExtensionProfile)
api.ExtensionProfiles = append(api.ExtensionProfiles, apiExtensionProfile)
}
if vlabs.WindowsProfile != nil {
api.WindowsProfile = &WindowsProfile{}
convertVLabsWindowsProfile(vlabs.WindowsProfile, api.WindowsProfile)
}
if vlabs.ServicePrincipalProfile != nil {
api.ServicePrincipalProfile = &ServicePrincipalProfile{}
convertVLabsServicePrincipalProfile(vlabs.ServicePrincipalProfile, api.ServicePrincipalProfile)
}
if vlabs.CertificateProfile != nil {
api.CertificateProfile = &CertificateProfile{}
convertVLabsCertificateProfile(vlabs.CertificateProfile, api.CertificateProfile)
}
if vlabs.AADProfile != nil {
api.AADProfile = &AADProfile{}
convertVLabsAADProfile(vlabs.AADProfile, api.AADProfile)
}
if vlabs.AzProfile != nil {
api.AzProfile = &AzProfile{}
convertVLabsAZProfile(vlabs.AzProfile, api.AzProfile)
}
}
func convertVLabsAZProfile(vlabs *vlabs.AzProfile, api *AzProfile) {
api.Location = vlabs.Location
api.ResourceGroup = vlabs.ResourceGroup
api.SubscriptionID = vlabs.SubscriptionID
api.TenantID = vlabs.TenantID
}
func convertV20160930LinuxProfile(obj *v20160930.LinuxProfile, api *LinuxProfile) {
api.AdminUsername = obj.AdminUsername
api.SSH.PublicKeys = []PublicKey{}
for _, d := range obj.SSH.PublicKeys {
api.SSH.PublicKeys = append(api.SSH.PublicKeys,
PublicKey{KeyData: d.KeyData})
}
}
func convertV20160330LinuxProfile(v20160330 *v20160330.LinuxProfile, api *LinuxProfile) {
api.AdminUsername = v20160330.AdminUsername
api.SSH.PublicKeys = []PublicKey{}
for _, d := range v20160330.SSH.PublicKeys {
api.SSH.PublicKeys = append(api.SSH.PublicKeys,
PublicKey{KeyData: d.KeyData})
}
}
func convertV20170131LinuxProfile(v20170131 *v20170131.LinuxProfile, api *LinuxProfile) {
api.AdminUsername = v20170131.AdminUsername
api.SSH.PublicKeys = []PublicKey{}
for _, d := range v20170131.SSH.PublicKeys {
api.SSH.PublicKeys = append(api.SSH.PublicKeys, PublicKey{KeyData: d.KeyData})
}
}
func convertVLabsExtensionProfile(vlabs *vlabs.ExtensionProfile, api *ExtensionProfile) {
api.Name = vlabs.Name
api.Version = vlabs.Version
api.ExtensionParameters = vlabs.ExtensionParameters
if vlabs.ExtensionParametersKeyVaultRef != nil {
api.ExtensionParametersKeyVaultRef = &KeyvaultSecretRef{
VaultID: vlabs.ExtensionParametersKeyVaultRef.VaultID,
SecretName: vlabs.ExtensionParametersKeyVaultRef.SecretName,
SecretVersion: vlabs.ExtensionParametersKeyVaultRef.SecretVersion,
}
}
api.RootURL = vlabs.RootURL
api.Script = vlabs.Script
api.URLQuery = vlabs.URLQuery
}
func convertVLabsExtension(vlabs *vlabs.Extension, api *Extension) {
api.Name = vlabs.Name
api.SingleOrAll = vlabs.SingleOrAll
api.Template = vlabs.Template
}
func convertV20170701LinuxProfile(v20170701 *v20170701.LinuxProfile, api *LinuxProfile) {
api.AdminUsername = v20170701.AdminUsername
api.SSH.PublicKeys = []PublicKey{}
for _, d := range v20170701.SSH.PublicKeys {
api.SSH.PublicKeys = append(api.SSH.PublicKeys,
PublicKey{KeyData: d.KeyData})
}
}
func convertVLabsLinuxProfile(vlabs *vlabs.LinuxProfile, api *LinuxProfile) {
api.AdminUsername = vlabs.AdminUsername
api.SSH.PublicKeys = []PublicKey{}
for _, d := range vlabs.SSH.PublicKeys {
api.SSH.PublicKeys = append(api.SSH.PublicKeys,
PublicKey{KeyData: d.KeyData})
}
api.Secrets = []KeyVaultSecrets{}
for _, s := range vlabs.Secrets {
secret := &KeyVaultSecrets{}
convertVLabsKeyVaultSecrets(&s, secret)
api.Secrets = append(api.Secrets, *secret)
}
api.ScriptRootURL = vlabs.ScriptRootURL
if vlabs.CustomSearchDomain != nil {
api.CustomSearchDomain = &CustomSearchDomain{}
api.CustomSearchDomain.Name = vlabs.CustomSearchDomain.Name
api.CustomSearchDomain.RealmUser = vlabs.CustomSearchDomain.RealmUser
api.CustomSearchDomain.RealmPassword = vlabs.CustomSearchDomain.RealmPassword
}
if vlabs.CustomNodesDNS != nil {
api.CustomNodesDNS = &CustomNodesDNS{}
api.CustomNodesDNS.DNSServer = vlabs.CustomNodesDNS.DNSServer
}
}
func convertV20160930WindowsProfile(v20160930 *v20160930.WindowsProfile, api *WindowsProfile) {
api.AdminUsername = v20160930.AdminUsername
api.AdminPassword = v20160930.AdminPassword
}
func convertV20160330WindowsProfile(v20160330 *v20160330.WindowsProfile, api *WindowsProfile) {
api.AdminUsername = v20160330.AdminUsername
api.AdminPassword = v20160330.AdminPassword
}
func convertV20170131WindowsProfile(v20170131 *v20170131.WindowsProfile, api *WindowsProfile) {
api.AdminUsername = v20170131.AdminUsername
api.AdminPassword = v20170131.AdminPassword
}
func convertV20170701WindowsProfile(v20170701 *v20170701.WindowsProfile, api *WindowsProfile) {
api.AdminUsername = v20170701.AdminUsername
api.AdminPassword = v20170701.AdminPassword
}
func convertVLabsWindowsProfile(vlabs *vlabs.WindowsProfile, api *WindowsProfile) {
api.AdminUsername = vlabs.AdminUsername
api.AdminPassword = vlabs.AdminPassword
api.ImageVersion = vlabs.ImageVersion
api.WindowsImageSourceURL = vlabs.WindowsImageSourceURL
api.WindowsPublisher = vlabs.WindowsPublisher
api.WindowsOffer = vlabs.WindowsOffer
api.WindowsSku = vlabs.WindowsSku
api.Secrets = []KeyVaultSecrets{}
for _, s := range vlabs.Secrets {
secret := &KeyVaultSecrets{}
convertVLabsKeyVaultSecrets(&s, secret)
api.Secrets = append(api.Secrets, *secret)
}
}
func convertV20160930OrchestratorProfile(v20160930 *v20160930.OrchestratorProfile, api *OrchestratorProfile) {
api.OrchestratorType = v20160930.OrchestratorType
if api.OrchestratorType == Kubernetes {
api.OrchestratorVersion = "1.6.9"
} else if api.OrchestratorType == DCOS {
api.OrchestratorVersion = common.DCOSVersion1Dot9Dot0
}
}
func convertV20160330OrchestratorProfile(v20160330 *v20160330.OrchestratorProfile, api *OrchestratorProfile) {
api.OrchestratorType = v20160330.OrchestratorType
if api.OrchestratorType == DCOS {
api.OrchestratorVersion = common.DCOSVersion1Dot9Dot0
}
}
func convertV20170131OrchestratorProfile(v20170131 *v20170131.OrchestratorProfile, api *OrchestratorProfile, hasWindows bool) {
api.OrchestratorType = v20170131.OrchestratorType
if api.OrchestratorType == Kubernetes {
api.OrchestratorVersion = common.GetSupportedKubernetesVersion("", hasWindows)
} else if api.OrchestratorType == DCOS {
api.OrchestratorVersion = common.DCOSVersion1Dot9Dot0
}
}
func convertV20170701OrchestratorProfile(v20170701cs *v20170701.OrchestratorProfile, api *OrchestratorProfile, hasWindows bool) {
if v20170701cs.OrchestratorType == v20170701.DockerCE {
api.OrchestratorType = SwarmMode
} else {
api.OrchestratorType = v20170701cs.OrchestratorType
}
switch api.OrchestratorType {
case Kubernetes:
api.OrchestratorVersion = common.GetSupportedKubernetesVersion(v20170701cs.OrchestratorVersion, hasWindows)
case DCOS:
switch v20170701cs.OrchestratorVersion {
case common.DCOSVersion1Dot10Dot0, common.DCOSVersion1Dot9Dot0, common.DCOSVersion1Dot8Dot8:
api.OrchestratorVersion = v20170701cs.OrchestratorVersion
default:
api.OrchestratorVersion = common.DCOSVersion1Dot9Dot0
}
default:
break
}
}
func convertVLabsOrchestratorProfile(vp *vlabs.Properties, api *OrchestratorProfile) {
vlabscs := vp.OrchestratorProfile
api.OrchestratorType = vlabscs.OrchestratorType
switch api.OrchestratorType {
case OpenShift:
if vlabscs.OpenShiftConfig != nil {
api.OpenShiftConfig = &OpenShiftConfig{}
convertVLabsOpenShiftConfig(vlabscs.OpenShiftConfig, api.OpenShiftConfig)
}
// Set api.KubernetesConfig to api.OpenShiftConfig.KubernetesConfig so
// acs-engine can reuse the same code used for generating parameters from
// KubernetesConfig for OpenShiftConfig.
if api.OpenShiftConfig != nil && api.OpenShiftConfig.KubernetesConfig != nil {
api.KubernetesConfig = api.OpenShiftConfig.KubernetesConfig
}
if vlabscs.OrchestratorVersion != common.OpenShiftVersionUnstable {
api.OrchestratorVersion = common.RationalizeReleaseAndVersion(
vlabscs.OrchestratorType,
vlabscs.OrchestratorRelease,
vlabscs.OrchestratorVersion,
false)
} else {
api.OrchestratorVersion = vlabscs.OrchestratorVersion
}
case Kubernetes:
if vlabscs.KubernetesConfig != nil {
api.KubernetesConfig = &KubernetesConfig{}
convertVLabsKubernetesConfig(vlabscs.KubernetesConfig, api.KubernetesConfig)
}
setVlabsKubernetesDefaults(vp, api)
api.OrchestratorVersion = common.RationalizeReleaseAndVersion(
vlabscs.OrchestratorType,
vlabscs.OrchestratorRelease,
vlabscs.OrchestratorVersion,
vp.HasWindows())
case DCOS:
if vlabscs.DcosConfig != nil {
api.DcosConfig = &DcosConfig{}
convertVLabsDcosConfig(vlabscs.DcosConfig, api.DcosConfig)
}
api.OrchestratorVersion = common.RationalizeReleaseAndVersion(
vlabscs.OrchestratorType,
vlabscs.OrchestratorRelease,
vlabscs.OrchestratorVersion,
false)
}
}
func convertVLabsDcosConfig(vlabs *vlabs.DcosConfig, api *DcosConfig) {
api.DcosBootstrapURL = vlabs.DcosBootstrapURL
api.DcosWindowsBootstrapURL = vlabs.DcosWindowsBootstrapURL
if len(vlabs.Registry) > 0 {
api.Registry = vlabs.Registry
}
if len(vlabs.RegistryUser) > 0 {
api.RegistryUser = vlabs.RegistryUser
}
if len(vlabs.RegistryPass) > 0 {
api.RegistryPass = vlabs.RegistryPass
}
api.DcosRepositoryURL = vlabs.DcosRepositoryURL
api.DcosClusterPackageListID = vlabs.DcosClusterPackageListID
api.DcosProviderPackageID = vlabs.DcosProviderPackageID
if vlabs.BootstrapProfile != nil {
api.BootstrapProfile = &BootstrapProfile{
VMSize: vlabs.BootstrapProfile.VMSize,
OSDiskSizeGB: vlabs.BootstrapProfile.OSDiskSizeGB,
OAuthEnabled: vlabs.BootstrapProfile.OAuthEnabled,
StaticIP: vlabs.BootstrapProfile.StaticIP,
Subnet: vlabs.BootstrapProfile.Subnet,
}
}
}
func convertVLabsOpenShiftConfig(vlabs *vlabs.OpenShiftConfig, api *OpenShiftConfig) {
// NOTE: This is a hack to avoid breaking the rest of the acs-engine
// code when KubernetesConfig is accessed for various things. We don't
// use anything from it today. Maybe do something cleaner here.
api.KubernetesConfig = &KubernetesConfig{}
if vlabs.KubernetesConfig != nil {
convertVLabsKubernetesConfig(vlabs.KubernetesConfig, api.KubernetesConfig)
}
api.ClusterUsername = vlabs.ClusterUsername
api.ClusterPassword = vlabs.ClusterPassword
api.EnableAADAuthentication = vlabs.EnableAADAuthentication
api.ConfigBundles = vlabs.ConfigBundles
}
func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *KubernetesConfig) {
api.KubernetesImageBase = vlabs.KubernetesImageBase
api.ClusterSubnet = vlabs.ClusterSubnet
api.DNSServiceIP = vlabs.DNSServiceIP
api.ServiceCIDR = vlabs.ServiceCidr
api.NetworkPlugin = vlabs.NetworkPlugin
api.ContainerRuntime = vlabs.ContainerRuntime
api.MaxPods = vlabs.MaxPods
api.DockerBridgeSubnet = vlabs.DockerBridgeSubnet
api.CloudProviderBackoff = vlabs.CloudProviderBackoff
api.CloudProviderBackoffDuration = vlabs.CloudProviderBackoffDuration
api.CloudProviderBackoffExponent = vlabs.CloudProviderBackoffExponent
api.CloudProviderBackoffJitter = vlabs.CloudProviderBackoffJitter
api.CloudProviderBackoffRetries = vlabs.CloudProviderBackoffRetries
api.CloudProviderRateLimit = vlabs.CloudProviderRateLimit
api.CloudProviderRateLimitBucket = vlabs.CloudProviderRateLimitBucket
api.CloudProviderRateLimitQPS = vlabs.CloudProviderRateLimitQPS
api.UseManagedIdentity = vlabs.UseManagedIdentity
api.CustomHyperkubeImage = vlabs.CustomHyperkubeImage
api.DockerEngineVersion = vlabs.DockerEngineVersion
api.CustomCcmImage = vlabs.CustomCcmImage
api.UseCloudControllerManager = vlabs.UseCloudControllerManager
api.CustomWindowsPackageURL = vlabs.CustomWindowsPackageURL
api.UseInstanceMetadata = vlabs.UseInstanceMetadata
api.EnableRbac = vlabs.EnableRbac
api.EnableSecureKubelet = vlabs.EnableSecureKubelet
api.EnableAggregatedAPIs = vlabs.EnableAggregatedAPIs
api.EnableDataEncryptionAtRest = vlabs.EnableDataEncryptionAtRest
api.EnableEncryptionWithExternalKms = vlabs.EnableEncryptionWithExternalKms
api.EnablePodSecurityPolicy = vlabs.EnablePodSecurityPolicy
api.GCHighThreshold = vlabs.GCHighThreshold
api.GCLowThreshold = vlabs.GCLowThreshold
api.EtcdVersion = vlabs.EtcdVersion
api.EtcdDiskSizeGB = vlabs.EtcdDiskSizeGB
api.EtcdEncryptionKey = vlabs.EtcdEncryptionKey
convertAddonsToAPI(vlabs, api)
convertKubeletConfigToAPI(vlabs, api)
convertControllerManagerConfigToAPI(vlabs, api)
convertCloudControllerManagerConfigToAPI(vlabs, api)
convertAPIServerConfigToAPI(vlabs, api)
convertSchedulerConfigToAPI(vlabs, api)
convertPrivateClusterToAPI(vlabs, api)
}
func setVlabsKubernetesDefaults(vp *vlabs.Properties, api *OrchestratorProfile) {
if api.KubernetesConfig == nil {
api.KubernetesConfig = &KubernetesConfig{}
}
if vp.OrchestratorProfile.KubernetesConfig != nil {
// Included here for backwards compatibility with deprecated NetworkPolicy usage patterns
if vp.OrchestratorProfile.KubernetesConfig.NetworkPolicy == NetworkPolicyAzure {
api.KubernetesConfig.NetworkPlugin = vp.OrchestratorProfile.KubernetesConfig.NetworkPolicy
api.KubernetesConfig.NetworkPolicy = "" // no-op but included for emphasis
} else if vp.OrchestratorProfile.KubernetesConfig.NetworkPolicy == NetworkPolicyNone {
api.KubernetesConfig.NetworkPlugin = NetworkPluginKubenet
api.KubernetesConfig.NetworkPolicy = "" // no-op but included for emphasis
} else {
api.KubernetesConfig.NetworkPlugin = vp.OrchestratorProfile.KubernetesConfig.NetworkPlugin
api.KubernetesConfig.NetworkPolicy = vp.OrchestratorProfile.KubernetesConfig.NetworkPolicy
}
}
if api.KubernetesConfig.NetworkPlugin == "" {
if vp.HasWindows() {
api.KubernetesConfig.NetworkPlugin = vlabs.DefaultNetworkPluginWindows
} else {
api.KubernetesConfig.NetworkPlugin = vlabs.DefaultNetworkPlugin
}
}
}
func convertAddonsToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.Addons = []KubernetesAddon{}
for i := range v.Addons {
a.Addons = append(a.Addons, KubernetesAddon{
Name: v.Addons[i].Name,
Enabled: v.Addons[i].Enabled,
Config: map[string]string{},
})
for j := range v.Addons[i].Containers {
a.Addons[i].Containers = append(a.Addons[i].Containers, KubernetesContainerSpec{
Name: v.Addons[i].Containers[j].Name,
Image: v.Addons[i].Containers[j].Image,
CPURequests: v.Addons[i].Containers[j].CPURequests,
MemoryRequests: v.Addons[i].Containers[j].MemoryRequests,
CPULimits: v.Addons[i].Containers[j].CPULimits,
MemoryLimits: v.Addons[i].Containers[j].MemoryLimits,
})
}
if v.Addons[i].Config != nil {
for key, val := range v.Addons[i].Config {
a.Addons[i].Config[key] = val
}
}
}
}
func convertCustomFilesToAPI(v *vlabs.MasterProfile, a *MasterProfile) {
if v.CustomFiles != nil {
a.CustomFiles = &[]CustomFile{}
for i := range *v.CustomFiles {
*a.CustomFiles = append(*a.CustomFiles, CustomFile{
Dest: (*v.CustomFiles)[i].Dest,
Source: (*v.CustomFiles)[i].Source,
})
}
}
}
func convertKubeletConfigToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.KubeletConfig = map[string]string{}
for key, val := range v.KubeletConfig {
a.KubeletConfig[key] = val
}
}
func convertControllerManagerConfigToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.ControllerManagerConfig = map[string]string{}
for key, val := range v.ControllerManagerConfig {
a.ControllerManagerConfig[key] = val
}
}
func convertCloudControllerManagerConfigToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.CloudControllerManagerConfig = map[string]string{}
for key, val := range v.CloudControllerManagerConfig {
a.CloudControllerManagerConfig[key] = val
}
}
func convertAPIServerConfigToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.APIServerConfig = map[string]string{}
for key, val := range v.APIServerConfig {
a.APIServerConfig[key] = val
}
}
func convertSchedulerConfigToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
a.SchedulerConfig = map[string]string{}
for key, val := range v.SchedulerConfig {
a.SchedulerConfig[key] = val
}
}
func convertPrivateClusterToAPI(v *vlabs.KubernetesConfig, a *KubernetesConfig) {
if v.PrivateCluster != nil {
a.PrivateCluster = &PrivateCluster{}
a.PrivateCluster.Enabled = v.PrivateCluster.Enabled
if v.PrivateCluster.JumpboxProfile != nil {
a.PrivateCluster.JumpboxProfile = &PrivateJumpboxProfile{}
convertPrivateJumpboxProfileToAPI(v.PrivateCluster.JumpboxProfile, a.PrivateCluster.JumpboxProfile)
}
}
}
func convertPrivateJumpboxProfileToAPI(v *vlabs.PrivateJumpboxProfile, a *PrivateJumpboxProfile) {
a.Name = v.Name
a.OSDiskSizeGB = v.OSDiskSizeGB
a.VMSize = v.VMSize
a.PublicKey = v.PublicKey
a.Username = v.Username
a.StorageProfile = v.StorageProfile
}
func convertV20160930MasterProfile(v20160930 *v20160930.MasterProfile, api *MasterProfile) {
api.Count = v20160930.Count
api.DNSPrefix = v20160930.DNSPrefix
api.FQDN = v20160930.FQDN
api.Subnet = v20160930.GetSubnet()
// Set default VMSize
api.VMSize = "Standard_D2_v2"
}
func convertV20160330MasterProfile(v20160330 *v20160330.MasterProfile, api *MasterProfile) {
api.Count = v20160330.Count
api.DNSPrefix = v20160330.DNSPrefix
api.FQDN = v20160330.FQDN
api.Subnet = v20160330.GetSubnet()
// Set default VMSize
api.VMSize = "Standard_D2_v2"
}
func convertV20170131MasterProfile(v20170131 *v20170131.MasterProfile, api *MasterProfile) {
api.Count = v20170131.Count
api.DNSPrefix = v20170131.DNSPrefix
api.FQDN = v20170131.FQDN
api.Subnet = v20170131.GetSubnet()
// Set default VMSize
// TODO: Use azureconst.go to set
api.VMSize = "Standard_D2_v2"
}
func convertV20170701MasterProfile(v20170701 *v20170701.MasterProfile, api *MasterProfile) {
api.Count = v20170701.Count
api.DNSPrefix = v20170701.DNSPrefix
api.FQDN = v20170701.FQDN
api.Subnet = v20170701.GetSubnet()
api.VMSize = v20170701.VMSize
api.OSDiskSizeGB = v20170701.OSDiskSizeGB
api.VnetSubnetID = v20170701.VnetSubnetID
api.FirstConsecutiveStaticIP = v20170701.FirstConsecutiveStaticIP
api.StorageProfile = v20170701.StorageProfile
// by default 20170701 will use managed disks as it has encryption at rest
if len(api.StorageProfile) == 0 {
api.StorageProfile = ManagedDisks
}
}
func convertVLabsMasterProfile(vlabs *vlabs.MasterProfile, api *MasterProfile) {
api.Count = vlabs.Count
api.DNSPrefix = vlabs.DNSPrefix
api.SubjectAltNames = vlabs.SubjectAltNames
api.VMSize = vlabs.VMSize
api.OSDiskSizeGB = vlabs.OSDiskSizeGB
api.VnetSubnetID = vlabs.VnetSubnetID
api.FirstConsecutiveStaticIP = vlabs.FirstConsecutiveStaticIP
api.VnetCidr = vlabs.VnetCidr
api.Subnet = vlabs.GetSubnet()
api.IPAddressCount = vlabs.IPAddressCount
api.FQDN = vlabs.FQDN
api.StorageProfile = vlabs.StorageProfile
api.HTTPSourceAddressPrefix = vlabs.HTTPSourceAddressPrefix
api.OAuthEnabled = vlabs.OAuthEnabled
// by default vlabs will use managed disks as it has encryption at rest
if len(api.StorageProfile) == 0 {
api.StorageProfile = ManagedDisks
}
if vlabs.PreProvisionExtension != nil {
apiExtension := &Extension{}
convertVLabsExtension(vlabs.PreProvisionExtension, apiExtension)
api.PreprovisionExtension = apiExtension
}
api.Extensions = []Extension{}
for _, extension := range vlabs.Extensions {
apiExtension := &Extension{}
convertVLabsExtension(&extension, apiExtension)
api.Extensions = append(api.Extensions, *apiExtension)
}
api.Distro = Distro(vlabs.Distro)
if vlabs.KubernetesConfig != nil {
api.KubernetesConfig = &KubernetesConfig{}
convertVLabsKubernetesConfig(vlabs.KubernetesConfig, api.KubernetesConfig)
}
if vlabs.ImageRef != nil {
api.ImageRef = &ImageReference{}
api.ImageRef.Name = vlabs.ImageRef.Name
api.ImageRef.ResourceGroup = vlabs.ImageRef.ResourceGroup
}
convertCustomFilesToAPI(vlabs, api)
}
func convertV20160930AgentPoolProfile(v20160930 *v20160930.AgentPoolProfile, availabilityProfile string, api *AgentPoolProfile) {
api.Name = v20160930.Name
api.Count = v20160930.Count
api.VMSize = v20160930.VMSize
api.DNSPrefix = v20160930.DNSPrefix
if api.DNSPrefix != "" {
// Set default Ports when DNSPrefix specified
api.Ports = []int{80, 443, 8080}
}
api.FQDN = v20160930.FQDN
api.OSType = OSType(v20160930.OSType)
api.Subnet = v20160930.GetSubnet()
api.AvailabilityProfile = availabilityProfile
}
func convertV20160330AgentPoolProfile(v20160330 *v20160330.AgentPoolProfile, api *AgentPoolProfile) {
api.Name = v20160330.Name
api.Count = v20160330.Count
api.VMSize = v20160330.VMSize
api.DNSPrefix = v20160330.DNSPrefix
if api.DNSPrefix != "" {
// Set default Ports when DNSPrefix specified
api.Ports = []int{80, 443, 8080}
}
api.FQDN = v20160330.FQDN
api.OSType = OSType(v20160330.OSType)
api.Subnet = v20160330.GetSubnet()
}
func convertV20170131AgentPoolProfile(v20170131 *v20170131.AgentPoolProfile, availabilityProfile string, api *AgentPoolProfile) {
api.Name = v20170131.Name
api.Count = v20170131.Count
api.VMSize = v20170131.VMSize
api.DNSPrefix = v20170131.DNSPrefix
if api.DNSPrefix != "" {
// Set default Ports when DNSPrefix specified
api.Ports = []int{80, 443, 8080}
}
api.FQDN = v20170131.FQDN
api.OSType = OSType(v20170131.OSType)
api.Subnet = v20170131.GetSubnet()
api.AvailabilityProfile = availabilityProfile
}
func convertV20170701AgentPoolProfile(v20170701 *v20170701.AgentPoolProfile, availabilityProfile string, api *AgentPoolProfile) {
api.Name = v20170701.Name
api.Count = v20170701.Count
api.VMSize = v20170701.VMSize
api.OSDiskSizeGB = v20170701.OSDiskSizeGB
api.DNSPrefix = v20170701.DNSPrefix
api.OSType = OSType(v20170701.OSType)
api.Ports = []int{}
api.Ports = append(api.Ports, v20170701.Ports...)
api.StorageProfile = v20170701.StorageProfile
api.VnetSubnetID = v20170701.VnetSubnetID
api.Subnet = v20170701.GetSubnet()
api.FQDN = v20170701.FQDN
api.AvailabilityProfile = availabilityProfile
}
func convertVLabsAgentPoolProfile(vlabs *vlabs.AgentPoolProfile, api *AgentPoolProfile) {
api.Name = vlabs.Name
api.Count = vlabs.Count
api.VMSize = vlabs.VMSize
api.OSDiskSizeGB = vlabs.OSDiskSizeGB
api.DNSPrefix = vlabs.DNSPrefix
api.OSType = OSType(vlabs.OSType)
api.Ports = []int{}
api.Ports = append(api.Ports, vlabs.Ports...)
api.AvailabilityProfile = vlabs.AvailabilityProfile
api.ScaleSetPriority = vlabs.ScaleSetPriority
api.ScaleSetEvictionPolicy = vlabs.ScaleSetEvictionPolicy
api.StorageProfile = vlabs.StorageProfile
api.DiskSizesGB = []int{}
api.DiskSizesGB = append(api.DiskSizesGB, vlabs.DiskSizesGB...)