kubeListsToAttrs: skip CustomResourceDefinition objects
This commit is contained in:
parent
e235daa3f6
commit
eb2a380f7b
4 changed files with 13 additions and 3 deletions
2
helm.nix
2
helm.nix
|
|
@ -107,7 +107,7 @@ in
|
|||
config = {
|
||||
# list to attrset convertion is just a preconfigured override
|
||||
overrides = lib.optional releaseConfig.convertLists (
|
||||
lib.mkBefore (object: (lib.walkWithPath lib.kubeListsToAttrs) object)
|
||||
lib.mkBefore (object: (lib.walkWithPath (lib.kubeListsToAttrs object)) object)
|
||||
);
|
||||
|
||||
objects =
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ let
|
|||
config = {
|
||||
# list to attrset convertion is just a preconfigured override
|
||||
overrides = lib.optional yamlConfig.convertLists (
|
||||
lib.mkBefore (object: (lib.walkWithPath lib.kubeListsToAttrs) object)
|
||||
lib.mkBefore (object: (lib.walkWithPath (lib.kubeListsToAttrs object)) object)
|
||||
);
|
||||
|
||||
objects =
|
||||
|
|
|
|||
|
|
@ -87,8 +87,18 @@ self: lib: {
|
|||
|
||||
# Master transformer: Converts all standard JSON lists into special attribute sets
|
||||
# to make them easily overridable in Nix.
|
||||
# Takes the root object first to allow skipping entire objects (e.g., CRDs).
|
||||
kubeListsToAttrs =
|
||||
object:
|
||||
let
|
||||
# Never transform CustomResourceDefinition objects. Their spec contains OpenAPI schemas
|
||||
# with deeply nested structures that must not be converted to named/numbered lists.
|
||||
isCRD = lib.isAttrs object && (object.kind or null) == "CustomResourceDefinition";
|
||||
in
|
||||
path: value:
|
||||
if isCRD then
|
||||
value
|
||||
else
|
||||
let
|
||||
currentKey = lib.last (path ++ [ null ]);
|
||||
# Heuristic to identify a list that should become a `_namedlist`.
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ in
|
|||
rec {
|
||||
ainputVersion = input;
|
||||
blistVersion = (lib.walkWithPath lib.kubeAttrsToLists) ainputVersion;
|
||||
cattrVersion = (lib.walkWithPath lib.kubeListsToAttrs) blistVersion;
|
||||
cattrVersion = (lib.walkWithPath (lib.kubeListsToAttrs blistVersion)) blistVersion;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue