Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

fix: fix network cleanup code on windows for contianerd nodes #4154

Merged
merged 3 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions staging/provisioning/windows/cleanupnetwork.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $Global:ClusterConfiguration = ConvertFrom-Json ((Get-Content "c:\k\kubeclusterc
$global:NetworkMode = "L2Bridge"
$global:ContainerRuntime = $Global:ClusterConfiguration.Cri.Name
$global:NetworkPlugin = $Global:ClusterConfiguration.Cni.Name
$global:HNSModule = "c:\k\hns.psm1"

ipmo $global:HNSModule

Expand Down Expand Up @@ -49,13 +50,21 @@ if ($global:NetworkPlugin -eq "azure") {
taskkill /IM azure-vnet.exe /f
taskkill /IM azure-vnet-ipam.exe /f

# azure-cni logs currently end up in c:\windows\system32 when machines are configured with containerd.
# https://github.com/containerd/containerd/issues/4928
$filesToRemove = @(
"c:\k\azure-vnet.json",
"c:\k\azure-vnet.json.lock",
"c:\k\azure-vnet-ipam.json",
"c:\k\azure-vnet-ipam.json.lock"
"c:\k\azure-vnet-ipamv6.json",
"c:\k\azure-vnet-ipamv6.json.lock"
"c:\windows\system32\azure-vnet.json",
"c:\windows\system32\azure-vnet.json.lock",
"c:\windows\system32\azure-vnet-ipam.json",
"c:\windows\system32\azure-vnet-ipam.json.lock"
"c:\windows\system32\azure-vnet-ipamv6.json",
"c:\windows\system32\azure-vnet-ipamv6.json.lock"
)

foreach ($file in $filesToRemove) {
Expand Down
2 changes: 1 addition & 1 deletion staging/provisioning/windows/kubeletstart.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ if ($global:NetworkPlugin -eq "kubenet") {
$process | Stop-Process | Out-Null
}

./cleanupnetwork.ps1
& "c:\k\cleanupnetwork.ps1"
jsturtevant marked this conversation as resolved.
Show resolved Hide resolved

Write-Host "Creating a new hns Network"
$hnsNetwork = New-HNSNetwork -Type $global:NetworkMode -AddressPrefix $podCIDR -Gateway $masterSubnetGW -Name $global:NetworkMode.ToLower() -Verbose
Expand Down