Skip to content

Commit

Permalink
The changes create windows ovs image for ovs userspace processes cont…
Browse files Browse the repository at this point in the history
…ainerization

Signed-off-by: Rajnish Kumar <[email protected]>
  • Loading branch information
rajnkamr committed Jun 26, 2023
1 parent e635aef commit 972bfae
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GO_VERSION := $(shell head -n 1 build/images/deps/go-version)
CNI_BINARIES_VERSION := $(shell head -n 1 build/images/deps/cni-binaries-version)
NANOSERVER_VERSION := $(shell head -n 1 build/images/deps/nanoserver-version)
BUILD_TAG := $(shell build/images/build-tag.sh)
WIN_BUILD_TAG := $(shell echo $(GO_VERSION) $(CNI_BINARIES_VERSION) $(NANOSERVER_VERSION)|md5sum|head -c 10)
WIN_BUILD_TAG := $(shell echo $(GO_VERSION) $(CNI_BINARIES_VERSION) $(NANOSERVER_VERSION) |md5sum|head -c 10)
GIT_HOOKS := $(shell find hack/git_client_side_hooks -type f -print)
DOCKER_NETWORK ?= default
TRIVY_TARGET_IMAGE ?=
Expand Down
1 change: 1 addition & 0 deletions build/images/base-windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ COPY --from=windows-utility-base ["C:\\\\wins","C:\\\\wins"]
COPY --from=windows-golang ["C:\\\\Program Files\\\\Go", "C:\\\\Program Files\\\\Go"]

RUN setx /m PATH "C:\Program Files\7-Zip;C:\git\bin;C:\git\usr\bin;C:\mingw64\bin;C:\Program Files\Go\bin;%GOPATH\bin%;%PATH%"

3 changes: 2 additions & 1 deletion build/images/base-windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ cd build/images/base-windows
GO_VERSION=$(head -n 1 ../deps/go-version)
CNI_BINARIES_VERSION=$(head -n 1 ../deps/cni-binaries-version)
NANOSERVER_VERSION=$(head -n 1 ../deps/nanoserver-version)
WIN_OVS_VERSION=$(head -n 1 ../deps/ovs-version-windows)
WIN_BUILD_TAG=$(echo $GO_VERSION $CNI_BINARIES_VERSION $NANOSERVER_VERSION| md5sum| head -c 10)
docker build -t antrea/base-windows:$WIN_BUILD_TAG --build-arg GO_VERSION=$GO_VERSION --build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg NANOSERVER_VERSION=$NANOSERVER_VERSION .
docker build -t antrea/base-windows:$WIN_BUILD_TAG --build-arg GO_VERSION=$GO_VERSION --build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg NANOSERVER_VERSION=$NANOSERVER_VERSION --build-arg WIN_OVS_VERSION=$WIN_OVS_VERSION .
docker push antrea/base-windows:$WIN_BUILD_TAG
```

Expand Down
1 change: 1 addition & 0 deletions build/images/deps/ovs-version-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.5
44 changes: 44 additions & 0 deletions build/images/ovs/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2023 Antrea Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG NANOSERVER_VERSION

FROM mcr.microsoft.com/windows/servercore:${NANOSERVER_VERSION} as windows-ovs
ARG WIN_OVS_VERSION

# Switch to a privileged user
USER ContainerAdministrator

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV WIN_OVS_VERSION ${WIN_OVS_VERSION}

# Install VC for ovs
RUN curl.exe -Lo C:\vc_redist.x64.exe https://aka.ms/vs/17/release/vc_redist.x64.exe; \
powershell -Command "Start-Process -FilePath C:\vc_redist.x64.exe -ArgumentList ‘/install’,’/quiet’,’/norestart’ -Verb RunAs -Wait"

# Download and extract OVS
RUN curl.exe -fLo C:\ovs-${env:WIN_OVS_VERSION}-antrea.0-win64.zip https://downloads.antrea.io/ovs/ovs-${env:WIN_OVS_VERSION}-antrea.0-win64.zip; \
powershell -Command Expand-Archive C:\ovs-${env:WIN_OVS_VERSION}-antrea.0-win64.zip -DestinationPath C:\ ; \
rm C:\ovs-${env:WIN_OVS_VERSION}-antrea.0-win64.zip

# Download, extract OpenSSL and copy libraries to ovs
RUN curl.exe -Lo C:\openssl-1.0.2u-x64_86-win64.zip https://indy.fulgan.com/SSL/openssl-1.0.2u-x64_86-win64.zip; \
powershell -Command Expand-Archive C:\openssl-1.0.2u-x64_86-win64.zip -DestinationPath C:\ ; \
rm C:\openssl-1.0.2u-x64_86-win64.zip ; \
cp C:/libeay32.dll C:/openvswitch/usr/sbin/ ; \
cp C:/ssleay32.dll C:/openvswitch/usr/sbin/ ; \
mv C:/libeay32.dll C:/openvswitch/usr/bin/ ; \
mv C:/ssleay32.dll C:/openvswitch/usr/bin/ ; \
mkdir C:/openvswitch/var/run/openvswitch

15 changes: 14 additions & 1 deletion hack/build-antrea-windows-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ pushd "$THIS_DIR/.." > /dev/null
NANOSERVER_VERSION=$(head -n 1 build/images/deps/nanoserver-version)
CNI_BINARIES_VERSION=$(head -n 1 build/images/deps/cni-binaries-version)
GO_VERSION=$(head -n 1 build/images/deps/go-version)
WIN_BUILD_TAG=$(echo $GO_VERSION $CNI_BINARIES_VERSION $NANOSERVER_VERSION| md5sum| head -c 10)
WIN_OVS_VERSION=$(head -n 1 build/images/deps/ovs-version-windows)
WIN_BUILD_OVS_TAG=$(echo $NANOSERVER_VERSION $WIN_OVS_VERSION | md5sum| head -c 10)
WIN_BUILD_TAG=$(echo $GO_VERSION $CNI_BINARIES_VERSION $NANOSERVER_VERSION | md5sum| head -c 10)


echo "WIN_BUILD_TAG=$WIN_BUILD_TAG"

Expand All @@ -81,6 +84,7 @@ if $PULL; then
docker pull antrea/windows-utility-base:$WIN_BUILD_TAG || true
docker pull antrea/windows-golang:$WIN_BUILD_TAG || true
docker pull antrea/base-windows:$WIN_BUILD_TAG || true
docker pull antrea/windows-ovs:$WIN_BUILD_OVS_TAG || true
fi

cd build/images/base-windows
Expand All @@ -105,10 +109,19 @@ docker build \
--build-arg NANOSERVER_VERSION=$NANOSERVER_VERSION .
cd -

cd build/images/ovs

docker build --target windows-ovs -f Dockerfile.windows \
-t antrea/windows-ovs:$WIN_BUILD_OVS_TAG \
--build-arg WIN_OVS_VERSION=$WIN_OVS_VERSION \
--build-arg NANOSERVER_VERSION=$NANOSERVER_VERSION .
cd -

if $PUSH; then
docker push antrea/windows-utility-base:$WIN_BUILD_TAG
docker push antrea/windows-golang:$WIN_BUILD_TAG
docker push antrea/base-windows:$WIN_BUILD_TAG
docker push antrea/windows-ovs:$WIN_BUILD_OVS_TAG
fi

export NO_PULL=1
Expand Down

0 comments on commit 972bfae

Please sign in to comment.