mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
fix(k8s): use resource name instead of alias for customResources
This commit is contained in:
parent
5e29229879
commit
db856b3b02
1 changed files with 18 additions and 13 deletions
|
|
@ -42,12 +42,6 @@ let
|
||||||
description = "Kubernetes defaults to apply to resources";
|
description = "Kubernetes defaults to apply to resources";
|
||||||
type = types.listOf (types.submodule ({config, ...}: {
|
type = types.listOf (types.submodule ({config, ...}: {
|
||||||
options = {
|
options = {
|
||||||
resource = mkOption {
|
|
||||||
description = "Resource to apply default to (all by default)";
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
group = mkOption {
|
||||||
description = "Group to apply default to (all by default)";
|
description = "Group to apply default to (all by default)";
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
|
@ -66,8 +60,14 @@ let
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resource = mkOption {
|
||||||
|
description = "Resource to apply default to (all by default)";
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
propagate = mkOption {
|
propagate = mkOption {
|
||||||
description = "Whether to propagate default";
|
description = "Whether to propagate defaults";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
@ -102,7 +102,7 @@ let
|
||||||
|
|
||||||
resource = mkOption {
|
resource = mkOption {
|
||||||
description = "Resource name";
|
description = "Resource name";
|
||||||
type = types.str;
|
type = types.nullOr types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
@ -146,20 +146,20 @@ let
|
||||||
metadata.name = mkOptionDefault name;
|
metadata.name = mkOptionDefault name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in if cr.alias != null then {
|
in if cr.resource != null then {
|
||||||
options.${cr.group}.${cr.version}.${cr.kind} = mkOption {
|
options.${cr.group}.${cr.version}.${cr.kind} = mkOption {
|
||||||
description = cr.description;
|
description = cr.description;
|
||||||
type = types.attrsOf (types.submodule module);
|
type = types.attrsOf (types.submodule module);
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
options.${cr.alias} = mkOption {
|
options.${cr.resource} = mkOption {
|
||||||
description = cr.description;
|
description = cr.description;
|
||||||
type = types.attrsOf (types.submodule module);
|
type = types.attrsOf (types.submodule module);
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.${cr.group}.${cr.version}.${cr.kind} = config.${cr.alias};
|
config.${cr.group}.${cr.version}.${cr.kind} = config.${cr.resource};
|
||||||
} else {
|
} else {
|
||||||
options.${cr.group}.${cr.version}.${cr.kind} = mkOption {
|
options.${cr.group}.${cr.version}.${cr.kind} = mkOption {
|
||||||
description = cr.description;
|
description = cr.description;
|
||||||
|
|
@ -299,7 +299,10 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
}] ++ (map (i: let
|
}] ++
|
||||||
|
|
||||||
|
# import of yaml files
|
||||||
|
(map (i: let
|
||||||
object = loadYAML i;
|
object = loadYAML i;
|
||||||
groupVersion = splitString "/" object.apiVersion;
|
groupVersion = splitString "/" object.apiVersion;
|
||||||
name = object.metadata.name;
|
name = object.metadata.name;
|
||||||
|
|
@ -320,8 +323,10 @@ in {
|
||||||
) cfg.api.${gvk.group}.${gvk.version}.${gvk.kind}
|
) cfg.api.${gvk.group}.${gvk.version}.${gvk.kind}
|
||||||
) cfg.api.resources))
|
) cfg.api.resources))
|
||||||
|
|
||||||
|
# aliased gvk resources
|
||||||
(flatten (map (gvk:
|
(flatten (map (gvk:
|
||||||
mapAttrsToList (name: resource:
|
if gvk.resource == null then []
|
||||||
|
else mapAttrsToList (name: resource:
|
||||||
moduleToAttrs resource
|
moduleToAttrs resource
|
||||||
) cfg.api.${gvk.resource}
|
) cfg.api.${gvk.resource}
|
||||||
) cfg.api.resources))
|
) cfg.api.resources))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue