Add Container field to store client-defined data#1378
Add Container field to store client-defined data#1378mlaventure merged 2 commits intocontainerd:masterfrom
Container field to store client-defined data#1378Conversation
|
aren't labels sufficient for this? |
|
I don't think |
|
I think |
|
@cpuguy83 What kind of data in your mind could not put into label? Could you give an example? Thanks! :) |
|
Mainly it allows us to store the spec that we created the container from (e.g. docker API) directly with the container in containerd rather than having this split up in multiple metadata stores. |
|
@cpuguy83 In Kubernetes containerd integration, we also need to put stuff (CRI container config etc.) inside container metadata store. Currently our plan is to serialize them and put them inside a label. :p Won't that work? |
|
I would like to not lose type information, especially since we may (definitely) want to update this. |
2b014cc to
b8e8884
Compare
@cpuguy83 Do you mean that you'll update it after creating container? Or the spec will be updated across releases?
We were planning to do that because we don't have other options at that time. :) Actually this also benefits us. |
b8e8884 to
84dc48a
Compare
Between versions.
👍 Totally it seems worth while to do something here to reduce the burden for implementers. |
5fa1f4b to
761841c
Compare
761841c to
e73cabb
Compare
|
Updated to use |
|
It looks like there's a deadlock in the linux runtime, those 4 tests are stuck on a call to the task service:
|
|
Can you rebase on master to pick up the fix? |
e73cabb to
fe2af86
Compare
Codecov Report
@@ Coverage Diff @@
## master #1378 +/- ##
==========================================
+ Coverage 40.82% 40.85% +0.03%
==========================================
Files 23 23
Lines 2920 2964 +44
==========================================
+ Hits 1192 1211 +19
- Misses 1451 1466 +15
- Partials 277 287 +10
Continue to review full report at Codecov.
|
|
Would it make sense to have this for |
|
This is missing the code in the metadata snapshotter to actually store the data in extension 😇 |
fe2af86 to
870efa3
Compare
|
My mistake, assumed it was using the proto. |
283f8fc to
8c67de5
Compare
There was a problem hiding this comment.
could you also add a a test where you load the container and check if the data is correctly sent back?
Also, don't forget to clean up after the test, this need a container.Delete() call.
There was a problem hiding this comment.
NOTE: just do it within that same test, no need for a new one
55bd94d to
7e17e0b
Compare
|
Ok, this is updated. |
There was a problem hiding this comment.
Could this take an interface and we do the any marshal in the opt?
7e17e0b to
94f9575
Compare
There was a problem hiding this comment.
This will require the urls to be registered with typeurl.Register unless they are proto messages. May want to specify so in the godoc
This field allows a client to store specialized information in the container metadata rather than having to store this itself and keep the data in sync with containerd. Signed-off-by: Brian Goff <[email protected]>
94f9575 to
3552ce5
Compare
| // Use this to decorate the container object with additional data for the client | ||
| // integration. | ||
| // | ||
| // Make sure to register the type of `extension` in the typeurl package via |
There was a problem hiding this comment.
Sorry, I should have been more clear 😅
If the url was not registered via typeurl.Register and the message doesn't implement protobuf/proto.Message this will error out :)
There was a problem hiding this comment.
We should probably be able to support json here, as well.
|
I think this design is fine, but I'm worried that we are going to make it hard to manage updates that involve more than one extensions (I know, my fault for suggesting repeated... ;) ). The problem here is that one needs to read all the extensions, then make the modification for their extension, then send back all the extensions. This model will also allow for duplicates. Would it be better to have a map where one can update only the extension they care about by specifying the key for the fieldpath? For example, you could update the |
|
I think a map is a good idea. It also lets us treat the extensions like fields and will be more straight forward to encode in the store. |
|
Moved this to a map type. PTAL |
c35e3c6 to
eaf4140
Compare
To allow for updating extensions without collisions, we have moved to using a map type that can be explicitly selected via the field path for updates. This ensures that multiple parties can operate on their extensions without stepping on each other's toes or incurring an inordinate number of round trips. Signed-off-by: Stephen J Day <[email protected]>
eaf4140 to
f7d31e2
Compare
|
LGTM |
|
@crosbymichael @stevvooe Can we get this in before the end of September (our 1.0.0-alpha.0 release)? We want to switch to Extension before that to avoid backward compatibility issue in the future. :) |
|
Sweet, thanks for carrying this through! |
This field allows a client to store specialized information in the
container metadata rather than having to store this itself and keep
the data in sync with containerd.