1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-14 11:37:37 +00:00
turboprop/templates/default/namespaces.nix
Antonio Gurgel 27b06c5798 Implement lib.gatherNamespaces
The documentation for pkgs.lib.lists.unique warned me that the function
is O(n^2). So I conducted some rather unscientific tests using my own
Kubernetes flake and found no noticeable time penalty:
`rm result && nix-collect-garbage -d && nix build` always took
between 37 and 40 seconds, with or without gatherNamespaces.
But, well, n=10.

Also, make more obvious the flaw in mk.namespaces.
If I prefix something with "N.B." it shouldn't be hidden in the code.
2023-12-07 00:03:08 -08:00

32 lines
732 B
Nix

# Assign extra metadata here. For example,
# `default = {labels."istio.io/rev" = "stable";}`
# is the equivalent of
# `k label ns/default istio.io/rev=stable`
# N.B.: namespaces set in extraMetadata but not present
# in `namespaces` aren't created.
rec {
# All-caps names are safe to use for special values;
# no Kubernetes object can have capital letters.
DEFAULT = {
labels = {
"istio.io/rev" = "stable";
};
};
# Opt a namespace out of the defaults.
gateway-system = {};
kube-system = {};
longhorn-system = {};
# To set data beyond the defaults,
# opt the namespace back in.
default =
DEFAULT
// {
labels = {
"words-words-words-words" = "punchline";
};
};
}