From 5a03aa5a453e737b2dbc098781040e30d30c23f3 Mon Sep 17 00:00:00 2001 From: Tristan Gosselin-Hane Date: Fri, 30 Aug 2024 22:12:40 -0400 Subject: [PATCH] nixos/kubernetes: add extraConfig to kubelet config Every now and then, kubernetes adds new configuration parameters to the kubelet configuration. Since this is defined using a nix attrset which is then converted to json/yaml, it would be nice to have an escape hatch similar to the extraOpts one that exists for additional CLI arguments. The typical use case would be to configure new settings before they are officially supported in the nixos module. --- nixos/doc/manual/release-notes/rl-2411.section.md | 2 ++ nixos/modules/services/cluster/kubernetes/kubelet.nix | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 02b34eed060c..18608379e122 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -397,6 +397,8 @@ - Kanidm previously had an incorrect systemd service type, causing dependent units with an `after` and `requires` directive to start before `kanidm*` finished startup. The module has now been updated in line with upstream recommendations. +- The kubelet configuration file can now be amended with arbitrary additional content using the `services.kubernetes.kubelet.extraConfig` option. + - To facilitate dependency injection, the `imgui` package now builds a static archive using vcpkg' CMake rules. The derivation now installs "impl" headers selectively instead of by a wildcard. Use `imgui.src` if you just want to access the unpacked sources. diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix index fd9df556e7ec..a8b1e0d0d46a 100644 --- a/nixos/modules/services/cluster/kubernetes/kubelet.nix +++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix @@ -66,6 +66,7 @@ let // lib.optionalAttrs (cfg.clusterDomain != "") { clusterDomain = cfg.clusterDomain; } // lib.optionalAttrs (cfg.clusterDns != "") { clusterDNS = [ cfg.clusterDns ] ; } // lib.optionalAttrs (cfg.featureGates != {}) { featureGates = cfg.featureGates; } + // lib.optionalAttrs (cfg.extraConfig != {}) cfg.extraConfig )); manifestPath = "kubernetes/manifests"; @@ -184,6 +185,12 @@ in type = separatedString " "; }; + extraConfig = mkOption { + description = "Kubernetes kubelet extra configuration file entries."; + default = {}; + type = attrsOf attrs; + }; + featureGates = mkOption { description = "Attribute set of feature gate"; default = top.featureGates;