-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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 support for RFC108 imperative containers #216025
base: master
Are you sure you want to change the base?
Conversation
0e8789b
to
e1dcff3
Compare
78ea1aa
to
47db8b8
Compare
47db8b8
to
331f943
Compare
331f943
to
0402074
Compare
103994b
to
f8be66a
Compare
f8be66a
to
73a4581
Compare
48be000
to
6d9f996
Compare
6d9f996
to
053e903
Compare
053e903
to
65d7cad
Compare
9ab1e9a
to
4a920bd
Compare
0b574d1
to
a9bf933
Compare
cc @dasJ who is probably the most qualified person for a review of the code here. I think the first commit is a mixture of my and your code. Would be appreciated if you could add a |
0548904
to
ee4f850
Compare
I'll do that for sure next time I push! I actually didn't know about the feature. I will also attribute a chunk of commits on python-nixos-nspawn to yourself too, as I've moved a lot of code to that repo. |
This is a refactor of the necessary changes for RFC108 to reduce the delta with current master and conform it to code changes made to switch-to-configuration.pl since the project started. I'll try to summarise the changes: - Camel case to snake case - Try to conform compare_nspawn_units to match the style and logic of compare_units for long term maintainability. - Remove fingerprintNspawnUnits and use comp_array over deepCmp. By using parse_unit instead of parseNspawn, override confs will be factored in to the data loading and comparison so I don't see a need to do the fingerprinting. - Remove use of smartmatch in favour of hash map membership, see L331/%section_cmp as an example of this being done elsewhere. - @systemd@ -> $new_systemd Overall, I hope this makes the RFC108 component changes to the script easier to maintain in nixpkgs. This also contains work from squashed commits: - Query active nspawn instance names via DBus The original implementation is pretty hacky and doesn't work correctly if the name of one running instance is the prefix of the name another instance (e.g. `foo` and `foobar`). Using `ListMachines` from machined's DBus API instead to get some structure data seems more reasonable here. This is also the way how `machienctl list` retrieves running machines.
Within systemd nspawn, even less default filesystems are required than what is currently assumed in filesystem.nix. This PR wraps more mounts in conditional toggles to respect this.
This allows imperative container management to create unit files in /etc/systemd/nspawn
When running logrotate in a user namespaced environment, such as an nspawn container with PrivateUsers=pick, logrotate may refuse to start as its config file is not owned by root. Using environment.etc we can copy the file from the store and set the proper permissions during activation.
ee4f850
to
d5c8ec9
Compare
Description of changes
This is a fork of #140669 in a minified and refactored form covering the changes which cannot be placed in a separate flake.
I have been working on python-nixos-nspawn which implements all the components for managing imperative RFC108 style containers. I have been able to refactor almost all parts of the original POC to work within this repo/flake however I could not find a satisfactory way to otherwise apply the changes covered in this PR.
With this, it would be possible to use python-nixos-nspawn as a tool (and hopefully as a module soon) to manage RFC108 containers on any system with networkd enabled + configured appropriately.
TODO
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)CC @Ma27