Navigation Menu

Skip to content
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

Add a containerd module #34402

Closed
wants to merge 1 commit into from

Conversation

vdemeester
Copy link
Member

@vdemeester vdemeester commented Jan 29, 2018

This add a containerd module so you can have a containerd systemd service
running and using it with other tools. One possibility is to make dockerd
using this containerd service using --containerd flag on dockerd

Signed-off-by: Vincent Demeester vincent@sbr.pm

Motivation for this change

Have a containerd module, that could be used with dockerd or kubernetes and cri-containerd, etc..

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Jan 30, 2018

the module is not included in modules/module-list.nix

@vdemeester
Copy link
Member Author

@Mic92 oups.. I forgot to commit that 🤦‍♂️

@vdemeester vdemeester force-pushed the add-containerd-module branch 3 times, most recently from 367c4ff to 3f1e076 Compare January 31, 2018 00:48
@vdemeester
Copy link
Member Author

ping 👼 🙏

""
''
${cfg.package}/bin/containerd \
${cfg.extraOptions}
Copy link
Member

Choose a reason for hiding this comment

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

somebody found that trick!

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔 😝


systemd.services.containerd = {
wantedBy = [ "multi-user.target" ];
environment = proxy_env;
Copy link
Member

Choose a reason for hiding this comment

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

Where is this option defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oups, it's not supposed to be there ... 😓

@vdemeester
Copy link
Member Author

Updated 👼


config = mkIf cfg.enable (mkMerge [{
environment.systemPackages = [ cfg.containerd ];
systemd.packages = [ cfg.containerd ];
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 pkgs.containerd or cfg.package. Have you ever tested this module?

ExecStart = [
""
''
${cfg.package}/bin/containerd \
Copy link
Member

Choose a reason for hiding this comment

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

cfg.package does not exists as well.

@Mic92
Copy link
Member

Mic92 commented Mar 12, 2018

Please test modules before ticking the Tested execution of all binary files checkbox in the pull request templates.

@vdemeester
Copy link
Member Author

@Mic92 oh.. seems like I didn't correctly update that file frol my nixos configuration, sorry 🙇, I'll update 😇

@colemickens
Copy link
Member

This seems okay to merge now?

@vdemeester
Copy link
Member Author

@colemickens I need to updated the module to be able to add some additionnal packages in the service path… This will be useful when using containerd with additionnal runtime (other than runc)

@vdemeester
Copy link
Member Author

Updated 👼

@colemickens
Copy link
Member

Ping @Mic92, can you review/merge? Thanks!

@vdemeester
Copy link
Member Author

ping @Mic92 @nlewo

@PsyanticY
Copy link
Contributor

ping @Mic92

default = ["/run/containerd/containerd.sock"];
description =
''
A list of unix and tcp containerd should listen to. The format follows
Copy link
Member

Choose a reason for hiding this comment

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

A list of unix and tcp what? Sockets?

Suggested change
A list of unix and tcp containerd should listen to. The format follows
A list of unix and TCP sockets containerd should listen to. The format follows

nixos/modules/virtualisation/containerd.nix Show resolved Hide resolved
description = "List of packages to be added to containerd service path";
};

extraOptions =
Copy link
Member

Choose a reason for hiding this comment

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

Why unnecessarily indent it?

Suggested change
extraOptions =
extraOptions = mkOption {

wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = [
""
Copy link
Member

Choose a reason for hiding this comment

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

What's this for?

ExecStart = [
""
''
${pkgs.containerd}/bin/containerd \
Copy link
Member

Choose a reason for hiding this comment

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

Does it work with a multiline command? It's very short, just put it in a single line.

${cfg.extraOptions}
''];
};
path = [ pkgs.containerd ] ++ cfg.packages;
Copy link
Member

Choose a reason for hiding this comment

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

You don't need containerd in the path if you're already calling it from the absolute path.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is required to get containerd-shim and some other containerd-* commands (mainly the shims)

###### interface

options.virtualisation.containerd = {
enable =
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
enable =
enable = mkEnableOption "containerd";

This generates the rest.

This add a containerd module so you can have a containerd systemd service
running and using it with other tools. One possibility is to make dockerd
using this containerd service using `--containerd` flag on dockerd

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@vdemeester
Copy link
Member Author

@Mic92 @nlewo @JohnAZoidberg finally updated this PR 😅

@stale
Copy link

stale bot commented Nov 3, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 3, 2020
@vdemeester vdemeester closed this Nov 3, 2020
@colemickens
Copy link
Member

@vdemeester did you abandon containerd or do you have this out-of-nixpkgs somewhere now?

@vdemeester
Copy link
Member Author

@vdemeester did you abandon containerd or do you have this out-of-nixpkgs somewhere now?

I keep a module in my own configuration, but I use it less than I used to. I closed the PR because I don't find enough time right now to update it and get it merge 😅. If someone wants to take over that would be nice, otherwise, the day I find some time, I'll re-open a new one 😉

@vdemeester
Copy link
Member Author

I can also re-open if we think it can get merged as is 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants