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

Bundle a buildkit instance within sandbox to facilitate local image spec builds #3860

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

jeevb
Copy link
Contributor

@jeevb jeevb commented Jul 11, 2023

Related: flyteorg/flytectl#413

Tested by running the following command:

envd context create --name flyte-sandbox --builder tcp --builder-address localhost:30003 --use

and executing (pyflyte run --remote wf.py my_wf) the following workflow:

from flytekit import task, workflow, ImageSpec

image = ImageSpec(
    name="imagespec",
    registry="localhost:30000",
    packages=["smart-open[gcs]"],
    apt_packages=["git"],
)


@task(container_image=image)
def my_task() -> str:
    return "hello, world!"


@workflow
def my_wf() -> str:
    return my_task()

…pec builds

Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
@jeevb
Copy link
Contributor Author

jeevb commented Jul 17, 2023

@eapolinario @cosmicBboy @wild-endeavor: For discussion.

Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what's happening? what's the interaction between envd and buildkit? I don't remember having to run a buildkit container when running envd outside of the sandbox. why do i need it now when running something inside?

docker/sandbox-bundled/Makefile Show resolved Hide resolved
Signed-off-by: Jeev B <jeevb@users.noreply.github.com>
@jeevb
Copy link
Contributor Author

jeevb commented Jul 17, 2023

can you explain what's happening? what's the interaction between envd and buildkit? I don't remember having to run a buildkit container when running envd outside of the sandbox. why do i need it now when running something inside?

envd uses buildkit under the hood to build images. If you run envd context ls, you can see that it defaults to using a local docker container for running builds. This container is created lazily when processing builds. The issue with using a separate container is that docker networking is not set up to allow this container to talk to the registry at localhost:30000. So it basically can't read the registry to check for the presence of an existing image (or push a new image to it). Running buildkit inside the sandbox allows us to fully manage the networking so that the experience with using ImageSpec locally is seamless, with a small cost of ~165MB.

@jeevb jeevb marked this pull request as ready for review July 20, 2023 13:20
@jeevb jeevb merged commit a7d3e38 into master Jul 20, 2023
@jeevb jeevb deleted the jeev/sandbox-buildkitd branch July 20, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants