dotfiles/terranix/prepare/kubernetes.nix

64 lines
1.5 KiB
Nix
Raw Normal View History

{
inputs,
pkgs,
paths,
elib,
lib,
...
}: let
inherit
(lib)
mkMerge
filterAttrs
mapAttrs
recursiveUpdate
;
in {
resource."kubernetes_namespace"."metallb-system" = {
metadata = {
name = "metallb-system";
};
};
resource."kubernetes_namespace"."istio-system" = {
metadata = {
name = "istio-system";
};
};
imports = [
(elib.terraformModule {
name = "kubernetes";
source = {config, ...}: {
imports = [
(inputs.uk3s-nix.legacyPackages.${pkgs.stdenv.system}.helm2nix2terraform {
path = "${paths.root}/terranix/prepare/kubernetes";
predicate = chart: name: manifest:
manifest.kind == "CustomResourceDefinition";
mapper = resource:
if resource.manifest.kind == "CustomResourceDefinition"
then
(resource
// {
manifest =
resource.manifest
// {
metadata = filterAttrs (n: _: n != "creationTimestamp") resource.manifest.metadata;
};
})
else resource;
})
];
resource."kubernetes_manifest" = {
"default_CustomResourceDefinition_bgppeers_metallb_io" = {
computed_fields = [
"spec.conversion.webhook.clientConfig.caBundle"
];
};
};
};
})
];
}