Skip to content

Use user-specific temp directory if set#2325

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
cloudfoundry-incubator:pr-tempdir
May 4, 2018
Merged

Use user-specific temp directory if set#2325
crosbymichael merged 1 commit intocontainerd:masterfrom
cloudfoundry-incubator:pr-tempdir

Conversation

@danail-branekov
Copy link
Copy Markdown
Contributor

This allows non-privileged users to use containerd. This is part of a
larger track of work integrating containerd into Cloudfoundry's garden
with support for rootless.

Also, runc already supports the XDG_RUNTIME_DIR so supporting the variable here as well makes sense.

Here is a link to our tracker on the containerd work: https://www.pivotaltracker.com/n/projects/1158420/search?q=label%3A%22containerd%22

[#156343575]

Signed-off-by: Claudia Beresford [email protected]

This allows non-privileged users to use containerd. This is part of a
larger track of work integrating containerd into Cloudfoundry's garden
with support for rootless.

[#156343575]

Signed-off-by: Claudia Beresford <[email protected]>
@codecov-io
Copy link
Copy Markdown

codecov-io commented May 4, 2018

Codecov Report

Merging #2325 into master will increase coverage by 0.01%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2325      +/-   ##
==========================================
+ Coverage   45.41%   45.43%   +0.01%     
==========================================
  Files          83       83              
  Lines        9210     9214       +4     
==========================================
+ Hits         4183     4186       +3     
- Misses       4351     4352       +1     
  Partials      676      676
Flag Coverage Δ
#linux 49.91% <60%> (+0.01%) ⬆️
#windows 41.24% <0%> (ø) ⬆️
Impacted Files Coverage Δ
archive/tar.go 43.05% <0%> (ø) ⬆️
mount/temp.go 14.28% <75%> (+14.28%) ⬆️

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 40c3acd...fc8bce5. Read the comment docs.

@stevvooe
Copy link
Copy Markdown
Member

stevvooe commented May 4, 2018

LGTM

I've run into similar problems during demos.

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.

LGTM

I guess we need to do same for FIFO dir as well (sorry I can't look into deeper during kubecon), but it can be done in separate PR.

@AkihiroSuda
Copy link
Copy Markdown
Member

@danail-branekov

If you want to add tasks to #2262 plz let us know

Copy link
Copy Markdown
Member

@crosbymichael crosbymichael left a comment

Choose a reason for hiding this comment

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

I think we need more logic around this because you need to set the sticky bit if you are using this directory. You can see the implementation in runc for how we are using this when userns is enabled:

	root := "/run/runc"
	if os.Geteuid() != 0 {
		runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
		if runtimeDir != "" {
			root = runtimeDir + "/runc"
			// According to the XDG specification, we need to set anything in
			// XDG_RUNTIME_DIR to have a sticky bit if we don't want it to get
			// auto-pruned.
			if err := os.MkdirAll(root, 0700); err != nil {
				fatal(err)
			}
			if err := os.Chmod(root, 0700|os.ModeSticky); err != nil {
				fatal(err)
			}
		}
}

Copy link
Copy Markdown
Member

@crosbymichael crosbymichael left a comment

Choose a reason for hiding this comment

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

LGTM

After reading the spec again and how we are using it, we are safe without the use of the sticky bit (files modified within last 6hrs or sticky bit). Sorry for the noise.

@crosbymichael crosbymichael merged commit 08b43d9 into containerd:master May 4, 2018
@danail-branekov danail-branekov deleted the pr-tempdir branch May 11, 2018 08:48
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