-
Notifications
You must be signed in to change notification settings - Fork 380
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
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 with the provided files. 3. Optimize the logic of maintaining the env paths by removing the duplicated paths. 4. Optimize Uninstall-OVS script by removing OVS bin paths from the system path after it is deleted. 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" | ||
exit 1 | ||
} | ||
Write-Host "Completed OVS 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.