feat: improve helm code

This commit is contained in:
Chris Kruining 2025-11-06 15:48:06 +01:00
parent 410396c215
commit 42c3e9224a
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
4 changed files with 249 additions and 20 deletions

View file

@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ lib, pkgs, self, ... }:
let
inherit (builtins) readFile;
inherit (lib) mkOption types;
@ -48,9 +48,9 @@ in
};
perInstance = { instanceName, settings, machine, roles, ... }: {
nixosModule = { config, pkgs, inputs, system, ... }:
nixosModule = { config, pkgs, system, ... }:
let
terraform = inputs.terranix.lib.terranixConfiguration {
terraform = self.inputs.terranix.lib.terranixConfiguration {
inherit pkgs system;
modules = [
@ -76,6 +76,16 @@ in
];
};
chart = name: set:
let
rename = map: set: lib.mapAttrs' (n: v: lib.nameValuePair (map.${n} or n) v) set;
updateWith = b: a: a // b;
in
self.inputs.nixhelm.chartsMetadata
|> lib.attrByPath (lib.splitString "/" name) {}
|> rename { chart = "name"; chartHash = "hash"; }
|> updateWith set;
valuesYamlKey = "amarth/service/zitadel-${instanceName}-values.yml";
in
{
@ -117,12 +127,7 @@ in
};
services.k3s.autoDeployCharts = {
postgres = {
name = "postgresql";
repo = "https://charts.bitnami.com/bitnami";
version = "12.10.0";
hash = "sha256-htb+iCfdIV2hNbDvxivQDC1MwF9EDuT2juDEsyrVTrs=";
postgres = chart "bitnami/postgresql" {
targetNamespace = "postgres-system";
createNamespace = true;
@ -140,12 +145,7 @@ in
};
};
zitadel = {
name = "zitadel";
repo = "https://charts.zitadel.com";
version = "9.12.3";
hash = "sha256-eSpqy2vK1tJp0Ci20R7+zGLfUDKPuKOz1iWyvawqEpc=";
zitadel = chart "zitadel/zitadel" {
targetNamespace = "zitadel-system";
createNamespace = true;

View file

@ -1,6 +1,6 @@
{ ... }:
{ self, lib, pkgs, ... }:
let
module = ./default.nix;
module = lib.modules.importApply ./default.nix { inherit self lib pkgs; };
in
{
clan.modules.zitadel = module;