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

POD-823: Add repo cache #27

Merged
merged 9 commits into from
Sep 5, 2024
Merged

POD-823: Add repo cache #27

merged 9 commits into from
Sep 5, 2024

Conversation

bkneis
Copy link
Contributor

@bkneis bkneis commented Sep 2, 2024

This PR introduces a new CLI parameter --registry-cache to toggle the kaniko builder's cache from a local directory to a registry.

Testing on my local kind cluster I have run through two workflows, after building devpod's examples/build (see loft-sh/devpod#1245):

  1. Adding a devcontainer.json feature (docker in docker)
  • With cache: 3m21s
  • Without cache: 7m36s
  1. Changing build context (adding files to examples/build/app and adding RUN layer to Dockerfile)
  • With cache: 3m13s
  • Without cache: 7m46s

As you can see the remote cache has managed to save a user 50% build time when building updates to an existing image. Unfortunately the overall build time is still not great and this is a known issue - GoogleContainerTools/kaniko#875

We could switch to docker in docker, but this comes with security concerns since we will need priv permissions to access the daemon.sock :/

EDIT: Some users report http2 being the cause, GoogleContainerTools/kaniko#2751. I will try implement this and see if it improves build time.

@bkneis bkneis marked this pull request as draft September 4, 2024 12:10
@bkneis bkneis marked this pull request as ready for review September 5, 2024 08:34
Copy link
Member

@pascalbreuninger pascalbreuninger left a comment

Choose a reason for hiding this comment

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

LGTM! Do you want to open another PR for the http2 fix or do it here?

@bkneis
Copy link
Contributor Author

bkneis commented Sep 5, 2024

@pascalbreuninger I'll do it here and continue to use this PR until tomorrow once testing has been complete :) So far though I have managed to get build times closer to 2 minutes by optimizing the snap shotting and skipping pushing of cache :) Once I can get the prebuild hash to play with dockerless then kaniko will be close to dind speed!

cmd/build.go Outdated Show resolved Hide resolved
cmd/build.go Outdated Show resolved Hide resolved
@bkneis bkneis merged commit 0316292 into loft-sh:main Sep 5, 2024
1 check passed
@bkneis bkneis deleted the POD-823/cache branch September 5, 2024 14:28
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