Skip to content
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

Build images on the node directly #1253

Conversation

fruttasecca
Copy link
Member

@fruttasecca fruttasecca commented Sep 12, 2022

Makes it so that all image builds (environment and custom jupyter) are built directly on the node. This allows a faster build since the image doesn't need to be pushed to the registry to consider the build complete, and allows starting steps or other pods that depend on the new image right away.

To accomplish this, we distinguish between our two supported container runtimes (docker and containerd) and use a different builder for a different runtime, buildx and buildkit respectively. In the case of buildkit + containerd, bidirectional mounting is needed, and, given the introduced risk, the buildkit daemon is not run ephemerally as part of the builder pod but runs as a daemonset. This is to reduce the risk of issues when it comes to the daemonset having to remove temporary mounts etc.

When using buildx, we mount the container runtime socket into the builder pod, which will use the docker buildx CLI to communicate with the runtime and build. With buildkit, we mount the socket of the buildkit daemon into the builder pod; the buildkit daemon (and daemonset) will mount the socket of the container runtime.

This PR introduces 3 new Orchest images:

  • buildx-builder
  • buildkit-builder
  • buildkit-daemon

As a result of this change the way changes to base images are tested has been simplified.

Some k8s flavours place "unix://" in front of the path.
This commit does two things:
- it reworks the argo workflow into a pod. The reason is that the
containers that argo injects share the volumes of the container we
specify, and, when using bidirectional mounting, it leads to errors
because said mounting requires a privileged container, and it's
currently not possible to specify such an option for the containers that argo injects. We ended up not needing to use bidirectional mounting at the builder level but I've decided to still go with this since it would take time to revert and we might need bidirectional mountin at the builder level in the future.
- adds support for a buildkit worker by changing what worker is used
based on the container runtime and adjusting the logging sidecar

In hindsight the commit should probably have been split in two.
@fruttasecca fruttasecca added new feature request New feature request improvement An improvement or enhancement to an existing feature. and removed new feature request New feature request labels Sep 13, 2022
@fruttasecca fruttasecca marked this pull request as ready for review September 13, 2022 06:31
@yannickperrenet
Copy link
Contributor

From my high-level understanding of what is being done in this PR, I think it looks good. The exact impact/requirement of the mounts I can only vaguely guess, but overall I don't see anything wrong with the approach. 😸

@fruttasecca fruttasecca force-pushed the feat/build-images-on-the-node-directly branch from 232f44d to 1e8644b Compare September 13, 2022 15:00
Base automatically changed from feat/env-builds-parallelism to improv/change-image-digest-management September 13, 2022 16:06
Base automatically changed from improv/change-image-digest-management to improv/change-built-image-distribution-model September 14, 2022 05:02
@fruttasecca fruttasecca merged commit c6ddcb9 into improv/change-built-image-distribution-model Sep 14, 2022
@fruttasecca fruttasecca deleted the feat/build-images-on-the-node-directly branch September 14, 2022 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An improvement or enhancement to an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants