Skip to content

Conversation

@luodw
Copy link

@luodw luodw commented Mar 30, 2022

When intergrating nydus-snapshotter with kata, it need delivery some
information to kata-shim runtime, so this pr add ExtraOptions for Mount struct to
delivery infomations and it would also be useful for other remote
snapshotters and runtimes.

Issue: 6656

Signed-off-by: luodaowen.backend [email protected]

@k8s-ci-robot
Copy link

Hi @luodw. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 30, 2022

Build succeeded.

// Options specifies zero or more fstab style mount options.
repeated string options = 4;

// ExtraOption specifies zero or more extra options except fstab style options
Copy link
Member

Choose a reason for hiding this comment

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

Could you add example values

Copy link
Author

Choose a reason for hiding this comment

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

@AkihiroSuda Ok, different case maybe need different extraoptions, take nydus as an example, nydus-snapshotter(remote-snapshotter) should delivery nydus image metadata file and nydus daemom configs to kata-shim runtime, so these two items can be add to extraoptions to delivery.

Copy link
Member

Choose a reason for hiding this comment

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

it is about interface change. If the case is more specifically, like demo or something, it will be easy to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

@luodw I think it is important to emphasize (in the interface comments) that the ExtraOptions field is opaque to containerd and is ignored by the containerd mount.Mount API. It aims to provide a way for the snapshotter to pass extra information to the container runtime.

An example of such extra information, in the nydus case, can be the nydus image bootstrap file location and the nydusd configuration, etc. It will be put into a predefined structure in a string format and be decoded in kata runtime, where this information is then passed to nydusd for real usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fuweid @AkihiroSuda @ktock Thanks for your comments! Does the approach make sense to you? We don't have an end-to-end demo yet. But we can work on integration first if you prefer to see it working end-to-end wise (which requires modification to nydus-snapshotter, containerd and kata).

Copy link
Author

Choose a reason for hiding this comment

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

@fuweid Thanks, I have run a end-to-end demo in my dev machine successfully, and maybe it is more clear to show the code,

  1. This WIP PR is the modification for nydus-snapshotter to use the ExtraOption and pass config information;
  2. This WIP PR is the modification for kata-shim runtime to parse the ExtraOption and use it;

@luodw luodw force-pushed the mount_extroption branch from b465575 to 2289618 Compare March 30, 2022 14:22
@AkihiroSuda AkihiroSuda requested a review from ktock March 30, 2022 14:35
@luodw luodw force-pushed the mount_extroption branch from 2289618 to 38e93f5 Compare March 30, 2022 14:50
@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 30, 2022

Build succeeded.

mount/mount.go Outdated
// these are platform specific.
Options []string
// ExtraOptions contains extra options except fstab-style mount options.
ExtraOptions []string
Copy link
Member

Choose a reason for hiding this comment

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

How is this used for mounting a filesystem?
If the purpose is configuring the runtime, isn't task-related structs (e.g. TaskInfo) the proper place to fix?

Copy link
Author

@luodw luodw Mar 31, 2022

Choose a reason for hiding this comment

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

@ktock This field is not used to mount a filesystem like overlayfs, it's main role is used to delivery config information. As remote-snapshotter(take stargz-snapshotter for example) only return []mount.Mount, so if we want to delivery some config information from remote-snapshotter to runtime, adding ExtraOptions field may be a suitable way.

In containerd, it will ignore ExtraOptions and do mount overlayfs as original logic. In runtime, it will parse the ExtraOptions and use it. In nydus case, nydus-snapshotter will add nydus image metedata file path and config to ExtraOptions and delivery to kata-runtime, kata-runtime used these info to request nydusd (fuse/virtiofs daemon) to mount nydus rafs fllesystem.

Copy link
Member

Choose a reason for hiding this comment

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

Wondering if this should be more of a MetaData field (making it more clear it's entirely up to the consumer what to use it for)

Copy link
Contributor

Choose a reason for hiding this comment

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

@thaJeztah Do you mean renaming ExtraOption []string to MetaData []string? It does make it more clear.

Copy link
Member

@thaJeztah thaJeztah Apr 1, 2022

Choose a reason for hiding this comment

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

yes, I was thinking along those lines (but of course could use input from others); mostly was reading along, and if I understand it correctly, effectively this information is arbitrary "extra information", that can be used by other systems for <insert purpose here>.

Naming it MetaData (or something like that), makes it clearer that whatever is in that field is not a strict "contract" (from containerd's perspective).

Of course the description of the field should also outline this, and could (perhaps) add some recommendations (e.g. recommend to use a common prefix (io.katacontainers.someopt=foo)) <--- thinking out loud here; I know we did the same recommendation for labels

Copy link
Author

Choose a reason for hiding this comment

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

@thaJeztah Thanks for you advise, I agree that MetaDatas []string is more clear. I have updated the field and it's description, hope for your reivew again.

@luodw luodw force-pushed the mount_extroption branch from 38e93f5 to 7aa1646 Compare March 31, 2022 03:53
@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 31, 2022

Build succeeded.

When intergrating nydus with kata, it need pass some information
from nydus-snapshotter to kata-shim runtime, so this pr adds MetaDatas
field for Mount struct to carry extra infomation.

Signed-off-by: luodaowen.backend <[email protected]>
@luodw luodw force-pushed the mount_extroption branch from 7aa1646 to 713d049 Compare April 1, 2022 13:41
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 1, 2022

Build succeeded.

Type: m.Type,
Source: m.Source,
Options: m.Options,
MetaDatas: m.MetaDatas,
Copy link
Member

Choose a reason for hiding this comment

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

This should be Metadata (or MetaData) (singular), as data is already plural.

But ok to wait with changing as the discussion hasn't completed yet, so maintainers may have more input on this 😅

Copy link
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

Extending the mount interface needs more design consideration before making interface changes. We try to avoid extending existing interfaces to side load metadata. For the mount case, there are other features that necessitate a deeper look at the mount type such as device activation or other pre-mount configuration. We should first discuss the commonality of these features and the needed behavior changes by the mounters.

@mikebrow
Copy link
Member

mikebrow commented Apr 6, 2022

/ok-to-test

@k8s-ci-robot
Copy link

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label May 20, 2024
@github-actions
Copy link

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

10 participants