mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
Refactor:
- Support for module features - Remove kubenix.module and rather use explicit modules - Make tests framework independent of k8s module - Remove metacontroller submodule, which will go to kubenix-modules - Improved submodule propagation and passthru - Added additional test for k8s-submodule
This commit is contained in:
parent
b670139906
commit
6183fcc190
30 changed files with 513 additions and 508 deletions
|
|
@ -3,61 +3,77 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
globalConfig = config;
|
||||
cfg = config.docker;
|
||||
in {
|
||||
options.docker.registry.url = mkOption {
|
||||
description = "Default registry url where images are published";
|
||||
type = types.str;
|
||||
default = "";
|
||||
options.docker = {
|
||||
registry.url = mkOption {
|
||||
description = "Default registry url where images are published";
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
images = mkOption {
|
||||
description = "Attribute set of docker images that should be published";
|
||||
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
image = mkOption {
|
||||
description = "Docker image to publish";
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
description = "Desired docker image name";
|
||||
type = types.str;
|
||||
default = builtins.unsafeDiscardStringContext config.image.imageName;
|
||||
};
|
||||
|
||||
tag = mkOption {
|
||||
description = "Desired docker image tag";
|
||||
type = types.str;
|
||||
default = builtins.unsafeDiscardStringContext config.image.imageTag;
|
||||
};
|
||||
|
||||
registry = mkOption {
|
||||
description = "Docker registry url where image is published";
|
||||
type = types.str;
|
||||
default = cfg.registry.url;
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
description = "Full docker image path";
|
||||
type = types.str;
|
||||
default =
|
||||
if config.registry != ""
|
||||
then "${config.registry}/${config.name}:${config.tag}"
|
||||
else "${config.name}:${config.tag}";
|
||||
};
|
||||
};
|
||||
}));
|
||||
default = {};
|
||||
};
|
||||
|
||||
export = mkOption {
|
||||
description = "List of images to export";
|
||||
type = types.listOf (types.package);
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
options.docker.images = mkOption {
|
||||
description = "Attribute set of docker images that should be published";
|
||||
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
image = mkOption {
|
||||
description = "Docker image to publish";
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
};
|
||||
config = {
|
||||
_module.features = ["docker"];
|
||||
|
||||
name = mkOption {
|
||||
description = "Desired docker image name";
|
||||
type = types.str;
|
||||
default = builtins.unsafeDiscardStringContext config.image.imageName;
|
||||
};
|
||||
docker.export = mkMerge [
|
||||
(mapAttrsToList (_: i: i.image)
|
||||
(filterAttrs (_: i: i.registry != null) config.docker.images))
|
||||
|
||||
tag = mkOption {
|
||||
description = "Desired docker image tag";
|
||||
type = types.str;
|
||||
default = builtins.unsafeDiscardStringContext config.image.imageTag;
|
||||
};
|
||||
|
||||
registry = mkOption {
|
||||
description = "Docker registry url where image is published";
|
||||
type = types.str;
|
||||
default = globalConfig.docker.registry.url;
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
description = "Full docker image path";
|
||||
type = types.str;
|
||||
default =
|
||||
if config.registry != ""
|
||||
then "${config.registry}/${config.name}:${config.tag}"
|
||||
else "${config.name}:${config.tag}";
|
||||
};
|
||||
};
|
||||
}));
|
||||
default = {};
|
||||
# passthru of docker exported images if passthru is enabled on submodule
|
||||
# and submodule has docker module loaded
|
||||
(flatten (mapAttrsToList (_: submodule:
|
||||
optionals
|
||||
(submodule.passthru.enable && (elem "docker" submodule.config._module.features))
|
||||
submodule.config.docker.export
|
||||
) config.submodules.instances))
|
||||
];
|
||||
};
|
||||
|
||||
options.docker.export = mkOption {
|
||||
description = "List of images to export";
|
||||
type = types.listOf (types.package);
|
||||
default = [];
|
||||
};
|
||||
|
||||
config.docker.export = mapAttrsToList (_: i: i.image)
|
||||
(filterAttrs (_: i: i.registry != null)config.docker.images);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue