Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Clean-AntreaNetwork.ps1 invocation in Prepare-AntreaAgent.ps1 #5859

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion hack/windows/Clean-AntreaNetwork.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 <container> if OVS userspace processes were running inside a container in antrea-agent Pod
or <service> if OVS userspace processes were running as a Service on host. Default mode is <service>.
Expand Down
6 changes: 5 additions & 1 deletion hack/windows/Prepare-AntreaAgent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We called $CleanAntreaNetworkScript is just to clean-up antrea-hns network. If we add "remove OVS service" here, it may break the prepare-AntreaAgent script in this scenario: for the first time, we call "./Prepare-AntreaAgent.ps1 -RunOVSServices $false", for the second time , we call "./Prepare-AntreaAgent.ps1 -RunOVSServices $true". The second run would fail because OVS services are removed.

If the purpose is just to remove OVS services (e.g. we want to update Windows host from running OVS as service to running inside container), we can use a separate call "./Clean-AntreaNetwork.ps1 -RemoveOVS $true -OVSRunMode service"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the call to RemoveOVSService in Clean-AntreaNetwork.ps1

}
# Enure OVS services are running.
if ($RunOVSServices -eq $true) {
Expand Down
Loading