From 792e2447ae4ed0ad6f6293f4b1a39cf98e936e5b Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Wed, 10 Jan 2024 17:56:41 -0800 Subject: [PATCH] Fix Clean-AntreaNetwork.ps1 invocation in Prepare-AntreaAgent.ps1 (#5859) In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked with `-OVSRunMode "container"`. Fixes #5852 Signed-off-by: Antonin Bas --- hack/windows/Clean-AntreaNetwork.ps1 | 2 +- hack/windows/Prepare-AntreaAgent.ps1 | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hack/windows/Clean-AntreaNetwork.ps1 b/hack/windows/Clean-AntreaNetwork.ps1 index 191cea2b6f6..0c13a127306 100644 --- a/hack/windows/Clean-AntreaNetwork.ps1 +++ b/hack/windows/Clean-AntreaNetwork.ps1 @@ -10,7 +10,7 @@ Remove ovsdb-server and ovs-vswitchd services fom the host. The default value is $false. If this argument is set as true, this script would remove the two Windows services from the host. Otherwise, we consider that these services are supposed to be running on the host, so the script would try to recover them if their statuses are - not as expected. + not as expected. The parameter is ignored when OVSRunMode is "container". .PARAMETER OVSRunMode OVS run mode can be if OVS userspace processes were running inside a container in antrea-agent Pod or if OVS userspace processes were running as a Service on host. Default mode is . diff --git a/hack/windows/Prepare-AntreaAgent.ps1 b/hack/windows/Prepare-AntreaAgent.ps1 index baf9d716eed..78eca1ff5fc 100644 --- a/hack/windows/Prepare-AntreaAgent.ps1 +++ b/hack/windows/Prepare-AntreaAgent.ps1 @@ -32,8 +32,12 @@ if ($AntreaHnsNetwork) { } } if ($NeedCleanNetwork) { + $ovsRunMode = "service" + if ($RunOVSServices -eq $false) { + $ovsRunMode = "container" + } Write-Host "Cleaning stale Antrea network resources if they exist..." - & $CleanAntreaNetworkScript + & $CleanAntreaNetworkScript -OVSRunMode $ovsRunMode } # Enure OVS services are running. if ($RunOVSServices -eq $true) {