This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
add: volume preloading via ?preload=true
directive in Acornfile (manager#1598)
#2351
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
iwilltry42
force-pushed
the
issue/manager-1598
branch
from
November 21, 2023 10:14
3a7c956
to
31b34b3
Compare
iwilltry42
requested review from
ibuildthecloud,
thedadams,
njhale,
keyallis,
g-linville and
tylerslaton
November 21, 2023 10:14
thedadams
approved these changes
Nov 21, 2023
// Data will be copied to the data/ subdirectory and we'll drop a .preload-done file in the root to indicate that | ||
// the copy has been completed (and should not be repeated). | ||
initContainers = append(initContainers, corev1.Container{ | ||
Name: "acorn-preload-dir-" + sanitizeVolumeName(src), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible, though unlikely, for a user to define an init container with this name. Should we add some randomness to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just add the app UID to it :)
It's already unlikely enough, given that we're using the path hash, so this should do it.
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
g-linville
reviewed
Nov 21, 2023
Co-authored-by: Grant Linville <[email protected]> Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
Signed-off-by: Thorsten Klein <[email protected]>
tylerslaton
approved these changes
Nov 21, 2023
@g-linville I addressed your comments, please have another look whenever you have some time :) |
g-linville
approved these changes
Nov 21, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref https://github.com/acorn-io/manager/issues/1598
Defining a volume, e.g.
dirs: "/usr/share/nginx/html": "volume://myvol?preload=true"
will pre-populate the volume with the data that the used container image has at the defined place.Usually the directory would be empty (overlayed with the empty volume), so we're mimicking the Docker copy-up behavior here using initContainers.
Note: The data lands in the
data/
subdirectory of the volume.Note 2: There's no validation if ?preload is put on e.g.
secret://
- didn't see that anywhere else, so we just do nothing in that caseWhat is this?
First off: Darren wants it. It's a pre-requisite for an upcoming dev flow.
The example above
dirs: "/usr/share/nginx/html": "volume://myvol?preload=true"
will do the following:Add an initContainer to the resulting Deployment which copies the static busybox binary from the Acorn runtime base image to a shared ephemeral volume
Add another initContainer that's running the target app's image and uses the shared busybox binary to copy the contents of
/usr/share/nginx/html
within the image to the volume myvol's subPathdata/
.preload-done
intomyvol
's root, that we use to avoid doing the process twice (i.e. preloading happens only once in the app lifecycle)The
data/
subPath is then mounted into the actual application container on/usr/share/nginx/html
, so that the image contents are thereThis is mimicking the default Docker behavior, which is not present in Kubernetes. Without this, the mountPath will just be empty if the volume is fresh.
Checklist
This is a title (#1216)
. Here's an example