1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-14 11:37:37 +00:00

Learn recursive updates

Turns out `//` is more destructive than I thought. With it,
I was wiping `metadata` of everything but the `namespace` key.
This commit is contained in:
Antonio Gurgel 2023-11-18 19:01:30 -08:00
parent 8d355af50d
commit 9d888486c1
2 changed files with 10 additions and 8 deletions

View file

@ -1,6 +1,7 @@
{
charts,
kubelib,
pkgs,
vars,
}: rec {
mkMainImage = repository: tag: {
@ -58,11 +59,12 @@
inherit name namespace;
chart = charts.bjw-s.app-template;
values =
configVolume
// httpRoute
// extraValues
// {
controllers.main.containers.main.image = mainImage;
};
pkgs.lib.attrsets.recursiveUpdate
(configVolume
// httpRoute
// {
controllers.main.containers.main.image = mainImage;
})
extraValues;
};
}

View file

@ -5,7 +5,7 @@
}: let
vars = import ./vars.nix;
in
(import ./app-template.nix {inherit charts kubelib vars;})
(import ./app-template.nix {inherit charts kubelib pkgs vars;})
// (import ./builders.nix {inherit pkgs;})
// vars
// {
@ -41,5 +41,5 @@ in
# Non-namespaced objects can have `metadata.namespace` set, too;
# it's ignored upon their creation.
setNsOnObjects = namespace: input:
map (obj: obj // {metadata.namespace = namespace;}) input;
map (obj: pkgs.lib.attrsets.recursiveUpdate obj {metadata.namespace = namespace;}) input;
}