Skip to content

[WIP] allow user namespace remapping using snapshotters#3885

Closed
liaojh1998 wants to merge 1 commit intocontainerd:masterfrom
liaojh1998:fuse-overlayfs
Closed

[WIP] allow user namespace remapping using snapshotters#3885
liaojh1998 wants to merge 1 commit intocontainerd:masterfrom
liaojh1998:fuse-overlayfs

Conversation

@liaojh1998
Copy link
Copy Markdown
Contributor

@liaojh1998 liaojh1998 commented Dec 12, 2019

There's a big overhead from using Lchown for user namespace remapping. The overhead can be reduced from using fuse-overlayfs's dynamic remapping through mounting. This commit will allow fuse-overlayfs snapshotter to do the remapping instead.

To be used in conjunction with #3765, and
containerd/fuse-overlayfs-snapshotter#5.

Related issue #3841.

Signed-off-by: Jie Hao Liao [email protected]

cc @AkihiroSuda

Please let me know what's the best way to test this and if any checks are needed.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Dec 12, 2019

Build succeeded.

Comment thread container_opts_unix.go Outdated
@AkihiroSuda
Copy link
Copy Markdown
Member

thanks for working on this 👍

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 12, 2019

Codecov Report

Merging #3885 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3885      +/-   ##
==========================================
- Coverage   42.33%   42.32%   -0.02%     
==========================================
  Files         130      130              
  Lines       14678    14678              
==========================================
- Hits         6214     6212       -2     
- Misses       7539     7540       +1     
- Partials      925      926       +1
Flag Coverage Δ
#linux 45.74% <ø> (-0.02%) ⬇️
#windows 37.8% <ø> (ø) ⬆️
Impacted Files Coverage Δ
snapshots/btrfs/btrfs.go 57.39% <0%> (-0.9%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f01665a...e31e63a. Read the comment docs.

Comment thread container_linux_test.go Outdated
Copy link
Copy Markdown
Contributor Author

@liaojh1998 liaojh1998 Dec 12, 2019

Choose a reason for hiding this comment

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

TODO: Add test for "snapshotter"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AkihiroSuda would this be important?

@liaojh1998 liaojh1998 changed the title [WIP] allow user namespace remapping using fuse-overlayfs [WIP] allow user namespace remapping using snapshotters Dec 12, 2019
@liaojh1998
Copy link
Copy Markdown
Contributor Author

Added typedef for remapper.

Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Hardcoding 65535 isn't correct, but can be worked out later.
LGTM.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Dec 12, 2019

Build succeeded.

@liaojh1998
Copy link
Copy Markdown
Contributor Author

Okay, I'll modify that when we use multiple remappings.

@liaojh1998 liaojh1998 changed the title [WIP] allow user namespace remapping using snapshotters allow user namespace remapping using snapshotters Dec 12, 2019
Comment thread container_opts_unix.go
}
}
mounts, err := snapshotter.Prepare(ctx, usernsID+"-remap", parent)
mounts, err := snapshotter.Prepare(ctx, usernsID+"-remap", parent, opts...)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem necessary if the snapshotter is supporting the mapping. I think a better approach would be to leave the remapping functions alone and just provide a helper which can set the labels and just use WithNewSnapshot

Copy link
Copy Markdown
Contributor Author

@liaojh1998 liaojh1998 Jan 15, 2020

Choose a reason for hiding this comment

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

Okay. I'm thinking of an implementation that uses a switch statement in WithRemappedSnapshot() and WithRemappedSnapshotView() to call WithNewSnapshot() based on the remapper. Would this be a better approach or should I leave all of the remapping functions alone?

cc @AkihiroSuda

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ping @dmcgowan

@AkihiroSuda
Copy link
Copy Markdown
Member

ping @liaojh1998

@liaojh1998 liaojh1998 changed the title allow user namespace remapping using snapshotters WIP: allow user namespace remapping using snapshotters Jan 15, 2020
@liaojh1998 liaojh1998 changed the title WIP: allow user namespace remapping using snapshotters [WIP] allow user namespace remapping using snapshotters Jan 15, 2020
@AkihiroSuda
Copy link
Copy Markdown
Member

@dmcgowan PTAL?

@AkihiroSuda
Copy link
Copy Markdown
Member

@liaojh1998

I'm thinking of an implementation that uses a switch statement in WithRemappedSnapshot() and WithRemappedSnapshotView() to call WithNewSnapshot() based on the remapper. Would this be a better approach or should I leave all of the remapping functions alone?

I think that is fine, could you update PR?

@liaojh1998
Copy link
Copy Markdown
Contributor Author

Okay, I'll make an update around this weekend.

@estesp
Copy link
Copy Markdown
Member

estesp commented Mar 25, 2020

@liaojh1998 will you have time soon to update this PR? Would be good to get this in

@AkihiroSuda
Copy link
Copy Markdown
Member

@liaojh1998 Are you still interested in this?

@AkihiroSuda
Copy link
Copy Markdown
Member

@dmcgowan @estesp Can we get this in v1.4? (beta2?)

@dmcgowan
Copy link
Copy Markdown
Member

Carried in #4259

@dmcgowan dmcgowan closed this Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants