Better error reporting when no apiMappings can be found

This commit is contained in:
Carl Andersson 2025-11-12 21:53:45 +01:00
commit 36e3e4b72f

View file

@ -131,7 +131,14 @@ in
# so any user-defined values for these fields will take precedence.
lib.recursiveUpdate (
{
apiVersion = cfg.apiMappings.${kind};
apiVersion =
if lib.hasAttr kind cfg.apiMappings then
cfg.apiMappings.${kind}
else
builtins.throw ''
Resource kind: ${kind} name: ${name} has no apiMappings
${builtins.toJSON resourceAttrs}
'';
kind = kind;
metadata.name = name;
}