forked from Azure/AgentBaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage.html
5817 lines (5278 loc) · 313 KB
/
coverage.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>agent: Go Coverage Report</title>
<style>
body {
background: black;
color: rgb(80, 80, 80);
}
body, pre, #legend span {
font-family: Menlo, monospace;
font-weight: bold;
}
#topbar {
background: black;
position: fixed;
top: 0; left: 0; right: 0;
height: 42px;
border-bottom: 1px solid rgb(80, 80, 80);
}
#content {
margin-top: 50px;
}
#nav, #legend {
float: left;
margin-left: 10px;
}
#legend {
margin-top: 12px;
}
#nav {
margin-top: 10px;
}
#legend span {
margin: 0 5px;
}
.cov0 { color: rgb(192, 0, 0) }
.cov1 { color: rgb(128, 128, 128) }
.cov2 { color: rgb(116, 140, 131) }
.cov3 { color: rgb(104, 152, 134) }
.cov4 { color: rgb(92, 164, 137) }
.cov5 { color: rgb(80, 176, 140) }
.cov6 { color: rgb(68, 188, 143) }
.cov7 { color: rgb(56, 200, 146) }
.cov8 { color: rgb(44, 212, 149) }
.cov9 { color: rgb(32, 224, 152) }
.cov10 { color: rgb(20, 236, 155) }
</style>
</head>
<body>
<div id="topbar">
<div id="nav">
<select id="files">
<option value="file0">github.com/Azure/agentbaker/pkg/agent/baker.go (75.0%)</option>
<option value="file1">github.com/Azure/agentbaker/pkg/agent/bakerapi.go (59.6%)</option>
<option value="file2">github.com/Azure/agentbaker/pkg/agent/datamodel/helper.go (94.4%)</option>
<option value="file3">github.com/Azure/agentbaker/pkg/agent/datamodel/mocks.go (7.7%)</option>
<option value="file4">github.com/Azure/agentbaker/pkg/agent/datamodel/sig_config.go (53.0%)</option>
<option value="file5">github.com/Azure/agentbaker/pkg/agent/datamodel/types.go (81.6%)</option>
<option value="file6">github.com/Azure/agentbaker/pkg/agent/datamodel/versions.go (93.6%)</option>
<option value="file7">github.com/Azure/agentbaker/pkg/agent/params.go (94.5%)</option>
<option value="file8">github.com/Azure/agentbaker/pkg/agent/utils.go (80.9%)</option>
<option value="file9">github.com/Azure/agentbaker/pkg/agent/variables.go (93.3%)</option>
</select>
</div>
<div id="legend">
<span>not tracked</span>
<span class="cov0">not covered</span>
<span class="cov8">covered</span>
</div>
</div>
<div id="content">
<pre class="file" id="file0" style="display: none">// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package agent
import (
"archive/zip"
"bytes"
"encoding/base64"
"fmt"
"reflect"
"strings"
"text/template"
"github.com/Azure/agentbaker/pkg/agent/datamodel"
"github.com/Azure/agentbaker/pkg/templates"
"github.com/Azure/go-autorest/autorest/to"
)
// TemplateGenerator represents the object that performs the template generation.
type TemplateGenerator struct{}
// InitializeTemplateGenerator creates a new template generator object
func InitializeTemplateGenerator() *TemplateGenerator <span class="cov8" title="1">{
t := &TemplateGenerator{}
return t
}</span>
// GetNodeBootstrappingPayload get node bootstrapping data
func (t *TemplateGenerator) GetNodeBootstrappingPayload(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
var customData string
if config.AgentPoolProfile.IsWindows() </span><span class="cov8" title="1">{
customData = getCustomDataFromJSON(t.getWindowsNodeCustomDataJSONObject(config))
}</span> else<span class="cov8" title="1"> {
customData = getCustomDataFromJSON(t.getLinuxNodeCustomDataJSONObject(config))
}</span>
<span class="cov8" title="1">return base64.StdEncoding.EncodeToString([]byte(customData))</span>
}
// GetLinuxNodeCustomDataJSONObject returns Linux customData JSON object in the form
// { "customData": "<customData string>" }
func (t *TemplateGenerator) getLinuxNodeCustomDataJSONObject(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
// validate and fix input
validateAndSetLinuxNodeBootstrappingConfiguration(config)
// get parameters
parameters := getParameters(config, "baker", "1.0")
// get variable cloudInit
variables := getCustomDataVariables(config)
str, e := t.getSingleLineForTemplate(kubernetesNodeCustomDataYaml,
config.AgentPoolProfile, getBakerFuncMap(config, parameters, variables))
if e != nil </span><span class="cov0" title="0">{
panic(e)</span>
}
<span class="cov8" title="1">return fmt.Sprintf("{\"customData\": \"%s\"}", str)</span>
}
// GetWindowsNodeCustomDataJSONObject returns Windows customData JSON object in the form
// { "customData": "<customData string>" }
func (t *TemplateGenerator) getWindowsNodeCustomDataJSONObject(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
// validate and fix input
validateAndSetWindowsNodeBootstrappingConfiguration(config)
cs := config.ContainerService
profile := config.AgentPoolProfile
// get parameters
parameters := getParameters(config, "", "")
// get variable custom data
variables := getWindowsCustomDataVariables(config)
str, e := t.getSingleLineForTemplate(kubernetesWindowsAgentCustomDataPS1,
profile, getBakerFuncMap(config, parameters, variables))
if e != nil </span><span class="cov0" title="0">{
panic(e)</span>
}
<span class="cov8" title="1">preprovisionCmd := ""
if profile.PreprovisionExtension != nil </span><span class="cov0" title="0">{
preprovisionCmd = makeAgentExtensionScriptCommands(cs, profile)
}</span>
<span class="cov8" title="1">str = strings.Replace(str, "PREPROVISION_EXTENSION", escapeSingleLine(strings.TrimSpace(preprovisionCmd)), -1)
return fmt.Sprintf("{\"customData\": \"%s\"}", str)</span>
}
// GetNodeBootstrappingCmd get node bootstrapping cmd
func (t *TemplateGenerator) GetNodeBootstrappingCmd(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
if config.AgentPoolProfile.IsWindows() </span><span class="cov8" title="1">{
return t.getWindowsNodeCSECommand(config)
}</span>
<span class="cov8" title="1">return t.getLinuxNodeCSECommand(config)</span>
}
// getLinuxNodeCSECommand returns Linux node custom script extension execution command
func (t *TemplateGenerator) getLinuxNodeCSECommand(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
// validate and fix input
validateAndSetLinuxNodeBootstrappingConfiguration(config)
// get parameters
parameters := getParameters(config, "", "")
// get variable
variables := getCSECommandVariables(config)
// NOTE: that CSE command will be executed by VM/VMSS extension so it doesn't need extra escaping like custom data does
str, e := t.getSingleLine(
kubernetesCSECommandString,
config.AgentPoolProfile,
getBakerFuncMap(config, parameters, variables),
)
if e != nil </span><span class="cov0" title="0">{
panic(e)</span>
}
// NOTE: we break the one-line CSE command into different lines in a file for better management
// so we need to combine them into one line here
<span class="cov8" title="1">return strings.Replace(str, "\n", " ", -1)</span>
}
// getWindowsNodeCSECommand returns Windows node custom script extension execution command
func (t *TemplateGenerator) getWindowsNodeCSECommand(config *datamodel.NodeBootstrappingConfiguration) string <span class="cov8" title="1">{
// TODO(ace): linux cleans the input here for CSE now.
// should we do the same for windows?
// get parameters
parameters := getParameters(config, "", "")
// get variable
variables := getCSECommandVariables(config)
// NOTE: that CSE command will be executed by VMSS extension so it doesn't need extra escaping like custom data does
str, e := t.getSingleLine(
kubernetesWindowsAgentCSECommandPS1,
config.AgentPoolProfile,
getBakerFuncMap(config, parameters, variables),
)
if e != nil </span><span class="cov0" title="0">{
panic(e)</span>
}
// NOTE(qinahao): windows cse cmd uses esapced \" to quote Powershell command in [csecmd.p1](https://github.com/Azure/AgentBaker/blob/master/parts/windows/csecmd.ps1)
// to not break go template parsing. We switch \" back to " otherwise Azure ARM template will escape \ to be \\\"
<span class="cov8" title="1">str = strings.Replace(str, `\"`, `"`, -1)
// NOTE: we break the one-line CSE command into different lines in a file for better management
// so we need to combine them into one line here
return strings.Replace(str, "\n", " ", -1)</span>
}
// getSingleLineForTemplate returns the file as a single line for embedding in an arm template
func (t *TemplateGenerator) getSingleLineForTemplate(textFilename string, profile interface{},
funcMap template.FuncMap,
) (string, error) <span class="cov8" title="1">{
expandedTemplate, err := t.getSingleLine(textFilename, profile, funcMap)
if err != nil </span><span class="cov0" title="0">{
return "", err
}</span>
<span class="cov8" title="1">textStr := escapeSingleLine(expandedTemplate)
return textStr, nil</span>
}
// getSingleLine returns the file as a single line
func (t *TemplateGenerator) getSingleLine(textFilename string, profile interface{},
funcMap template.FuncMap,
) (string, error) <span class="cov8" title="1">{
b, err := templates.Asset(textFilename)
if err != nil </span><span class="cov0" title="0">{
return "", fmt.Errorf("yaml file %s does not exist", textFilename)
}</span>
// use go templates to process the text filename
<span class="cov8" title="1">templ := template.New("customdata template").Option("missingkey=zero").Funcs(funcMap)
if _, err = templ.New(textFilename).Parse(string(b)); err != nil </span><span class="cov0" title="0">{
return "", fmt.Errorf("error parsing file %s: %v", textFilename, err)
}</span>
<span class="cov8" title="1">var buffer bytes.Buffer
if err = templ.ExecuteTemplate(&buffer, textFilename, profile); err != nil </span><span class="cov0" title="0">{
return "", fmt.Errorf("error executing template for file %s: %v", textFilename, err)
}</span>
<span class="cov8" title="1">expandedTemplate := buffer.String()
return expandedTemplate, nil</span>
}
// getTemplateFuncMap returns the general purpose template func map from getContainerServiceFuncMap
func getBakerFuncMap(config *datamodel.NodeBootstrappingConfiguration, params paramsMap, variables paramsMap) template.FuncMap <span class="cov8" title="1">{
funcMap := getContainerServiceFuncMap(config)
funcMap["GetParameter"] = func(s string) interface{} </span><span class="cov8" title="1">{
if v, ok := params[s].(paramsMap); ok && v != nil </span><span class="cov8" title="1">{
if v["value"] == nil </span><span class="cov0" title="0">{
// return empty string so we don't get <no value> from go template
return ""
}</span>
<span class="cov8" title="1">return v["value"]</span>
}
<span class="cov8" title="1">return ""</span>
}
// TODO: GetParameterPropertyLower
<span class="cov8" title="1">funcMap["GetParameterProperty"] = func(s, p string) interface{} </span><span class="cov8" title="1">{
if v, ok := params[s].(paramsMap); ok && v != nil </span><span class="cov8" title="1">{
if v["value"].(paramsMap)[p] == nil </span><span class="cov0" title="0">{
// return empty string so we don't get <no value> from go template
return ""
}</span>
<span class="cov8" title="1">return v["value"].(paramsMap)[p]</span>
}
<span class="cov8" title="1">return ""</span>
}
<span class="cov8" title="1">funcMap["GetVariable"] = func(s string) interface{} </span><span class="cov8" title="1">{
if variables[s] == nil </span><span class="cov0" title="0">{
// return empty string so we don't get <no value> from go template
return ""
}</span>
<span class="cov8" title="1">return variables[s]</span>
}
<span class="cov8" title="1">funcMap["GetVariableProperty"] = func(v, p string) interface{} </span><span class="cov8" title="1">{
if v, ok := variables[v].(paramsMap); ok && v != nil </span><span class="cov8" title="1">{
if v[p] == nil </span><span class="cov8" title="1">{
// return empty string so we don't get <no value> from go template
return ""
}</span>
<span class="cov8" title="1">return v[p]</span>
}
<span class="cov0" title="0">return ""</span>
}
<span class="cov8" title="1">return funcMap</span>
}
// normalizeResourceGroupNameForLabel normalizes resource group name to be used as a label,
// similar to what the ARM template used to do.
//
// When ARM template was used, the following is used:
//
// variables('labelResourceGroup')
//
// which is defined as:
//
// [if(or(or(endsWith(variables('truncatedResourceGroup'), '-'), endsWith(variables('truncatedResourceGroup'), '_')), endsWith(variables('truncatedResourceGroup'), '.')), concat(take(variables('truncatedResourceGroup'), 62), 'z'), variables('truncatedResourceGroup'))]
//
// the "truncatedResourceGroup" is defined as:
//
// [take(replace(replace(resourceGroup().name, '(', '-'), ')', '-'), 63)]
//
// This function does the same processing.
func normalizeResourceGroupNameForLabel(resourceGroupName string) string <span class="cov8" title="1">{
truncated := resourceGroupName
truncated = strings.ReplaceAll(truncated, "(", "-")
truncated = strings.ReplaceAll(truncated, ")", "-")
const maxLen = 63
if len(truncated) > maxLen </span><span class="cov8" title="1">{
truncated = truncated[0:maxLen]
}</span>
<span class="cov8" title="1">if strings.HasSuffix(truncated, "-") ||
strings.HasSuffix(truncated, "_") ||
strings.HasSuffix(truncated, ".") </span><span class="cov8" title="1">{
if len(truncated) > 62 </span><span class="cov8" title="1">{
return truncated[0:len(truncated)-1] + "z"
}</span> else<span class="cov8" title="1"> {
return truncated + "z"
}</span>
}
<span class="cov8" title="1">return truncated</span>
}
func validateAndSetLinuxNodeBootstrappingConfiguration(config *datamodel.NodeBootstrappingConfiguration) <span class="cov8" title="1">{
// If using kubelet config file, disable DynamicKubeletConfig feature gate and remove dynamic-config-dir
// we should only allow users to configure from API (20201101 and later)
profile := config.AgentPoolProfile
if config.KubeletConfig != nil </span><span class="cov8" title="1">{
kubeletFlags := config.KubeletConfig
delete(kubeletFlags, "--dynamic-config-dir")
delete(kubeletFlags, "--non-masquerade-cidr")
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntime != "" && profile.KubernetesConfig.ContainerRuntime == "containerd" </span><span class="cov8" title="1">{
for _, flag := range dockerShimFlags </span><span class="cov8" title="1">{
delete(kubeletFlags, flag)
}</span>
}
<span class="cov8" title="1">if IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.24.0") </span><span class="cov8" title="1">{
kubeletFlags["--feature-gates"] = removeFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig")
}</span> else<span class="cov8" title="1"> if IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.11.0") </span><span class="cov8" title="1">{
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig", false)
}</span>
// ContainerInsights depends on GPU accelerator Usage metrics from Kubelet cAdvisor endpoint but deprecation of this feature moved to beta which breaks the ContainerInsights customers with K8s version 1.20 or higher
// Until Container Insights move to new API adding this feature gate to get the GPU metrics continue to work
// Reference - https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1867-disable-accelerator-usage-metrics
<span class="cov8" title="1">if IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.20.0") &&
!IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.25.0") </span><span class="cov8" title="1">{
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "DisableAcceleratorUsageMetrics", false)
}</span>
}
}
func validateAndSetWindowsNodeBootstrappingConfiguration(config *datamodel.NodeBootstrappingConfiguration) <span class="cov8" title="1">{
if IsKubeletClientTLSBootstrappingEnabled(config.KubeletClientTLSBootstrapToken) </span><span class="cov8" title="1">{
// backfill proper flags for Windows agent node TLS bootstrapping
if config.KubeletConfig == nil </span><span class="cov0" title="0">{
config.KubeletConfig = make(map[string]string)
}</span>
<span class="cov8" title="1">config.KubeletConfig["--bootstrap-kubeconfig"] = "c:\\k\\bootstrap-config"
config.KubeletConfig["--cert-dir"] = "c:\\k\\pki"</span>
}
<span class="cov8" title="1">if config.KubeletConfig != nil </span><span class="cov8" title="1">{
kubeletFlags := config.KubeletConfig
delete(kubeletFlags, "--dynamic-config-dir")
if IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.24.0") </span><span class="cov0" title="0">{
kubeletFlags["--feature-gates"] = removeFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig")
}</span> else<span class="cov8" title="1"> if IsKubernetesVersionGe(config.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion, "1.11.0") </span><span class="cov8" title="1">{
kubeletFlags["--feature-gates"] = addFeatureGateString(kubeletFlags["--feature-gates"], "DynamicKubeletConfig", false)
}</span>
}
}
// getContainerServiceFuncMap returns all functions used in template generation
// These funcs are a thin wrapper for template generation operations,
// all business logic is implemented in the underlying func
func getContainerServiceFuncMap(config *datamodel.NodeBootstrappingConfiguration) template.FuncMap <span class="cov8" title="1">{
cs := config.ContainerService
profile := config.AgentPoolProfile
return template.FuncMap{
"Disable1804SystemdResolved": func() bool </span><span class="cov0" title="0">{
return config.Disable1804SystemdResolved
}</span>,
// This was DisableUnattendedUpgrade when we had UU enabled by default in image.
// Now we don't, so we have to deliberately enable it.
// Someone smarter than me can fix the API.
"EnableUnattendedUpgrade": func() bool <span class="cov8" title="1">{
return !config.DisableUnattendedUpgrades
}</span>,
"IsIPMasqAgentEnabled": func() bool <span class="cov0" title="0">{
return cs.Properties.IsIPMasqAgentEnabled()
}</span>,
"IsKubernetesVersionGe": func(version string) bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.IsKubernetes() && IsKubernetesVersionGe(cs.Properties.OrchestratorProfile.OrchestratorVersion, version)
}</span>,
"GetAgentKubernetesLabels": func(profile *datamodel.AgentPoolProfile) string <span class="cov8" title="1">{
return profile.GetKubernetesLabels(normalizeResourceGroupNameForLabel(config.ResourceGroupName),
false, config.EnableNvidia, config.FIPSEnabled, config.OSSKU)
}</span>,
"GetAgentKubernetesLabelsDeprecated": func(profile *datamodel.AgentPoolProfile) string <span class="cov8" title="1">{
return profile.GetKubernetesLabels(normalizeResourceGroupNameForLabel(config.ResourceGroupName),
true, config.EnableNvidia, config.FIPSEnabled, config.OSSKU)
}</span>,
"GetGPUInstanceProfile": func() string <span class="cov8" title="1">{
return config.GPUInstanceProfile
}</span>,
"IsMIGEnabledNode": func() bool <span class="cov0" title="0">{
return config.GPUInstanceProfile != ""
}</span>,
"GetKubeletConfigFileContent": func() string <span class="cov0" title="0">{
return GetKubeletConfigFileContent(config.KubeletConfig, profile.CustomKubeletConfig)
}</span>,
"GetKubeletConfigFileContentBase64": func() string <span class="cov8" title="1">{
return base64.StdEncoding.EncodeToString([]byte(GetKubeletConfigFileContent(config.KubeletConfig, profile.CustomKubeletConfig)))
}</span>,
"IsKubeletConfigFileEnabled": func() bool <span class="cov8" title="1">{
return IsKubeletConfigFileEnabled(cs, profile, config.EnableKubeletConfigFile)
}</span>,
"IsKubeletClientTLSBootstrappingEnabled": func() bool <span class="cov8" title="1">{
return IsKubeletClientTLSBootstrappingEnabled(config.KubeletClientTLSBootstrapToken)
}</span>,
"GetTLSBootstrapTokenForKubeConfig": func() string <span class="cov8" title="1">{
return GetTLSBootstrapTokenForKubeConfig(config.KubeletClientTLSBootstrapToken)
}</span>,
"GetKubeletConfigKeyVals": func() string <span class="cov8" title="1">{
return GetOrderedKubeletConfigFlagString(config.KubeletConfig, cs, profile, config.EnableKubeletConfigFile)
}</span>,
"GetKubeletConfigKeyValsPsh": func() string <span class="cov8" title="1">{
return config.GetOrderedKubeletConfigStringForPowershell(profile.CustomKubeletConfig)
}</span>,
"GetKubeproxyConfigKeyValsPsh": func() string <span class="cov8" title="1">{
return config.GetOrderedKubeproxyConfigStringForPowershell()
}</span>,
"Is2204VHD": func() bool <span class="cov8" title="1">{
return profile.Is2204VHDDistro()
}</span>,
"GetKubeProxyFeatureGatesPsh": func() string <span class="cov8" title="1">{
return cs.Properties.GetKubeProxyFeatureGatesWindowsArguments()
}</span>,
"ShouldConfigCustomSysctl": func() bool <span class="cov8" title="1">{
return profile.CustomLinuxOSConfig != nil && profile.CustomLinuxOSConfig.Sysctls != nil
}</span>,
"GetCustomSysctlConfigByName": func(fn string) interface{} <span class="cov8" title="1">{
if profile.CustomLinuxOSConfig != nil && profile.CustomLinuxOSConfig.Sysctls != nil </span><span class="cov8" title="1">{
v := reflect.ValueOf(*profile.CustomLinuxOSConfig.Sysctls)
return v.FieldByName(fn).Interface()
}</span>
<span class="cov8" title="1">return nil</span>
},
"ShouldConfigTransparentHugePage": func() bool <span class="cov8" title="1">{
return profile.CustomLinuxOSConfig != nil && (profile.CustomLinuxOSConfig.TransparentHugePageEnabled != "" || profile.CustomLinuxOSConfig.TransparentHugePageDefrag != "")
}</span>,
"GetTransparentHugePageEnabled": func() string <span class="cov8" title="1">{
if profile.CustomLinuxOSConfig == nil </span><span class="cov8" title="1">{
return ""
}</span>
<span class="cov8" title="1">return profile.CustomLinuxOSConfig.TransparentHugePageEnabled</span>
},
"GetTransparentHugePageDefrag": func() string <span class="cov8" title="1">{
if profile.CustomLinuxOSConfig == nil </span><span class="cov8" title="1">{
return ""
}</span>
<span class="cov8" title="1">return profile.CustomLinuxOSConfig.TransparentHugePageDefrag</span>
},
"ShouldConfigSwapFile": func() bool <span class="cov8" title="1">{
// only configure swap file when FailSwapOn is false and SwapFileSizeMB is valid
return profile.CustomKubeletConfig != nil && profile.CustomKubeletConfig.FailSwapOn != nil && !*profile.CustomKubeletConfig.FailSwapOn &&
profile.CustomLinuxOSConfig != nil && profile.CustomLinuxOSConfig.SwapFileSizeMB != nil && *profile.CustomLinuxOSConfig.SwapFileSizeMB > 0
}</span>,
"GetSwapFileSizeMB": func() int32 <span class="cov8" title="1">{
if profile.CustomLinuxOSConfig != nil && profile.CustomLinuxOSConfig.SwapFileSizeMB != nil </span><span class="cov8" title="1">{
return *profile.CustomLinuxOSConfig.SwapFileSizeMB
}</span>
<span class="cov8" title="1">return 0</span>
},
"IsKubernetes": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.IsKubernetes()
}</span>,
"GetKubernetesEndpoint": func() string <span class="cov8" title="1">{
if cs.Properties.HostedMasterProfile == nil </span><span class="cov0" title="0">{
return ""
}</span>
<span class="cov8" title="1">if cs.Properties.HostedMasterProfile.IPAddress != "" </span><span class="cov8" title="1">{
return cs.Properties.HostedMasterProfile.IPAddress
}</span>
<span class="cov8" title="1">return cs.Properties.HostedMasterProfile.FQDN</span>
},
"IsAzureCNI": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.IsAzureCNI()
}</span>,
"IsNoneCNI": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.IsNoneCNI()
}</span>,
"IsMariner": func() bool <span class="cov8" title="1">{
// TODO(ace): do we care about both? 2nd one should be more general and catch custom VHD for mariner
return profile.Distro.IsCBLMarinerDistro() || isMariner(config.OSSKU)
}</span>,
"IsKata": func() bool <span class="cov8" title="1">{
return profile.Distro.IsKataDistro()
}</span>,
"EnableHostsConfigAgent": func() bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig != nil &&
cs.Properties.OrchestratorProfile.KubernetesConfig.PrivateCluster != nil &&
to.Bool(cs.Properties.OrchestratorProfile.KubernetesConfig.PrivateCluster.EnableHostsConfigAgent)
}</span>,
"UseManagedIdentity": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity
}</span>,
"GetSshPublicKeysPowerShell": func() string <span class="cov8" title="1">{
return getSSHPublicKeysPowerShell(cs.Properties.LinuxProfile)
}</span>,
"GetKubernetesAgentPreprovisionYaml": func(profile *datamodel.AgentPoolProfile) string <span class="cov0" title="0">{
str := ""
if profile.PreprovisionExtension != nil </span><span class="cov0" title="0">{
str += "\n"
str += makeAgentExtensionScriptCommands(cs, profile)
}</span>
<span class="cov0" title="0">return str</span>
},
"GetKubernetesWindowsAgentFunctions": func() string <span class="cov8" title="1">{
// Collect all the parts into a zip
parts := []string{
kubernetesWindowsCSEHelperPS1,
kubernetesWindowsSendLogsPS1,
}
// Create a buffer, new zip
buf := new(bytes.Buffer)
zw := zip.NewWriter(buf)
for _, part := range parts </span><span class="cov8" title="1">{
f, err := zw.Create(part)
if err != nil </span><span class="cov0" title="0">{
panic(err)</span>
}
<span class="cov8" title="1">partContents, err := templates.Asset(part)
if err != nil </span><span class="cov0" title="0">{
panic(err)</span>
}
<span class="cov8" title="1">_, err = f.Write(partContents)
if err != nil </span><span class="cov0" title="0">{
panic(err)</span>
}
}
<span class="cov8" title="1">err := zw.Close()
if err != nil </span><span class="cov0" title="0">{
panic(err)</span>
}
<span class="cov8" title="1">return base64.StdEncoding.EncodeToString(buf.Bytes())</span>
},
"IsNSeriesSKU": func() bool <span class="cov8" title="1">{
return config.EnableNvidia
}</span>,
"HasCustomSearchDomain": func() bool <span class="cov8" title="1">{
return cs.Properties.LinuxProfile != nil && cs.Properties.LinuxProfile.HasSearchDomain()
}</span>,
"GetSearchDomainName": func() string <span class="cov8" title="1">{
if cs.Properties.LinuxProfile != nil && cs.Properties.LinuxProfile.HasSearchDomain() </span><span class="cov0" title="0">{
return cs.Properties.LinuxProfile.CustomSearchDomain.Name
}</span>
<span class="cov8" title="1">return ""</span>
},
"GetSearchDomainRealmUser": func() string <span class="cov8" title="1">{
if cs.Properties.LinuxProfile != nil && cs.Properties.LinuxProfile.HasSearchDomain() </span><span class="cov0" title="0">{
return cs.Properties.LinuxProfile.CustomSearchDomain.RealmUser
}</span>
<span class="cov8" title="1">return ""</span>
},
"GetSearchDomainRealmPassword": func() string <span class="cov8" title="1">{
if cs.Properties.LinuxProfile != nil && cs.Properties.LinuxProfile.HasSearchDomain() </span><span class="cov0" title="0">{
return cs.Properties.LinuxProfile.CustomSearchDomain.RealmPassword
}</span>
<span class="cov8" title="1">return ""</span>
},
"HasCalicoNetworkPolicy": func() bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.NetworkPolicy == NetworkPolicyCalico
}</span>,
"HasAntreaNetworkPolicy": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.NetworkPolicy == NetworkPolicyAntrea
}</span>,
"HasFlannelNetworkPlugin": func() bool <span class="cov0" title="0">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin == NetworkPluginFlannel
}</span>,
"HasKubeletClientKey": func() bool <span class="cov0" title="0">{
return cs.Properties.CertificateProfile != nil && cs.Properties.CertificateProfile.ClientPrivateKey != ""
}</span>,
"GetKubeletClientKey": func() string <span class="cov8" title="1">{
if cs.Properties.CertificateProfile != nil && cs.Properties.CertificateProfile.ClientPrivateKey != "" </span><span class="cov0" title="0">{
encoded := base64.StdEncoding.EncodeToString([]byte(cs.Properties.CertificateProfile.ClientPrivateKey))
return encoded
}</span>
<span class="cov8" title="1">return ""</span>
},
"GetKubeletClientCert": func() string <span class="cov8" title="1">{
if cs.Properties.CertificateProfile != nil && cs.Properties.CertificateProfile.ClientCertificate != "" </span><span class="cov0" title="0">{
encoded := base64.StdEncoding.EncodeToString([]byte(cs.Properties.CertificateProfile.ClientCertificate))
return encoded
}</span>
<span class="cov8" title="1">return ""</span>
},
"HasServicePrincipalSecret": func() bool <span class="cov0" title="0">{
return cs.Properties.ServicePrincipalProfile != nil && cs.Properties.ServicePrincipalProfile.Secret != ""
}</span>,
"GetServicePrincipalSecret": func() string <span class="cov8" title="1">{
if cs.Properties.ServicePrincipalProfile != nil && cs.Properties.ServicePrincipalProfile.Secret != "" </span><span class="cov8" title="1">{
encoded := base64.StdEncoding.EncodeToString([]byte(cs.Properties.ServicePrincipalProfile.Secret))
return encoded
}</span>
<span class="cov0" title="0">return ""</span>
},
"WindowsSSHEnabled": func() bool <span class="cov8" title="1">{
return cs.Properties.WindowsProfile.GetSSHEnabled()
}</span>,
"IsIPv6DualStackFeatureEnabled": func() bool <span class="cov8" title="1">{
return cs.Properties.FeatureFlags.IsFeatureEnabled("EnableIPv6DualStack")
}</span>,
"IsAzureCNIOverlayFeatureEnabled": func() bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.IsUsingNetworkPluginMode("overlay")
}</span>,
"GetBase64EncodedEnvironmentJSON": func() string <span class="cov8" title="1">{
customEnvironmentJSON, _ := cs.Properties.GetCustomEnvironmentJSON(false)
return base64.StdEncoding.EncodeToString([]byte(customEnvironmentJSON))
}</span>,
"GetIdentitySystem": func() string <span class="cov8" title="1">{
return datamodel.AzureADIdentitySystem
}</span>,
"GetPodInfraContainerSpec": func() string <span class="cov8" title="1">{
return config.K8sComponents.PodInfraContainerImageURL
}</span>,
"IsKubenet": func() bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.NetworkPlugin == NetworkPluginKubenet
}</span>,
"NeedsContainerd": func() bool <span class="cov8" title="1">{
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntime != "" </span><span class="cov8" title="1">{
return profile.KubernetesConfig.NeedsContainerd()
}</span>
<span class="cov8" title="1">return cs.Properties.OrchestratorProfile.KubernetesConfig.NeedsContainerd()</span>
},
"UseRuncShimV2": func() bool <span class="cov0" title="0">{
return config.EnableRuncShimV2
}</span>,
"IsDockerContainerRuntime": func() bool <span class="cov8" title="1">{
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntime != "" </span><span class="cov8" title="1">{
return profile.KubernetesConfig.ContainerRuntime == datamodel.Docker
}</span>
<span class="cov8" title="1">return cs.Properties.OrchestratorProfile.KubernetesConfig.ContainerRuntime == datamodel.Docker</span>
},
"RequiresDocker": func() bool <span class="cov0" title="0">{
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntime != "" </span><span class="cov0" title="0">{
return profile.KubernetesConfig.RequiresDocker()
}</span>
<span class="cov0" title="0">return cs.Properties.OrchestratorProfile.KubernetesConfig.RequiresDocker()</span>
},
"HasDataDir": func() bool <span class="cov8" title="1">{
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntimeConfig != nil && profile.KubernetesConfig.ContainerRuntimeConfig[datamodel.ContainerDataDirKey] != "" </span><span class="cov8" title="1">{
return true
}</span>
<span class="cov8" title="1">if profile.KubeletDiskType == datamodel.TempDisk </span><span class="cov8" title="1">{
return true
}</span>
<span class="cov8" title="1">return cs.Properties.OrchestratorProfile.KubernetesConfig.ContainerRuntimeConfig != nil && cs.Properties.OrchestratorProfile.KubernetesConfig.ContainerRuntimeConfig[datamodel.ContainerDataDirKey] != ""</span>
},
"GetDataDir": func() string <span class="cov8" title="1">{
if profile != nil && profile.KubernetesConfig != nil && profile.KubernetesConfig.ContainerRuntimeConfig != nil && profile.KubernetesConfig.ContainerRuntimeConfig[datamodel.ContainerDataDirKey] != "" </span><span class="cov8" title="1">{
return profile.KubernetesConfig.ContainerRuntimeConfig[datamodel.ContainerDataDirKey]
}</span>
<span class="cov8" title="1">if profile.KubeletDiskType == datamodel.TempDisk </span><span class="cov8" title="1">{
return datamodel.TempDiskContainerDataDir
}</span>
<span class="cov8" title="1">return cs.Properties.OrchestratorProfile.KubernetesConfig.ContainerRuntimeConfig[datamodel.ContainerDataDirKey]</span>
},
"HasKubeletDiskType": func() bool <span class="cov8" title="1">{
return profile != nil && profile.KubeletDiskType != "" && profile.KubeletDiskType != datamodel.OSDisk
}</span>,
"GetKubeletDiskType": func() string <span class="cov0" title="0">{
if profile != nil && profile.KubeletDiskType != "" && profile.KubeletDiskType != datamodel.OSDisk </span><span class="cov0" title="0">{
return string(profile.KubeletDiskType)
}</span>
<span class="cov0" title="0">return ""</span>
},
"IsKrustlet": func() bool <span class="cov8" title="1">{
return strings.EqualFold(string(profile.WorkloadRuntime), string(datamodel.WasmWasi))
}</span>,
"GetBase64CertificateAuthorityData": func() string <span class="cov0" title="0">{
if cs != nil && cs.Properties != nil && cs.Properties.CertificateProfile != nil && cs.Properties.CertificateProfile.CaCertificate != "" </span><span class="cov0" title="0">{
data := cs.Properties.CertificateProfile.CaCertificate
return base64.StdEncoding.EncodeToString([]byte(data))
}</span>
<span class="cov0" title="0">return ""</span>
},
"GetKubenetTemplate": func() string <span class="cov8" title="1">{
return base64.StdEncoding.EncodeToString([]byte(kubenetCniTemplate))
}</span>,
"GetContainerdConfigContent": func() string <span class="cov8" title="1">{
parameters := getParameters(config, "baker", "1.0")
// get variable cloudInit
variables := getCustomDataVariables(config)
containerdConfigTemplate := template.Must(template.New("kubenet").Funcs(getBakerFuncMap(config, parameters, variables)).Parse(containerdConfigTemplateString))
var b bytes.Buffer
if err := containerdConfigTemplate.Execute(&b, profile); err != nil </span><span class="cov0" title="0">{
panic(fmt.Errorf("failed to execute sysctl template: %s", err))</span>
}
<span class="cov8" title="1">return base64.StdEncoding.EncodeToString(b.Bytes())</span>
},
"TeleportEnabled": func() bool <span class="cov8" title="1">{
return config.EnableACRTeleportPlugin
}</span>,
"HasDCSeriesSKU": func() bool <span class="cov0" title="0">{
return cs.Properties.HasDCSeriesSKU()
}</span>,
"GetHyperkubeImageReference": func() string <span class="cov8" title="1">{
return config.K8sComponents.HyperkubeImageURL
}</span>,
"GetTargetEnvironment": func() string <span class="cov8" title="1">{
if cs.IsAKSCustomCloud() </span><span class="cov8" title="1">{
return cs.Properties.CustomCloudEnv.Name
}</span>
<span class="cov8" title="1">return GetCloudTargetEnv(cs.Location)</span>
},
"IsAKSCustomCloud": func() bool <span class="cov8" title="1">{
return cs.IsAKSCustomCloud()
}</span>,
"GetInitAKSCustomCloudFilepath": func() string <span class="cov8" title="1">{
return initAKSCustomCloudFilepath
}</span>,
"AKSCustomCloudRepoDepotEndpoint": func() string <span class="cov8" title="1">{
return cs.Properties.CustomCloudEnv.RepoDepotEndpoint
}</span>,
"AKSCustomCloudManagementPortalURL": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ManagementPortalURL
}</span>,
"AKSCustomCloudPublishSettingsURL": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.PublishSettingsURL
}</span>,
"AKSCustomCloudServiceManagementEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ServiceManagementEndpoint
}</span>,
"AKSCustomCloudResourceManagerEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceManagerEndpoint
}</span>,
"AKSCustomCloudActiveDirectoryEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ActiveDirectoryEndpoint
}</span>,
"AKSCustomCloudGalleryEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.GalleryEndpoint
}</span>,
"AKSCustomCloudKeyVaultEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.KeyVaultEndpoint
}</span>,
"AKSCustomCloudGraphEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.GraphEndpoint
}</span>,
"AKSCustomCloudServiceBusEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ServiceBusEndpoint
}</span>,
"AKSCustomCloudBatchManagementEndpoint": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.BatchManagementEndpoint
}</span>,
"AKSCustomCloudStorageEndpointSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.StorageEndpointSuffix
}</span>,
"AKSCustomCloudSqlDatabaseDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.SQLDatabaseDNSSuffix
}</span>,
"AKSCustomCloudTrafficManagerDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.TrafficManagerDNSSuffix
}</span>,
"AKSCustomCloudKeyVaultDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.KeyVaultDNSSuffix
}</span>,
"AKSCustomCloudServiceBusEndpointSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ServiceBusEndpointSuffix
}</span>,
"AKSCustomCloudServiceManagementVMDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ServiceManagementVMDNSSuffix
}</span>,
"AKSCustomCloudResourceManagerVMDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceManagerVMDNSSuffix
}</span>,
"AKSCustomCloudContainerRegistryDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ContainerRegistryDNSSuffix
}</span>,
"AKSCustomCloudCosmosDBDNSSuffix": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.CosmosDBDNSSuffix
}</span>,
"AKSCustomCloudTokenAudience": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.TokenAudience
}</span>,
"AKSCustomCloudResourceIdentifiersGraph": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.Graph
}</span>,
"AKSCustomCloudResourceIdentifiersKeyVault": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.KeyVault
}</span>,
"AKSCustomCloudResourceIdentifiersDatalake": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.Datalake
}</span>,
"AKSCustomCloudResourceIdentifiersBatch": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.Batch
}</span>,
"AKSCustomCloudResourceIdentifiersOperationalInsights": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.OperationalInsights
}</span>,
"AKSCustomCloudResourceIdentifiersStorage": func() string <span class="cov0" title="0">{
return cs.Properties.CustomCloudEnv.ResourceIdentifiers.Storage
}</span>,
"GetCSEHelpersScriptFilepath": func() string <span class="cov8" title="1">{
return cseHelpersScriptFilepath
}</span>,
"GetCSEHelpersScriptDistroFilepath": func() string <span class="cov8" title="1">{
return cseHelpersScriptDistroFilepath
}</span>,
"GetCSEInstallScriptFilepath": func() string <span class="cov8" title="1">{
return cseInstallScriptFilepath
}</span>,
"GetCSEInstallScriptDistroFilepath": func() string <span class="cov8" title="1">{
return cseInstallScriptDistroFilepath
}</span>,
"GetCSEConfigScriptFilepath": func() string <span class="cov8" title="1">{
return cseConfigScriptFilepath
}</span>,
"GetCustomSearchDomainsCSEScriptFilepath": func() string <span class="cov8" title="1">{
return customSearchDomainsCSEScriptFilepath
}</span>,
"GetDHCPv6ServiceCSEScriptFilepath": func() string <span class="cov8" title="1">{
return dhcpV6ServiceCSEScriptFilepath
}</span>,
"GetDHCPv6ConfigCSEScriptFilepath": func() string <span class="cov8" title="1">{
return dhcpV6ConfigCSEScriptFilepath
}</span>,
"HasPrivateAzureRegistryServer": func() bool <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.PrivateAzureRegistryServer != ""
}</span>,
"GetPrivateAzureRegistryServer": func() string <span class="cov8" title="1">{
return cs.Properties.OrchestratorProfile.KubernetesConfig.PrivateAzureRegistryServer
}</span>,
"OpenBraces": func() string <span class="cov8" title="1">{
return "{{"
}</span>,
"CloseBraces": func() string <span class="cov8" title="1">{
return "}}"
}</span>,
"BoolPtrToInt": func(p *bool) int <span class="cov8" title="1">{
if p == nil </span><span class="cov0" title="0">{
return 0
}</span>
<span class="cov8" title="1">if v := *p; v </span><span class="cov8" title="1">{
return 1
}</span>
<span class="cov0" title="0">return 0</span>
},
"UserAssignedIDEnabled": func() bool <span class="cov8" title="1">{
// TODO(qinhao): we need to move this to NodeBootstrappingConfiguration as cs.Properties
// is to be moved away from NodeBootstrappingConfiguration
return cs.Properties.OrchestratorProfile.KubernetesConfig.UserAssignedIDEnabled()
}</span>,
// HTTP proxy related funcs
"ShouldConfigureHTTPProxy": func() bool <span class="cov8" title="1">{
return config.HTTPProxyConfig != nil && (config.HTTPProxyConfig.HTTPProxy != nil || config.HTTPProxyConfig.HTTPSProxy != nil)
}</span>,
"HasHTTPProxy": func() bool <span class="cov0" title="0">{
return config.HTTPProxyConfig != nil && config.HTTPProxyConfig.HTTPProxy != nil
}</span>,
"HasHTTPSProxy": func() bool <span class="cov0" title="0">{
return config.HTTPProxyConfig != nil && config.HTTPProxyConfig.HTTPSProxy != nil
}</span>,
"HasNoProxy": func() bool <span class="cov0" title="0">{
return config.HTTPProxyConfig != nil && config.HTTPProxyConfig.NoProxy != nil
}</span>,
"GetHTTPProxy": func() string <span class="cov8" title="1">{
if config.HTTPProxyConfig != nil && config.HTTPProxyConfig.HTTPProxy != nil </span><span class="cov8" title="1">{
return *config.HTTPProxyConfig.HTTPProxy
}</span>
<span class="cov8" title="1">return ""</span>
},
"GetHTTPSProxy": func() string <span class="cov8" title="1">{
if config.HTTPProxyConfig != nil && config.HTTPProxyConfig.HTTPSProxy != nil </span><span class="cov8" title="1">{
return *config.HTTPProxyConfig.HTTPSProxy
}</span>
<span class="cov8" title="1">return ""</span>
},
"GetNoProxy": func() string <span class="cov8" title="1">{
if config.HTTPProxyConfig != nil && config.HTTPProxyConfig.NoProxy != nil </span><span class="cov8" title="1">{
return strings.Join(*config.HTTPProxyConfig.NoProxy, ",")
}</span>
<span class="cov8" title="1">return ""</span>
},
"ShouldConfigureHTTPProxyCA": func() bool <span class="cov8" title="1">{
return config.HTTPProxyConfig != nil && config.HTTPProxyConfig.TrustedCA != nil
}</span>,
"GetHTTPProxyCA": func() string <span class="cov8" title="1">{
if config.HTTPProxyConfig != nil && config.HTTPProxyConfig.TrustedCA != nil </span><span class="cov8" title="1">{
return *config.HTTPProxyConfig.TrustedCA
}</span>
<span class="cov8" title="1">return ""</span>
},
"FIPSEnabled": func() bool <span class="cov8" title="1">{
return config.FIPSEnabled
}</span>,
"GetMessageOfTheDay": func() string <span class="cov8" title="1">{
return profile.MessageOfTheDay
}</span>,
"GetProxyVariables": func() string <span class="cov8" title="1">{
return getProxyVariables(config)
}</span>,
"GetOutboundCommand": func() string <span class="cov8" title="1">{
return getOutBoundCmd(config, config.CloudSpecConfig)
}</span>,
"GPUNeedsFabricManager": func() bool <span class="cov8" title="1">{
return gpuNeedsFabricManager(profile.VMSize)
}</span>,
"GPUDriverVersion": func() string <span class="cov8" title="1">{
return getGPUDriverVersion(profile.VMSize)
}</span>,
"GetHnsRemediatorIntervalInMinutes": func() uint32 <span class="cov8" title="1">{
if cs.Properties.WindowsProfile != nil </span><span class="cov8" title="1">{
return cs.Properties.WindowsProfile.GetHnsRemediatorIntervalInMinutes()
}</span>
<span class="cov0" title="0">return 0</span>
},
"ShouldConfigureCustomCATrust": func() bool <span class="cov8" title="1">{
return areCustomCATrustCertsPopulated(*config)
}</span>,
"GetCustomCATrustConfigCerts": func() []string <span class="cov8" title="1">{
if areCustomCATrustCertsPopulated(*config) </span><span class="cov8" title="1">{
return config.CustomCATrustConfig.CustomCATrustCerts
}</span>
<span class="cov8" title="1">return []string{}</span>
},
"GetLogGeneratorIntervalInMinutes": func() uint32 <span class="cov8" title="1">{
if cs.Properties.WindowsProfile != nil </span><span class="cov8" title="1">{
return cs.Properties.WindowsProfile.GetLogGeneratorIntervalInMinutes()
}</span>
<span class="cov0" title="0">return 0</span>
},
"ShouldDisableSSH": func() bool <span class="cov8" title="1">{
return config.SSHStatus == datamodel.SSHOff
}</span>,
}
}
// NV series GPUs target graphics workloads vs NC which targets compute
// they typically use GRID, not CUDA drivers, and will fail to install CUDA drivers.
// NVv1 seems to run with CUDA, NVv5 requires GRID.
// NVv3 is untested on AKS, NVv4 is AMD so n/a, and NVv2 no longer seems to exist (?)
func getGPUDriverVersion(size string) string <span class="cov8" title="1">{
if useGridDrivers(size) </span><span class="cov8" title="1">{
return datamodel.Nvidia510GridDriverVersion
}</span>
<span class="cov8" title="1">if isStandardNCv1(size) </span><span class="cov8" title="1">{
return datamodel.Nvidia470CudaDriverVersion
}</span>
<span class="cov8" title="1">return datamodel.Nvidia525CudaDriverVersion</span>
}
func isStandardNCv1(size string) bool <span class="cov8" title="1">{
tmp := strings.ToLower(size)
return strings.HasPrefix(tmp, "standard_nc") && !strings.Contains(tmp, "_v")
}</span>
func useGridDrivers(size string) bool <span class="cov8" title="1">{
return datamodel.ConvergedGPUDriverSizes[strings.ToLower(size)]
}</span>