mirror of
https://git.sr.ht/~goorzhel/turboprop
synced 2024-12-15 17:50:52 +00:00
dc3060aa30
It doesn't pay to be strict about release module arity.
47 lines
1.4 KiB
Nix
47 lines
1.4 KiB
Nix
{
|
|
charts,
|
|
kubelib,
|
|
pkgs,
|
|
}: rec {
|
|
app-template = import ./app-template.nix {inherit builders charts pkgs;};
|
|
builders = import ./builders.nix {inherit kubelib pkgs;};
|
|
fetchers = import ./fetchers.nix {inherit kubelib pkgs;};
|
|
resources = import ./resources.nix;
|
|
eureka = import ./eureka {inherit app-template pkgs;};
|
|
|
|
parseYAMLFile = p: kubelib.fromYAML (builtins.readFile p);
|
|
|
|
# Helm cannot see my cluster from within the sandbox, so it cannot
|
|
# infer capabilities from it. Therefore, API versions must be gathered
|
|
# from charts that provide them.
|
|
# Doc: https://helm.sh/docs/chart_template_guide/builtin_objects/
|
|
gatherApis = yamlPath: let
|
|
data = parseYAMLFile yamlPath;
|
|
crds = let
|
|
input =
|
|
# This was a dagger partly of my own making:
|
|
# https://github.com/farcaller/nix-kube-generators/pull/5
|
|
if builtins.typeOf data == "list"
|
|
then data
|
|
else [data];
|
|
in
|
|
builtins.filter (obj: obj.kind == "CustomResourceDefinition") input;
|
|
in
|
|
pkgs.lib.lists.flatten
|
|
(map
|
|
(
|
|
crd:
|
|
map
|
|
(
|
|
crdVersion: let
|
|
group = crd.spec.group;
|
|
version = crdVersion.name;
|
|
kind = crd.spec.names.kind;
|
|
in "${group}/${version}/${kind}"
|
|
)
|
|
(builtins.filter
|
|
(crdVersion: (! crdVersion ? "deprecated") || crdVersion.deprecated != true)
|
|
crd.spec.versions)
|
|
)
|
|
crds);
|
|
}
|