diff options
Diffstat (limited to 'nixpkgs/nixos/modules/services/cluster/k3s/default.nix')
-rw-r--r-- | nixpkgs/nixos/modules/services/cluster/k3s/default.nix | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/nixpkgs/nixos/modules/services/cluster/k3s/default.nix b/nixpkgs/nixos/modules/services/cluster/k3s/default.nix index 3a36cfa3f37b..a1f6d4ecdfad 100644 --- a/nixpkgs/nixos/modules/services/cluster/k3s/default.nix +++ b/nixpkgs/nixos/modules/services/cluster/k3s/default.nix @@ -3,8 +3,14 @@ with lib; let cfg = config.services.k3s; + removeOption = config: instruction: + lib.mkRemovedOptionModule ([ "services" "k3s" ] ++ config) instruction; in { + imports = [ + (removeOption [ "docker" ] "k3s docker option is no longer supported.") + ]; + # interface options.services.k3s = { enable = mkEnableOption "k3s"; @@ -13,11 +19,11 @@ in type = types.package; default = pkgs.k3s; defaultText = literalExpression "pkgs.k3s"; - description = "Package that should be used for k3s"; + description = lib.mdDoc "Package that should be used for k3s"; }; role = mkOption { - description = '' + description = lib.mdDoc '' Whether k3s should run as a server or agent. Note that the server, by default, also runs as an agent. ''; @@ -27,14 +33,14 @@ in serverAddr = mkOption { type = types.str; - description = "The k3s server to connect to. This option only makes sense for an agent."; + description = lib.mdDoc "The k3s server to connect to. This option only makes sense for an agent."; example = "https://10.0.0.10:6443"; default = ""; }; token = mkOption { type = types.str; - description = '' + description = lib.mdDoc '' The k3s token to use when connecting to the server. This option only makes sense for an agent. WARNING: This option will expose store your token unencrypted world-readable in the nix store. If this is undesired use the tokenFile option instead. @@ -44,18 +50,12 @@ in tokenFile = mkOption { type = types.nullOr types.path; - description = "File path containing k3s token to use when connecting to the server. This option only makes sense for an agent."; + description = lib.mdDoc "File path containing k3s token to use when connecting to the server. This option only makes sense for an agent."; default = null; }; - docker = mkOption { - type = types.bool; - default = false; - description = "Use docker to run containers rather than the built-in containerd."; - }; - extraFlags = mkOption { - description = "Extra flags to pass to the k3s command."; + description = lib.mdDoc "Extra flags to pass to the k3s command."; type = types.str; default = ""; example = "--no-deploy traefik --cluster-cidr 10.24.0.0/16"; @@ -64,13 +64,13 @@ in disableAgent = mkOption { type = types.bool; default = false; - description = "Only run the server. This option only makes sense for a server."; + description = lib.mdDoc "Only run the server. This option only makes sense for a server."; }; configPath = mkOption { type = types.nullOr types.path; default = null; - description = "File path containing the k3s YAML config. This is useful when the config is generated (for example on boot)."; + description = lib.mdDoc "File path containing the k3s YAML config. This is useful when the config is generated (for example on boot)."; }; }; @@ -88,14 +88,11 @@ in } ]; - virtualisation.docker = mkIf cfg.docker { - enable = mkDefault true; - }; environment.systemPackages = [ config.services.k3s.package ]; systemd.services.k3s = { description = "k3s service"; - after = [ "network.service" "firewall.service" ] ++ (optional cfg.docker "docker.service"); + after = [ "network.service" "firewall.service" ]; wants = [ "network.service" "firewall.service" ]; wantedBy = [ "multi-user.target" ]; path = optional config.boot.zfs.enabled config.boot.zfs.package; @@ -113,8 +110,7 @@ in ExecStart = concatStringsSep " \\\n " ( [ "${cfg.package}/bin/k3s ${cfg.role}" - ] ++ (optional cfg.docker "--docker") - ++ (optional (cfg.docker && config.systemd.enableUnifiedCgroupHierarchy) "--kubelet-arg=cgroup-driver=systemd") + ] ++ (optional cfg.disableAgent "--disable-agent") ++ (optional (cfg.serverAddr != "") "--server ${cfg.serverAddr}") ++ (optional (cfg.token != "") "--token ${cfg.token}") |