Refactor module options and support rootless k3s & nix-snapshotter#115
Merged
Refactor module options and support rootless k3s & nix-snapshotter#115
Conversation
4a65ff1 to
d91481f
Compare
- Bumps version to 0.2.0
- Separate `nix run .#vm` and `nix run .#vm-rootless`
- Add integration tests for k3s, k3s-external, k3s-rootless
- Separate preload-container service into independent modules
- Pin k3s to v1.27.9+k3s1 with patches to enable embedded nix-snapshotter
- Add k8sResources flake perSystem output and plumb into specialArgs
- Services `preload-containerd` & `preload-containerd.rootless`:
```nix
config.services.preload-containerd = {
enable = true;
targets = [{
archives = [ pkgs.nix-snapshotter.buildImage { /* ... */ } ];
namespace = "k8s.io";
address = "/run/k3s/containerd/containerd.sock";
}];
};
```
- New options for `k3s` & new service `k3s.rootless`:
```nix
config.services.k3s = {
enable = true;
# Sets the snapshotter for embedded containerd.
snapshotter = "nix";
# Sets KUBECONFIG env var to point to k3s.
setKubeConfig = true;
# Sets CONTAINERD_* env vars to point to k3s embedded containerd.
setEmbeddedContainerd = true;
}
```
- New options for `containerd` & `containerd.rootless`:
```nix
config.virtualisation.containerd = {
enable = true;
# Enable integration with nix-snapshotter.
nixSnapshotterIntegration = true;
# Set the CONTAINERD_* env vars, but also set automatically by
# `nixSnapshotterIntegration` or by `services.k3s.setEmbeddedContainerd`.
setAddress = "/run/containerd/containerd.sock";
setNamespace = "default";
setSnapshotter = "nix";
}
```
- New option only for NixOS module `containerd`:
```nix
config.virtualisation.containerd = {
enable = true;
# Enable integration with k3s. This is mutually exclusive with setting
# `services.k3s.snapshotter` and `services.k3s.setEmbeddedContainerd`.
k3sIntegration = true;
};
```
- Removed `options.services.nix-snapshotter.setContainerdSnapshotter`
```nix
# v0.1.x
services.nix-snapshotter = {
enable = true;
setContainerdSnapshotter = true;
};
# v0.2.0 (same for rootless)
virtualisation.containerd = {
enable = true;
nixSnapshotterIntegration = true;
};
services.nix-snapshotter = {
enable = true;
};
```
- Removed `options.services.nix-snapshotter.preloadContainerdImages`
```nix
# v0.1.x
services.nix-snapshotter = {
enable = true;
preloadContainerdImages = [ pkgs.nix-snapshotter.buildImage { /* ... */ } ];
};
# v0.2.0 (same for rootless)
virtualisation.containerd = {
enable = true;
nixSnapshotterIntegration = true;
}
services.nix-snapshotter = {
enable = true;
};
services.preload-containerd = {
targets = [{
archives = [ pkgs.nix-snapshotter.buildImage { /* ... */ } ];
}];
};
```
d91481f to
4f34190
Compare
RobbieBuxton
approved these changes
Feb 16, 2024
Collaborator
RobbieBuxton
left a comment
There was a problem hiding this comment.
I had a read through and as far as I can tell, it all looks fine. I will admit most of the Kubernetes section went over my head as I'm not very familiar with it so apologies if I've missed anything. Otherwise, awesome work and it looks like it will be a great addition! 🎉🎉🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #83
Highlights
nix run .#vmandnix run .#vm-rootlessv1.27.9+k3s1with patches to enable embedded nix-snapshotterk8sResourcesflakeperSystemoutput and plumb intospecialArgsNew options
Services
preload-containerd&preload-containerd.rootless:New options for
k3s& new servicek3s.rootless:New options for
containerd&containerd.rootless:New option only for NixOS module
containerd:Migration guide v0.1.x -> v0.2.0
Removed
options.services.nix-snapshotter.setContainerdSnapshotterRemoved
options.services.nix-snapshotter.preloadContainerdImages