Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
junjiezhang1997 committed Jan 19, 2024
1 parent 4310a43 commit 160e3fe
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 378 deletions.
47 changes: 20 additions & 27 deletions parts/windows/kuberneteswindowssetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ try
# Download CSE function scripts
$Configuration = @"
{
"CSEScriptsPackageUrl": $global:CSEScriptsPackageUrl
"CSEScriptsPackageUrl": "$global:CSEScriptsPackageUrl"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -EventMessage "Start to get CSE scripts" -Configuration $Configuration
Expand Down Expand Up @@ -280,7 +280,7 @@ try

$Configuration = @"
{
"WindowsTelemetryGUID": $global:WindowsTelemetryGUID
"WindowsTelemetryGUID": "$global:WindowsTelemetryGUID"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.SetTelemetrySetting" -EventMessage "Start to apply telemetry data setting" -Configuration $Configuration
Expand Down Expand Up @@ -318,9 +318,7 @@ try

$Configuration = @"
{
"MasterIP": $MasterIP,
"KubeDnsServiceIp": $KubeDnsServiceIp,
"WindowsPauseImageURL": $global:WindowsPauseImageURL
"WindowsPauseImageURL": "$global:WindowsPauseImageURL"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.WriteKubeClusterConfig" -EventMessage "Start to write KubeCluster Config" -Configuration $Configuration
Expand All @@ -329,7 +327,7 @@ try

$Configuration = @"
{
"KubeBinariesPackageSASURL": $global:KubeBinariesPackageSASURL
"KubeBinariesPackageSASURL": "$global:KubeBinariesPackageSASURL"
}
"@
Write-Log "Download kubelet binaries and unzip"
Expand All @@ -342,7 +340,7 @@ try
# this is a temporary work around to get the binaries until we depreciate
# custom package and nssm.exe as defined in aks-engine#3851.
if ($global:WindowsKubeBinariesURL){
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.OverwriteKubeBinaries" -EventMessage "Start to overwrite kube node binaries" -Configuration $Configuration
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.OverwriteKubeBinaries" -EventMessage "Start to overwrite kube node binaries"
Write-Log "Overwriting kube node binaries from $global:WindowsKubeBinariesURL"
Get-KubeBinaries -KubeBinariesURL $global:WindowsKubeBinariesURL
Logs-To-End-Event -TaskName "AKS.WindowsCSE.OverwirteKubeBinaries" -IsClearTaskName $true
Expand All @@ -358,11 +356,8 @@ try
}
$Configuration = @"
{
"ContainerdUrl": $global:ContainerdUrl,
"CNIBinPath": $cniBinPath,
"CNIConfigPath": $cniConfigPath,
"KubeDir": $global:KubeDir,
"KubernetesVersion": $global:KubeBinariesVersion
"ContainerdUrl": "$global:ContainerdUrl",
"KubernetesVersion": "$global:KubeBinariesVersion"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallContainerdBasedOnKubernetesVersion" -EventMessage "Start to install ContainerD" -Configuration $Configuration
Expand All @@ -371,7 +366,7 @@ try

$Configuration = @"
{
"TargetEnvironment": $TargetEnvironment
"TargetEnvironment": "$TargetEnvironment"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.RetagImagesForAzureChinaCloud" -EventMessage "Start to retag images for Azure China Cloud" -Configuration $Configuration
Expand Down Expand Up @@ -424,7 +419,7 @@ try
if ($global:EnableCsiProxy) {
$Configuration = @"
{
"CsiProxyUrl": $global:CsiProxyUrl
"CsiProxyUrl": "$global:CsiProxyUrl"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.StartCsiProxyService" -EventMessage "Start Csi proxy service" -Configuration $Configuration
Expand Down Expand Up @@ -471,8 +466,8 @@ try
# Configure network policy.
$Configuration = @"
{
"NetworkPlugin": $global:NetworkPlugin
"HNSModule": $global:HNSModule
"NetworkPlugin": "$global:NetworkPlugin",
"HNSModule": "$global:HNSModule"
}
"@
Logs-To-Start-Event "ASK.WindowsCSE.GetAndImportHNSModule" -EventMessage "Start to get and import hns module" -Configuration $Configuration
Expand All @@ -482,7 +477,7 @@ try

$Configuration = @"
{
"VnetCNIPluginsURL": $global:VNetCNIPluginsURL
"VnetCNIPluginsURL": "$global:VNetCNIPluginsURL"
}
"@
Write-Log "Installing Azure VNet plugins"
Expand All @@ -494,9 +489,9 @@ try

$Configuration = @"
{
"IsDualStackEnabled": $global:IsDualStackEnabled,
"IsAzureCNIOverlayEnabled": $global:IsAzureCNIOverlayEnabled,
"IsDisableWindowsOutboundNat": $global:IsDisableWindowsOutboundNat
"IsDualStackEnabled": "$global:IsDualStackEnabled",
"IsAzureCNIOverlayEnabled": "$global:IsAzureCNIOverlayEnabled",
"IsDisableWindowsOutboundNat": "$global:IsDisableWindowsOutboundNat"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.SetAzureCNIConfig" -EventMessage "Start to set Azure CNI config" -Configuration $Configuration
Expand Down Expand Up @@ -560,7 +555,7 @@ try
Logs-To-End-Event -TaskName "AKS.WindowsCSE.RegisterLogsCleanupScriptTask" -IsClearTaskName $true
$Configuration = @"
{
"HNSRemediatorIntervalInMinutes": $global:HNSRemediatorIntervalInMinutes
"HNSRemediatorIntervalInMinutes": "$global:HNSRemediatorIntervalInMinutes"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.RegisterNodeResetScriptTask" -EventMessage "Start to register node reset script task" -Configuration $Configuration
Expand Down Expand Up @@ -595,7 +590,7 @@ try
}
"@
Write-Log "Start to install Windows gmsa package"
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -EventMessage "Start to install Windows gmsa package" -Configuration
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -EventMessage "Start to install Windows gmsa package" -Configuration $Configuration
Install-GmsaPlugin -GmsaPackageUrl $global:WindowsGmsaPackageUrl
Logs-To-End-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -IsClearTaskName $true
}
Expand All @@ -605,9 +600,7 @@ try
if ($global:WindowsCalicoPackageURL) {
$Configuration = @"
{
"KubeServiceCIDR": $global:KubeServiceCIDR,
"KubeDnsServiceIp": $KubeDnsServiceIp,
"WindowsCalicoPackageURL": $global:WindowsCalicoPackageURL
"WindowsCalicoPackageURL": "$global:WindowsCalicoPackageURL"
}
"@
Write-Log "Start calico installation"
Expand All @@ -618,8 +611,8 @@ try

$Configuration = @"
{
"ConfigGPUDriverIfNeeded": $global:ConfigGPUDriverIfNeeded,
"GpuDriverURL": $global:GpuDriverURL
"ConfigGPUDriverIfNeeded": "$global:ConfigGPUDriverIfNeeded",
"GpuDriverURL": "$global:GpuDriverURL"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGPUDriver" -EventMessage "Start to install GPU driver" -Configuration $Configuration
Expand Down
47 changes: 20 additions & 27 deletions pkg/agent/testdata/AKSWindows2019+CustomCloud/CustomData
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ try
# Download CSE function scripts
$Configuration = @"
{
"CSEScriptsPackageUrl": $global:CSEScriptsPackageUrl
"CSEScriptsPackageUrl": "$global:CSEScriptsPackageUrl"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.DownloadAndExpandCSEScriptPackageUrl" -EventMessage "Start to get CSE scripts" -Configuration $Configuration
Expand Down Expand Up @@ -276,7 +276,7 @@ try

$Configuration = @"
{
"WindowsTelemetryGUID": $global:WindowsTelemetryGUID
"WindowsTelemetryGUID": "$global:WindowsTelemetryGUID"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.SetTelemetrySetting" -EventMessage "Start to apply telemetry data setting" -Configuration $Configuration
Expand Down Expand Up @@ -314,9 +314,7 @@ try

$Configuration = @"
{
"MasterIP": $MasterIP,
"KubeDnsServiceIp": $KubeDnsServiceIp,
"WindowsPauseImageURL": $global:WindowsPauseImageURL
"WindowsPauseImageURL": "$global:WindowsPauseImageURL"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.WriteKubeClusterConfig" -EventMessage "Start to write KubeCluster Config" -Configuration $Configuration
Expand All @@ -325,7 +323,7 @@ try

$Configuration = @"
{
"KubeBinariesPackageSASURL": $global:KubeBinariesPackageSASURL
"KubeBinariesPackageSASURL": "$global:KubeBinariesPackageSASURL"
}
"@
Write-Log "Download kubelet binaries and unzip"
Expand All @@ -338,7 +336,7 @@ try
# this is a temporary work around to get the binaries until we depreciate
# custom package and nssm.exe as defined in aks-engine#3851.
if ($global:WindowsKubeBinariesURL){
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.OverwriteKubeBinaries" -EventMessage "Start to overwrite kube node binaries" -Configuration $Configuration
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.OverwriteKubeBinaries" -EventMessage "Start to overwrite kube node binaries"
Write-Log "Overwriting kube node binaries from $global:WindowsKubeBinariesURL"
Get-KubeBinaries -KubeBinariesURL $global:WindowsKubeBinariesURL
Logs-To-End-Event -TaskName "AKS.WindowsCSE.OverwirteKubeBinaries" -IsClearTaskName $true
Expand All @@ -354,11 +352,8 @@ try
}
$Configuration = @"
{
"ContainerdUrl": $global:ContainerdUrl,
"CNIBinPath": $cniBinPath,
"CNIConfigPath": $cniConfigPath,
"KubeDir": $global:KubeDir,
"KubernetesVersion": $global:KubeBinariesVersion
"ContainerdUrl": "$global:ContainerdUrl",
"KubernetesVersion": "$global:KubeBinariesVersion"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallContainerdBasedOnKubernetesVersion" -EventMessage "Start to install ContainerD" -Configuration $Configuration
Expand All @@ -367,7 +362,7 @@ try

$Configuration = @"
{
"TargetEnvironment": $TargetEnvironment
"TargetEnvironment": "$TargetEnvironment"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.RetagImagesForAzureChinaCloud" -EventMessage "Start to retag images for Azure China Cloud" -Configuration $Configuration
Expand Down Expand Up @@ -420,7 +415,7 @@ try
if ($global:EnableCsiProxy) {
$Configuration = @"
{
"CsiProxyUrl": $global:CsiProxyUrl
"CsiProxyUrl": "$global:CsiProxyUrl"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.StartCsiProxyService" -EventMessage "Start Csi proxy service" -Configuration $Configuration
Expand Down Expand Up @@ -467,8 +462,8 @@ try
# Configure network policy.
$Configuration = @"
{
"NetworkPlugin": $global:NetworkPlugin
"HNSModule": $global:HNSModule
"NetworkPlugin": "$global:NetworkPlugin",
"HNSModule": "$global:HNSModule"
}
"@
Logs-To-Start-Event "ASK.WindowsCSE.GetAndImportHNSModule" -EventMessage "Start to get and import hns module" -Configuration $Configuration
Expand All @@ -478,7 +473,7 @@ try

$Configuration = @"
{
"VnetCNIPluginsURL": $global:VNetCNIPluginsURL
"VnetCNIPluginsURL": "$global:VNetCNIPluginsURL"
}
"@
Write-Log "Installing Azure VNet plugins"
Expand All @@ -490,9 +485,9 @@ try

$Configuration = @"
{
"IsDualStackEnabled": $global:IsDualStackEnabled,
"IsAzureCNIOverlayEnabled": $global:IsAzureCNIOverlayEnabled,
"IsDisableWindowsOutboundNat": $global:IsDisableWindowsOutboundNat
"IsDualStackEnabled": "$global:IsDualStackEnabled",
"IsAzureCNIOverlayEnabled": "$global:IsAzureCNIOverlayEnabled",
"IsDisableWindowsOutboundNat": "$global:IsDisableWindowsOutboundNat"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.SetAzureCNIConfig" -EventMessage "Start to set Azure CNI config" -Configuration $Configuration
Expand Down Expand Up @@ -556,7 +551,7 @@ try
Logs-To-End-Event -TaskName "AKS.WindowsCSE.RegisterLogsCleanupScriptTask" -IsClearTaskName $true
$Configuration = @"
{
"HNSRemediatorIntervalInMinutes": $global:HNSRemediatorIntervalInMinutes
"HNSRemediatorIntervalInMinutes": "$global:HNSRemediatorIntervalInMinutes"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.RegisterNodeResetScriptTask" -EventMessage "Start to register node reset script task" -Configuration $Configuration
Expand Down Expand Up @@ -591,7 +586,7 @@ try
}
"@
Write-Log "Start to install Windows gmsa package"
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -EventMessage "Start to install Windows gmsa package" -Configuration
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -EventMessage "Start to install Windows gmsa package" -Configuration $Configuration
Install-GmsaPlugin -GmsaPackageUrl $global:WindowsGmsaPackageUrl
Logs-To-End-Event -TaskName "AKS.WindowsCSE.InstallGmsaPlugin" -IsClearTaskName $true
}
Expand All @@ -601,9 +596,7 @@ try
if ($global:WindowsCalicoPackageURL) {
$Configuration = @"
{
"KubeServiceCIDR": $global:KubeServiceCIDR,
"KubeDnsServiceIp": $KubeDnsServiceIp,
"WindowsCalicoPackageURL": $global:WindowsCalicoPackageURL
"WindowsCalicoPackageURL": "$global:WindowsCalicoPackageURL"
}
"@
Write-Log "Start calico installation"
Expand All @@ -614,8 +607,8 @@ try

$Configuration = @"
{
"ConfigGPUDriverIfNeeded": $global:ConfigGPUDriverIfNeeded,
"GpuDriverURL": $global:GpuDriverURL
"ConfigGPUDriverIfNeeded": "$global:ConfigGPUDriverIfNeeded",
"GpuDriverURL": "$global:GpuDriverURL"
}
"@
Logs-To-Start-Event -TaskName "AKS.WindowsCSE.InstallGPUDriver" -EventMessage "Start to install GPU driver" -Configuration $Configuration
Expand Down
Loading

0 comments on commit 160e3fe

Please sign in to comment.