-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use buildx and hpc image to build Antrea Windows images #6311
Comments
But if there is a new version of
Are you referring to this: microsoft/Windows-Containers#34?
How is this a limitation, given that containerd (with host-process container) is the only supported deployment option on Windows for Antrea (besides Windows native services of course)? By the way, it feels like the 2 things described in this issue are a bit orthogonal: the transition from the current nanoserver base image to the hpc image could happen independently from the transition to BuildKit (i.e., building the Windows image entirely on a Linux machine, using BuildKit)? Another thing is that experimental support for building Windows containers (on Windows) with BuildKit was recently added: https://github.com/moby/buildkit/blob/master/docs/windows.md. It's probably too early for us to use it, and I am not sure it is relevant to us, if we are considering fully building the Windows image on Linux. |
In theory, yes, we may need to bump up this base image version. Besides, the base image just provides an isolation to run the expected processes, and it provides a storage/layer to help store or run the binary or files when building images. We don't use this layer to build/compile the bits. I don't think we always have the requirement to change it.
Yes, this is what I thought. For example, we can build antrea-agent.exe using golang based on Linux layer by setting
This is for the future extension, not the existing requirement. For example, if we plan to provide other Windows container images, e.g., a separate container to run antctl on Windows, which not require host-process, then we need additional step to copy the binaries from hpc to nanoserver without a new build.
I didn't verified if the registry cache can work on Windows image. From my experiment, I suspect the answer is no. As we need to new buildx instance dedicated for Windows if we expect to build Windows container on Linux, I am not sure if the cache can share in multiple buildx instances. Maybe we can add support on it in the next step?
If our plan is to build windows container on Linux, then the buildx support on Windows is not a blocker for us. As for we can fully build Windows image on Linux or not, we only build antrea-agent binary in the current Windows Agent image, and other dependencies like openvswitch and host-local.exe are got as binaries by downloading from given URLs. So I think building on Linux can cover our requirement by now. Besides, a major motivation to move to hpc is it may introduce much work if we continuing building Windows images per OS version, e.g., we may need to think about how to support the previous Windows versions. This is because a container image built on Server 2022 can't run on Server 2019 on Windows. So we shall either maintain antrea-agent-windows for both Server 2019 and Server 2022, or we drop the support for Server 2019 (but we may have users who still use 2019). As for using buildx to build image based on Linux, it is because Windows container image are always larger, and we need many additional steps in the base image to prepare the build utilities in the base images like git and mgwin as Windows image is not so friendly for dev, which makes the build time longer. |
It would be a different image. For example, for Linux, we use
|
@antoninbas I got a strange observation with cache when building Windows image by multi-platform. It may take about 20s to push antrea/base-windows to registry, but it takes hundreds of seconds to push the cache to registry. Since it is simple when building Windows images, only downloads and extracts the cni files to base-windows, and downloads and extracts ovs zip to ovs-windows, and no complicated compilations in them, do we really need cache for Windows? |
There are 2 reasons why we use caching for the Linux image:
It seems that for Windows, these reasons may not apply. The hpc image is not mutable and is essentially a |
@wenyingd From your PR: windows-ovs: 22.4s If this is correct, then it looks like pushing base images to the registry is not very useful. It would add complexity for very limited benefits, and pushing / pulling base images will take some time too. |
Yes, this is also an ask in my mind. Originally, we will use the windows-base to save CNI (host-local) files, and install the build utilities like 7zip, git and mgwin (for make and gcc) which is required to build the Windows image on a Windows host base. But now we didn't require these utilities as we will use buildx and Linux base (ubuntu22.04) to build everything. It seems the windows-base is useless. So maybe I can remove it in the change? |
These statistics are got without configuring cache options. |
Yes, I would suggest trying this. It will simplify maintenance IMO, and reduce complexity of the build process. |
Yes, that's how I understood it. I was saying that the numbers look good, and that there seems to be no need for caching or even for a base image that we push to the registry. |
I tried to merge the logic of building base and agent into a single Dockerfile (see my latest update), the total build time in one round on a fresh setup is about 241s (another try is 218s), including,
Do you think it is acceptable? @antoninbas Below is a sample of build details,
|
Describe the problem/challenge you have
As we already remove the support on Docker runtime on Windows since Antrea v2.0, we could assume that antrea-agent is running as a host process container on Windows Node using Containerd runtime ( we don't discuss the process mode here). Microsoft has provided a minimal base image whose size is 7.45KB to help build the host process container, which makes the container can run on any Windows host without dependency on the exact Window OS version. So we shall think about migrating our Antrea Windows image to leverage this feature.
The advantages include,
The candidate changes include,
Describe the solution you'd like
Using buildx and hpc base image to build Antrea Windows image.
Anything else you would like to add?
The text was updated successfully, but these errors were encountered: