mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-13 08:30:05 +01:00
fmt
This commit is contained in:
parent
c3fa598922
commit
db6d83c61e
53 changed files with 1916 additions and 1599 deletions
|
|
@ -1,7 +1,6 @@
|
|||
{ name, config, lib, kubenix, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
instance1 = config.submodules.instances.instance1;
|
||||
instance2 = config.submodules.instances.instance2;
|
||||
|
|
@ -10,7 +9,7 @@ let
|
|||
instance5 = config.submodules.instances.instance5;
|
||||
versioned-submodule = config.submodules.instances.versioned-submodule;
|
||||
|
||||
submodule = {name, ...}: {
|
||||
submodule = { name, ... }: {
|
||||
imports = [ kubenix.modules.submodule ];
|
||||
|
||||
options.submodule.args = {
|
||||
|
|
@ -25,7 +24,8 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = with kubenix.modules; [ test submodules ];
|
||||
|
||||
test = {
|
||||
|
|
@ -34,95 +34,130 @@ in {
|
|||
assertions = [{
|
||||
message = "should apply defaults by tag1";
|
||||
assertion = instance1.config.submodule.args.value == "value1";
|
||||
} {
|
||||
message = "should apply defaults by tag2";
|
||||
assertion = instance2.config.submodule.args.value == "value2";
|
||||
} {
|
||||
message = "should apply defaults by tag2";
|
||||
assertion = instance3.config.submodule.args.value == "value2";
|
||||
} {
|
||||
message = "should apply defaults to all";
|
||||
assertion =
|
||||
instance1.config.submodule.args.defaultValue == "value" &&
|
||||
instance2.config.submodule.args.defaultValue == "value";
|
||||
} {
|
||||
message = "instance1 and instance3 should have value of default-value";
|
||||
assertion = instance3.config.submodule.args.defaultValue == "default-value";
|
||||
} {
|
||||
message = "should apply defaults by submodule name";
|
||||
assertion = instance4.config.submodule.args.value == "value4";
|
||||
} {
|
||||
message = "should apply defaults by custom condition";
|
||||
assertion = instance5.config.submodule.args.defaultValue == "my-custom-value";
|
||||
} {
|
||||
message = "should apply defaults to versioned submodule";
|
||||
assertion = versioned-submodule.config.submodule.args.defaultValue == "versioned-submodule";
|
||||
}];
|
||||
}
|
||||
{
|
||||
message = "should apply defaults by tag2";
|
||||
assertion = instance2.config.submodule.args.value == "value2";
|
||||
}
|
||||
{
|
||||
message = "should apply defaults by tag2";
|
||||
assertion = instance3.config.submodule.args.value == "value2";
|
||||
}
|
||||
{
|
||||
message = "should apply defaults to all";
|
||||
assertion =
|
||||
instance1.config.submodule.args.defaultValue == "value" &&
|
||||
instance2.config.submodule.args.defaultValue == "value";
|
||||
}
|
||||
{
|
||||
message = "instance1 and instance3 should have value of default-value";
|
||||
assertion = instance3.config.submodule.args.defaultValue == "default-value";
|
||||
}
|
||||
{
|
||||
message = "should apply defaults by submodule name";
|
||||
assertion = instance4.config.submodule.args.value == "value4";
|
||||
}
|
||||
{
|
||||
message = "should apply defaults by custom condition";
|
||||
assertion = instance5.config.submodule.args.defaultValue == "my-custom-value";
|
||||
}
|
||||
{
|
||||
message = "should apply defaults to versioned submodule";
|
||||
assertion = versioned-submodule.config.submodule.args.defaultValue == "versioned-submodule";
|
||||
}];
|
||||
};
|
||||
|
||||
submodules.imports = [{
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "submodule1";
|
||||
tags = ["tag1"];
|
||||
};
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "submodule1";
|
||||
tags = [ "tag1" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "submodule2";
|
||||
tags = [ "tag2" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "submodule3";
|
||||
tags = [ "tag2" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "submodule4";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "submodule5";
|
||||
};
|
||||
submodule.args.value = "custom-value";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
modules = [
|
||||
submodule
|
||||
{
|
||||
submodule = {
|
||||
name = "versioned-submodule";
|
||||
version = "2.0.0";
|
||||
};
|
||||
}
|
||||
];
|
||||
}];
|
||||
} {
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "submodule2";
|
||||
tags = ["tag2"];
|
||||
};
|
||||
}];
|
||||
} {
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "submodule3";
|
||||
tags = ["tag2"];
|
||||
};
|
||||
}];
|
||||
} {
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "submodule4";
|
||||
};
|
||||
}];
|
||||
} {
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "submodule5";
|
||||
};
|
||||
submodule.args.value = "custom-value";
|
||||
}];
|
||||
} {
|
||||
modules = [submodule {
|
||||
submodule = {
|
||||
name = "versioned-submodule";
|
||||
version = "2.0.0";
|
||||
};
|
||||
}];
|
||||
}];
|
||||
|
||||
submodules.defaults = [{
|
||||
default.submodule.args.defaultValue = mkDefault "value";
|
||||
} {
|
||||
tags = ["tag1"];
|
||||
default.submodule.args.value = mkDefault "value1";
|
||||
} {
|
||||
tags = ["tag2"];
|
||||
default.submodule.args.value = mkDefault "value2";
|
||||
} {
|
||||
name = "submodule4";
|
||||
default.submodule.args.value = mkDefault "value4";
|
||||
} {
|
||||
default = {config, ...}: {
|
||||
submodule.args.defaultValue = mkIf (config.submodule.args.value == "custom-value") "my-custom-value";
|
||||
};
|
||||
} {
|
||||
name = "versioned-submodule";
|
||||
version = "2.0.0";
|
||||
default.submodule.args.value = mkDefault "versioned";
|
||||
}];
|
||||
}
|
||||
{
|
||||
tags = [ "tag1" ];
|
||||
default.submodule.args.value = mkDefault "value1";
|
||||
}
|
||||
{
|
||||
tags = [ "tag2" ];
|
||||
default.submodule.args.value = mkDefault "value2";
|
||||
}
|
||||
{
|
||||
name = "submodule4";
|
||||
default.submodule.args.value = mkDefault "value4";
|
||||
}
|
||||
{
|
||||
default = { config, ... }: {
|
||||
submodule.args.defaultValue = mkIf (config.submodule.args.value == "custom-value") "my-custom-value";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "versioned-submodule";
|
||||
version = "2.0.0";
|
||||
default.submodule.args.value = mkDefault "versioned";
|
||||
}];
|
||||
|
||||
submodules.instances.instance1.submodule = "submodule1";
|
||||
submodules.instances.instance2.submodule = "submodule2";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue