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

WIP: Add frakti to run kubernetes pods in KVM #21966

Closed
wants to merge 5 commits into from

Conversation

moretea
Copy link
Contributor

@moretea moretea commented Jan 18, 2017

Motivation for this change

Frakti uses hyperd to start the different containers that live in one pod in a KVM vm.
This offers better isolation.

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
    • Linux
  • 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.

  • package frakti
  • package hyperd
  • make hyperd service work
    • make mkfs.ext4 available in path to the daemon.
    • write nixos test for hyperd
  • make frakti service work
  • write nixos test for frakti

@mention-bot
Copy link

@moretea, thanks for your PR! By analyzing the history of the files in this pull request, we identified @offlinehacker, @nckx and @domenkozar to be potential reviewers.

@moretea
Copy link
Contributor Author

moretea commented Jan 18, 2017

At this moment, I'm not able to build hyperd, and have no clue how to fix this.
It tries to build (part of?) docker and fails with the following error message:

...
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
# github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs
go/src/github.com/hyperhq/hyperd/vendor/github.com/docker/docker/daemon/graphdriver/btrfs/btrfs.go:164: args.name undefined (type C.struct_btrfs_ioctl_vol_args_v2 has no field or method name)
builder for ‘/nix/store/z7sw93xk8azwxaazrq3b8pjjnp31nypm-hyperd-20170117-0195fad.drv’ failed with exit code 11
error: build of ‘/nix/store/z7sw93xk8azwxaazrq3b8pjjnp31nypm-hyperd-20170117-0195fad.drv’ failed

/cc @offlinehacker @tailhook (since you're the maintainers of Docker). Do you know what's going wrong here?

@offlinehacker
Copy link
Contributor

Try deleting all the vendor folders of the vendor folders, this is usually an issue.

leaveDotGit = true;
deepClone = true;
url = "https://github.com/hyperhq/hyperd.git";
sha256 = "0d5fkc3vniyh5nkfrna2bfzaxhni6njq0h03rp2x13vm2ha78dy4";
Copy link
Contributor

Choose a reason for hiding this comment

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

I got 0sb6h6c7n0q0qskvylp94f4vkp9h6yjrmc2lqm78ri8p033raj5s

listenStreams = [ "/run/libvirt/virtlockd-sock" ];
};

systemd.services.virtlockd = {
Copy link
Contributor

Choose a reason for hiding this comment

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

had to comment this out because it conflicts with libvirtd, maybe libvirtd just needs to be a dependency for this?

The exact error is error: The unique option systemd.services.virtlockd.description' is defined multiple times, in /etc/nixos/nixpkgs/nixos/modules/virtualisation/libvirtd.nix' and /etc/nixos/nixpkgs/nixos/modules/virtualisation/hyperd.nix'.` for reference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be /var/run/hyperd.sock

Copy link
Contributor

Choose a reason for hiding this comment

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

I got the same error.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this redefines a service that already exists

Kernel = ${cfg.kernel}
Initrd = ${cfg.initrd}
Bridge = ${cfg.bridge}
BridgeIP =${cfg.bridge_ip}
Copy link
Contributor

Choose a reason for hiding this comment

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

I added Hypervisor = libvirt here, but I guess this should be a config option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got it working with kvm actually.

wantedBy = [ "multi-user.target" ];
after = [ "systemd-udev-settle.service" ];

path = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I added

pkgs.e2fsprogs
pkgs.utillinux
pkgs.kmod
pkgs.iptables

To get this to start

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed, added those myself as well 👍


serviceConfig = {
ExecStart = ''
@${pkgs.hyperd}/bin/hyperd \
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to remove the @ symbol here, not sure what it does but with it in place, I'd get an error saying logtostrerr is not in $PATH, removing that option would cause -v=0 not in path etc

@edude03
Copy link
Contributor

edude03 commented Jul 8, 2017

In the end I've yet to get it to work, hyperctl is unable to connect to the daemon, I'm still trying to figure that out

mkdir -p src/${goPackagePath}
cp -r ${src}/* src/${goPackagePath}
cp -r ${src}/.git src/${goPackagePath}
chmod -R +w *
Copy link
Contributor

Choose a reason for hiding this comment

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

./*

mv src/${goPackagePath}/vendor/github.com/* src/github.com/
rmdir src/${goPackagePath}/vendor/github.com
mv src/${goPackagePath}/vendor/* src/.
cd src/${goPackagePath}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't call cd outside a subshell.

'';

preFixup = ''
# remove references to go compiler, gcc and glibc
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we have a remove-references feature for this (should be easy to find). If it is not applicable, please elaborate in the code.


installPhase = ''
mkdir -p $out/bin
cp ./hyperd $out/bin
Copy link
Contributor

Choose a reason for hiding this comment

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

Use {} syntax to combine both lines into one.

Copy link
Contributor

@0xABAB 0xABAB left a comment

Choose a reason for hiding this comment

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

Going in the right direction, and I like that there are tests from the beginning.

@moretea
Copy link
Contributor Author

moretea commented Jul 10, 2017 via email

@edude03
Copy link
Contributor

edude03 commented Jul 11, 2017

@moretea I'm super excited to see the updated PR :D

@edude03
Copy link
Contributor

edude03 commented Aug 15, 2017

@moretea are you still cranking along on this?

@offlinehacker
Copy link
Contributor

Have you tried this with #25426

@bachp
Copy link
Member

bachp commented Sep 23, 2017

@moretea I have a nix derivation for runv and hyperstart that I'm trying to get workingas an alterantive docker runtime. I think especially hyperstart might be useful to provide a default kernel and initrd. If you are interested I will push my WIP branch next time I'm at my dev machine.

@moretea
Copy link
Contributor Author

moretea commented Sep 23, 2017 via email

@bachp
Copy link
Member

bachp commented Sep 23, 2017

@moretea The current WIP branch is here: https://github.com/bachp/nixpkgs/tree/docker-runv

@mmahut
Copy link
Member

mmahut commented Aug 1, 2019

Any update on this pull request?

@mmahut
Copy link
Member

mmahut commented Aug 19, 2019

Closing due to lack of activity, feel free to reopen this if needed.

@mmahut mmahut closed this Aug 19, 2019
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

8 participants