-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] Optimize the containerized OVS installation (#6383)
1. Add logic to check the installed OVSext drivers, if only the desired version of driver is already installed, skip the installation; otherwise, remove the existing drivers and re-install. 2. Add logic to check the installed VC redistributable files, if the existing installed vc_redist version is greater or equal than the min required version, skip the installation; otherwise re-install with the provided files. 3. Improve the logic updating the env paths by removing duplicated paths. 4. Improve Uninstall-OVS script by removing OVS bin paths from the system path after they are deleted. 5. Fix certificate import for a signed OVS driver when Node is running Windows Server 2022. Note that running `.\Install-OVS.ps1` manually is no longer required when using the containerized OVS installation method, even when using the test-signed OVS driver that we provide. Signed-off-by: Wenying Dong <[email protected]>
- Loading branch information
Showing
10 changed files
with
550 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$ErrorActionPreference = "Stop" | ||
$mountPath = $env:CONTAINER_SANDBOX_MOUNT_POINT | ||
$mountPath = ($mountPath.Replace('\', '/')).TrimEnd('/') | ||
$env:PATH = $env:PATH + ";$mountPath/Windows/System32;$mountPath/k/antrea/bin;$mountPath/openvswitch/usr/bin;$mountPath/openvswitch/usr/sbin" | ||
$env:PATH = $env:PATH + ";$mountPath/k/antrea/bin;$mountPath/openvswitch/usr/bin;$mountPath/openvswitch/usr/sbin" | ||
& antrea-agent --config=$mountPath/etc/antrea/antrea-agent.conf --logtostderr=false --log_dir=c:/var/log/antrea --alsologtostderr --log_file_max_size=100 --log_file_max_num=4 --v=0 |
41 changes: 9 additions & 32 deletions
41
build/charts/antrea-windows/conf/ovs/Install-OVSDriver.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,14 @@ | ||
$ErrorActionPreference = "Stop" | ||
$mountPath = $env:CONTAINER_SANDBOX_MOUNT_POINT | ||
$mountPath = ($mountPath.Replace('\', '/')).TrimEnd('/') | ||
$OVSDriverDir = "$mountPath\openvswitch\driver" | ||
|
||
# Check if OVSExt driver is already installed | ||
$driverStatus = netcfg -q ovsext | ||
if ($driverStatus -like '*not installed*') { | ||
# Install OVS Driver | ||
$result = netcfg -l $OVSDriverDir/ovsext.inf -c s -i OVSExt | ||
if ($result -like '*failed*') { | ||
Write-Host "Failed to install OVSExt driver: $result" | ||
exit 1 | ||
} | ||
Write-Host "OVSExt driver has been installed" | ||
$OVSInstallScript = "$mountPath\k\antrea\Install-OVS.ps1" | ||
if (-not (Test-Path $OVSInstallScript)) { | ||
Write-Host "Installation script not found: $OVSInstallScript, you may be using an invalid antrea-windows container image" | ||
exit 1 | ||
} | ||
|
||
# Check if the VC redistributable is already installed. | ||
$OVSRedistDir="$mountPath\openvswitch\redist" | ||
if (Test-Path $OVSRedistDir) { | ||
$dllFound = $false | ||
$paths = $env:PATH -split ';' | ||
foreach ($path in $paths) { | ||
$dllFiles = Get-ChildItem -Path $path -Filter "vcruntime*.dll" -File -ErrorAction SilentlyContinue | ||
if ($dllFiles.Count -gt 0) { | ||
$dllFound = $true | ||
break | ||
} | ||
} | ||
|
||
# vcruntime dlls are not installed on the host, then install the binaries. | ||
if (-not $dllFound) { | ||
Get-ChildItem $OVSRedistDir -Filter *.exe | ForEach-Object { | ||
Start-Process -FilePath $_.FullName -Args '/install /passive /norestart' -Verb RunAs -Wait | ||
} | ||
} | ||
& $OVSInstallScript -LocalFile "$mountPath/openvswitch" -InstallUserspace $false | ||
If (!$?) { | ||
Write-Host "Failed to install OVS driver" | ||
exit 1 | ||
} | ||
Write-Host "Completed OVS driver installation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.