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

Conversation

antoninbas
Copy link
Contributor

In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked with -OVSRunMode "container".

Fixes #5852

@antoninbas antoninbas added action/backport Indicates a PR that requires backports. action/release-note Indicates a PR that should be included in release notes. labels Jan 9, 2024
@@ -128,6 +128,9 @@ switch ($OVSRunMode)
}
}
"container" {
# In container mode, OVS services run in containers, not as host services.
# We can remove host services if they exist.
RemoveOVSService
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bit tricky to remove OVS services when specifying that $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

In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes antrea-io#5852

Signed-off-by: Antonin Bas <[email protected]>
Copy link
Contributor

@wenyingd wenyingd left a comment

Choose a reason for hiding this comment

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

LGTM

@antoninbas
Copy link
Contributor Author

/skip-all

@antoninbas antoninbas merged commit 792e244 into antrea-io:main Jan 11, 2024
50 of 54 checks passed
@antoninbas antoninbas deleted the fix-Prepare-AntreaAgent.ps1 branch January 11, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/backport Indicates a PR that requires backports. action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Prepare-AntreaAgent.ps1 fails for containerized ovs
2 participants