Skip to content

Commit

Permalink
Add support for Windows OVS Containerisation in Install-OVS script
Browse files Browse the repository at this point in the history
For antrea-io#4952

Signed-off-by: Naman Agarwal <[email protected]>
  • Loading branch information
NamanAg30 committed Jun 2, 2023
1 parent 5562b29 commit 44af62d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
9 changes: 8 additions & 1 deletion docs/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The following components should be configured and run on the Windows Node.

antrea-agent and kube-proxy run as processes on host and are managed by
management Pods. It is recommended to run OVS daemons as Windows services.
We also support running ovs daemons as processes inside container.
If you don't want to run antrea-agent and kube-proxy from the management Pods
Antrea also provides scripts which help install and run these two components
directly without Pod, please see [Manually run kube-proxy and antrea-agent on Windows worker Nodes](#Manually-run-kube-proxy-and-antrea-agent-on-Windows-worker-Nodes)
Expand Down Expand Up @@ -295,7 +296,13 @@ curl.exe -LO https://raw.githubusercontent.com/antrea-io/antrea/main/hack/window
.\Install-OVS.ps1 -ImportCertificate $false -Local -LocalFile <PathToOVSPackage> # Production
```

Verify the OVS services are installed.
If you want to containerise OVS for containerd runtime , use the ContaineriseOVS parameter as true.

```powershell
.\Install-OVS.ps1 -ContaineriseOVS $true
```

Verify the OVS services are installed.(not applicale if you containerise OVS)

```powershell
get-service ovsdb-server
Expand Down
18 changes: 16 additions & 2 deletions hack/windows/Install-OVS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
.PARAMETER ImportCertificate
Specifies if a certificate file is needed for OVS package. If true, certificate
will be retrieved from OVSExt.sys and a package.cer file will be generated.
.PARAMETER ContaineriseOVS
Specifies whether user wants to run ovs inside container.
#>
Param(
[parameter(Mandatory = $false)] [string] $DownloadDir,
Expand All @@ -29,6 +32,7 @@ Param(
[parameter(Mandatory = $false)] [bool] $CheckFileHash = $true,
[parameter(Mandatory = $false)] [string] $LocalFile,
[parameter(Mandatory = $false)] [bool] $ImportCertificate = $true
[parameter(Mandatory = $false)] [bool] $ContaineriseOVS = $false
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -251,6 +255,13 @@ function ConfigOVS() {
ovs-vsctl --no-wait set Open_vSwitch . ovs_version=$OVS_VERSION
}

if ($ContaineriseOVS -eq $true) {
if(!(Get-Process contaienrd )){
Write-error "Containerd runtime not found. Containerd runtime is required for OVS Containerisation."
exit 1
}
}

Log "Installation log location: $InstallLog"

CheckIfOVSInstalled
Expand All @@ -259,8 +270,11 @@ DownloadOVS

InstallOVS

InstallDependency
if ($ContaineriseOVS -eq $false) {
InstallDependency

ConfigOVS
ConfigOVS

}

Log "OVS Installation Complete!"
10 changes: 9 additions & 1 deletion hack/windows/Prepare-Node.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Install OVS
.PARAMETER NodeIP
The node ip used by kubelet
.PARAMETER OVSContainerisation
To determine whether ovs daemons are required to run inside container or on windows host.
.EXAMPLE
PS> .\Prepare-Node.ps1 -KubernetesVersion v1.18.0 -InstallOVS -NodeIP 192.168.1.10
Expand All @@ -32,6 +35,7 @@ Param(
[parameter(Mandatory = $true, HelpMessage="Node IP")] [string] $NodeIP,
[parameter(Mandatory = $false)] [switch] $InstallOVS = $false,
[parameter(Mandatory = $false, HelpMessage="Kubernetes download")] [string] $KubernetesURL="dl.k8s.io"
[parameter(Mandatory = $false)] [bool] $OVSContainerisation = $false
)
$ErrorActionPreference = 'Stop'

Expand Down Expand Up @@ -127,5 +131,9 @@ New-NetFirewallRule -Name kubelet -DisplayName 'kubelet' -Enabled True -Directio

if ($InstallOVS) {
Write-Host "Installing OVS"
& .\Install-OVS.ps1
if ($OVSContainerisation){
& .\Install-OVS.ps1 -ContaineriseOVS $true
} else {
& .\Install-OVS.ps1
}
}

0 comments on commit 44af62d

Please sign in to comment.