mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-03 05:26:18 +01:00
762f781ac5
Signed-off-by: magic_rb <magic_rb@redalder.org>
114 lines
3 KiB
Nix
114 lines
3 KiB
Nix
{
|
|
inputs,
|
|
pkgs,
|
|
paths,
|
|
elib,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit
|
|
(lib)
|
|
mkMerge
|
|
filterAttrs
|
|
mapAttrs
|
|
recursiveUpdate
|
|
;
|
|
inherit
|
|
(inputs.uk3s-nix.lib)
|
|
sanitizeKubernetesManifest
|
|
yqManifestSanitizerFilter
|
|
;
|
|
inherit
|
|
(inputs.uk3s-nix.legacyPackages.${pkgs.stdenv.system})
|
|
kubernetesManifestsToTerraformModule
|
|
splitYamlDoc
|
|
helm2nix2terraform
|
|
;
|
|
in {
|
|
resource."kubernetes_namespace"."metallb-system" = {
|
|
metadata = {
|
|
name = "metallb-system";
|
|
};
|
|
};
|
|
|
|
resource."kubernetes_namespace"."istio-system" = {
|
|
metadata = {
|
|
name = "istio-system";
|
|
|
|
# has to be kept in sync with `main` profile
|
|
labels = {
|
|
"istio.io/rev" = "1-20-2";
|
|
};
|
|
};
|
|
};
|
|
|
|
module."gateway-api" = {
|
|
source = inputs.uk3s-nix.legacyPackages.${pkgs.stdenv.system}.kubernetesManifestsToTerraformModule {
|
|
name = "gateway-crds";
|
|
splitJson = inputs.uk3s-nix.legacyPackages.${pkgs.stdenv.system}.splitYamlDoc {
|
|
name = "gateway-crds-manifests";
|
|
yamlDocument = pkgs.fetchurl {
|
|
url = "https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/experimental-install.yaml";
|
|
hash = "sha256-EPMidEoAXU5z4rBn6V/s1M/sYZ3HVkkwtIjClr+jvsE=";
|
|
curlOptsList = ["-L"];
|
|
};
|
|
outputFormat = "json";
|
|
yqFilter = yqManifestSanitizerFilter;
|
|
};
|
|
};
|
|
};
|
|
|
|
module."istio-api" = {
|
|
source = kubernetesManifestsToTerraformModule {
|
|
name = "istio-crds";
|
|
extraAttrs = {
|
|
field_manager.force_conflicts = true;
|
|
};
|
|
splitJson = splitYamlDoc {
|
|
name = "istio-crds-manifests";
|
|
yamlDocument = pkgs.fetchurl {
|
|
url = "https://raw.githubusercontent.com/istio/api/${pkgs.istioctl.version}/kubernetes/customresourcedefinitions.gen.yaml";
|
|
hash = "sha256-cPMT2On0i0ltbePd8xiMpvoM5P/CZhgf8OlaeUcxgoo=";
|
|
};
|
|
outputFormat = "json";
|
|
yqFilter = yqManifestSanitizerFilter;
|
|
};
|
|
};
|
|
};
|
|
|
|
imports = [
|
|
(elib.terraformModule {
|
|
name = "kubernetes";
|
|
source = {config, ...}: {
|
|
imports = [
|
|
(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"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
})
|
|
];
|
|
}
|