-
Notifications
You must be signed in to change notification settings - Fork 382
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 steps
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 the drivers and re-install. 2. Add logic to check the installed VC redistributable files, if the existing installd vc_redist version is equal to or higher than the lowest requirement, skip the installation; otherwise re-install the files provided in the image. 3. Optimize the logic of maintaining the system paths by removing the duplicated path. 4. Optimize Uninstall-OVS script by removing OVS bin paths from the system path after it is deleted. Signed-off-by: Wenying Dong <wenyingd@vmware.com>
- Loading branch information
Showing
7 changed files
with
377 additions
and
200 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
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
39 changes: 6 additions & 33 deletions
39
build/yamls/windows/containerd-with-ovs/conf/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,10 @@ | ||
$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" | ||
} | ||
|
||
# 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 = $mountPath\k\antrea\Install-OVS.ps1 | ||
if (Test-Path $OVSInstallScript) { | ||
& $OVSInstallScript -InstallUserspace $false -LocalFile $mountPath\openvswitch | ||
} else { | ||
Write-Host "Installation script not found: $OVSInstallScript, please manually install OVS drivers" | ||
exit 1 | ||
} |
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.