Skip to content

Commit 203efbf

Browse files
JiangtianLiwenwu449
authored andcommittedJan 22, 2018
Extend windows os drive size when customized OSDiskSizeGB is used (Azure#2097)
1 parent 88ec2fb commit 203efbf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎parts/kuberneteswindowssetup.ps1

+14
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ function Set-TelemetrySetting()
7676
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "CommercialId" -Value $global:WindowsTelemetryGUID -Force
7777
}
7878

79+
function Resize-OSDrive()
80+
{
81+
$osDrive = ((Get-WmiObject Win32_OperatingSystem).SystemDrive).TrimEnd(":")
82+
$size = (Get-Partition -DriveLetter $osDrive).Size
83+
$maxSize = (Get-PartitionSupportedSize -DriveLetter $osDrive).SizeMax
84+
if ($size -lt $maxSize)
85+
{
86+
Resize-Partition -DriveLetter $osDrive -Size $maxSize
87+
}
88+
}
89+
7990
function
8091
Get-KubeBinaries()
8192
{
@@ -369,6 +380,9 @@ try
369380
Write-Log "apply telemetry data setting"
370381
Set-TelemetrySetting
371382

383+
Write-Log "resize os drive if possible"
384+
Resize-OSDrive
385+
372386
Write-Log "download kubelet binaries and unzip"
373387
Get-KubeBinaries
374388

0 commit comments

Comments
 (0)