From aa7bf3ad3b0085503ac11106560bbc355fae40ff Mon Sep 17 00:00:00 2001 From: lillecarl Date: Tue, 20 Jan 2026 06:34:56 +0000 Subject: [PATCH] helm: remove overrideNamespace which is dumb asf --- helm.nix | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/helm.nix b/helm.nix index 215e0d7..9357480 100644 --- a/helm.nix +++ b/helm.nix @@ -20,6 +20,9 @@ in type = types.attrsOf ( types.submodule ( { config, name, ... }: + let + releaseConfig = config; + in { options = { name = mkOption { @@ -47,7 +50,7 @@ in default = globalConfig.kubernetes.package.version; }; overrides = mkOption { - description = "Overrides to apply to all chart resources, don't do namespace here"; + description = "Overrides to apply to all chart objects, don't do namespace here"; type = types.listOf settingsFormat.type; example = [ { @@ -56,12 +59,6 @@ in ]; default = [ ]; }; - # Do we really need this here? Doesn't Helm take care of this? - overrideNamespace = lib.mkOption { - description = "Override namespace for all namespaced resources"; - type = types.nullOr types.str; - default = null; - }; convertLists = mkOption { description = '' Converts lists where all entires have a name attribute into @@ -116,7 +113,7 @@ in let list = importJSON ( pkgs.chart2json.override { kubernetes-helm = cfg.package; } { - inherit (config) + inherit (releaseConfig) chart name namespace @@ -129,23 +126,12 @@ in } ); in - if config.overrideNamespace != null then - lib.map ( - resource: - let - namespaced = - if lib.hasAttr resource.kind globalConfig.kubernetes.namespacedMappings then - globalConfig.kubernetes.namespacedMappings.${resource.kind} - else - throw "kind ${resource.kind} doesn't have a namespacedMapping"; - in - if namespaced then - lib.recursiveUpdate resource { metadata.namespace = config.overrideNamespace; } - else - resource - ) list - else - list; + list + ++ lib.optional (releaseConfig.namespace != null) { + apiVersion = "v1"; + kind = "Namespace"; + metadata.name = releaseConfig.namespace; + }; } ) );