diff --git a/vhdbuilder/packer/configure-windows-vhd.ps1 b/vhdbuilder/packer/configure-windows-vhd.ps1 index fcc2688f6f9..8f8908c3e86 100644 --- a/vhdbuilder/packer/configure-windows-vhd.ps1 +++ b/vhdbuilder/packer/configure-windows-vhd.ps1 @@ -743,6 +743,10 @@ function Get-SystemDriveDiskInfo { foreach($disk in $disksInfo) { if ($disk.DeviceID -eq "C:") { Write-Log "Disk C: Free space: $($disk.FreeSpace), Total size: $($disk.Size)" + + if ($disk.FreeSpace -lt $global:lowestFreeSpace) { + throw "Disk C: Free space is less than $($global:lowestFreeSpace)" + } } } } diff --git a/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 b/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 index 79b4342f4b4..fab4a250939 100644 --- a/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 +++ b/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 @@ -8,6 +8,9 @@ if (-not ($validSKU -contains $windowsSKU)) { throw "Unsupported windows image SKU: $windowsSKU" } +# We need to guarantee that the node provisioning will not fail because the vhd is full before resize-osdisk is called in AKS Windows CSE script. +$global:lowestFreeSpace = 2*1024*1024*1024 # 2GB + # defaultContainerdPackageUrl refers to the stable containerd package used to pull and cache container images # Add cache for another containerd version which is not installed by default $global:defaultContainerdPackageUrl = "https://acs-mirror.azureedge.net/containerd/windows/v1.6.21-azure.1/binaries/containerd-v1.6.21-azure.1-windows-amd64.tar.gz"