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

Optimization possible to avoid pulling each container image twice #411

Closed
dziemba opened this issue Nov 6, 2024 · 3 comments · Fixed by #412 or #414
Closed

Optimization possible to avoid pulling each container image twice #411

dziemba opened this issue Nov 6, 2024 · 3 comments · Fixed by #412 or #414

Comments

@dziemba
Copy link

dziemba commented Nov 6, 2024

I think there’s an optimization that can be done in the agent-stack-k8s regarding image pulling. I understand the reasoning for the init-containers/preFlightContainers (see

// Init containers. These run in order before the regular containers.
) and I think that’s a reasonable solution.

Then however we do another pull for each image here:

c.ImagePullPolicy = corev1.PullAlways
which I believe is not necessary since we just pulled all these images via the init-containers.

In our clusters a no-op pull takes roughly a second, so this adds a second for each container used. When using many containers (we often have 5+), this adds up to quite a lot of extra time waiting. I believe it’s possible to just change the PullPolicy to Never to avoid this extra pulling, which is fine since we just pre-pulled the images in the init containers.

@DrJosh9000
Copy link
Contributor

Thanks for raising this @dziemba! This proposal seems sensible to me.

@DrJosh9000
Copy link
Contributor

I wonder if its worth choosing PullIfNotPresent over PullNever, on the (admittedly very very unlikely) chance that the image disappears in between the init container pulling and the regular containers starting?

@dziemba
Copy link
Author

dziemba commented Nov 7, 2024

Thanks for the quick fix! Yes, PullIfNotPresent is probably the better choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants