-
Notifications
You must be signed in to change notification settings - Fork 95
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
image-rs: Support to reuse meta_store #623
image-rs: Support to reuse meta_store #623
Conversation
To avoid any ambiguity and support scenarios where meta_store.json is set manually, ensure that meta_store.json uses an absolute path. Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
support to serialize metadata and write it to `meta_store.json` Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Needs to add related unit tests. |
Add unit test to verify the reuse of the meta store. Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
I’ve added code and unit tests to enable the reuse of the meta store and layers in the image client. |
750576b
to
6fa703c
Compare
The template of {
"image_db": {
"sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e": {
"id": "sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e",
"digest": "sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a",
"reference": "mcr.microsoft.com/hello-world",
"image_config": {
"created": "2019-01-01T01:29:27.650294696Z",
"architecture": "amd64",
"os": "linux",
"config": {
"User": "",
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/hello"
],
"WorkingDir": ""
},
"rootfs": {
"type": "layers",
"diff_ids": [
"sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3"
]
},
"history": [
{
"created": "2019-01-01T01:29:27.416803627Z",
"created_by": "/bin/sh -c #(nop) COPY file:f77490f70ce51da25bd21bfc30cb5e1a24b2b65eb37d4af0c327ddc24f0986a6 in / "
},
{
"created": "2019-01-01T01:29:27.650294696Z",
"created_by": "/bin/sh -c #(nop) CMD [\"/hello\"]",
"empty_layer": true
}
]
},
"signed": false,
"layer_metas": [
{
"decoder": "Gzip",
"encrypted": false,
"compressed_digest": "sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced",
"uncompressed_digest": "sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3",
"store_path": "/tmp/.tmpYioDI2/layers/sha256_1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced"
}
]
}
},
"layer_db": {
"sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced": {
"decoder": "Gzip",
"encrypted": false,
"compressed_digest": "sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced",
"uncompressed_digest": "sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3",
"store_path": "/tmp/.tmpYioDI2/layers/sha256_1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced"
}
},
"snapshot_db": {}
} |
Thanks @ChengyuZhu6 for fixing this. Few questions
Is my understanding correct? |
image-rs will download the image only once, even if multiple containers in a pod use same image. |
Just a reminder: we don't need to populate the image layers to rootfs. Instead, we should store the layers in the |
I'm not sure if there is an existing tool or script for this, but it sounds like an interesting idea. |
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.
nice code, thanks @ChengyuZhu6 ! Let's wait for an approval from @bpradipt
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.
/lgtm
Thanks @ChengyuZhu6
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.
LGTM
We have had some issues with layer caching on the host before (i.e. encrypted and unencrypted images can share layers), but I don't think that will be a problem here.
Support to write
meta_store
tometa_store.json
.Set the absolute path for meta store with
meta_store.json