mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
statix fix
This commit is contained in:
parent
890b84be5e
commit
6a720a257e
27 changed files with 86 additions and 99 deletions
|
|
@ -1,6 +1,4 @@
|
|||
{system ? builtins.currentSystem}: let
|
||||
in
|
||||
(
|
||||
{system ? builtins.currentSystem}: (
|
||||
(import ./compat.nix).flake-compat {
|
||||
src = ./.;
|
||||
inherit system;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
registry,
|
||||
}: let
|
||||
# evaluated configuration
|
||||
config =
|
||||
(evalModules {
|
||||
inherit ((evalModules {
|
||||
module = {kubenix, ...}: {
|
||||
imports = [
|
||||
kubenix.modules.testing
|
||||
|
|
@ -30,8 +29,7 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
})
|
||||
.config;
|
||||
})) config;
|
||||
in {
|
||||
inherit config;
|
||||
|
||||
|
|
@ -45,10 +43,10 @@ in {
|
|||
test-script = config.testing.testsByName.nginx-deployment.script;
|
||||
|
||||
# genreated kubernetes List object
|
||||
generated = config.kubernetes.generated;
|
||||
inherit (config.kubernetes) generated;
|
||||
|
||||
# JSON file you can deploy to kubernetes
|
||||
result = config.kubernetes.result;
|
||||
inherit (config.kubernetes) result;
|
||||
|
||||
# Exported docker images
|
||||
images = config.docker.export;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
inherit system;
|
||||
};
|
||||
|
||||
lib = pkgs.lib;
|
||||
inherit (pkgs) lib;
|
||||
|
||||
kubenix = {
|
||||
lib = import ./lib {inherit lib pkgs;};
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
checks = let
|
||||
wasSuccess = suite:
|
||||
if suite.success == true
|
||||
if suite.success
|
||||
then pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-succeeded" {} "echo success > $out"
|
||||
else pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-failed" {} "exit 1";
|
||||
mkExamples = attrs:
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ with lib; let
|
|||
refDefinition = attr: head (tail (tail (splitString "/" attr."$ref")));
|
||||
};
|
||||
|
||||
fixJSON = content: replaceStrings ["\\u"] ["u"] content;
|
||||
fixJSON = replaceStrings ["\\u"] ["u"];
|
||||
|
||||
fetchSpecs = path: builtins.fromJSON (fixJSON (builtins.readFile path));
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ with lib; let
|
|||
refType = attr: head (tail (tail (splitString "/" attr."$ref")));
|
||||
|
||||
compareVersions = ver1: ver2: let
|
||||
getVersion = v: substring 1 10 v;
|
||||
getVersion = substring 1 10;
|
||||
splitVersion = v: builtins.splitVersion (getVersion v);
|
||||
isAlpha = v: elem "alpha" (splitVersion v);
|
||||
patchVersion = v:
|
||||
|
|
@ -103,7 +103,7 @@ with lib; let
|
|||
in
|
||||
builtins.compareVersions v1 v2;
|
||||
|
||||
fixJSON = content: replaceStrings ["\\u"] ["u"] content;
|
||||
fixJSON = replaceStrings ["\\u"] ["u"];
|
||||
|
||||
fetchSpecs = path: builtins.fromJSON (fixJSON (builtins.readFile path));
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ with lib; let
|
|||
else group';
|
||||
version = version';
|
||||
kind = kind';
|
||||
description = swagger.definitions.${ref}.description;
|
||||
inherit (swagger.definitions.${ref}) description;
|
||||
defintion = refDefinition (head path.post.parameters).schema;
|
||||
})
|
||||
(filterAttrs
|
||||
|
|
@ -301,7 +301,7 @@ with lib; let
|
|||
resourceTypesByKind;
|
||||
|
||||
latestResourceTypesByKind =
|
||||
mapAttrs (_kind: resources: last resources) resourcesTypesByKindSortByVersion;
|
||||
mapAttrs (_kind: last) resourcesTypesByKindSortByVersion;
|
||||
|
||||
genResourceOptions = resource:
|
||||
with gen; let
|
||||
|
|
@ -313,7 +313,7 @@ with lib; let
|
|||
definition.version;
|
||||
in
|
||||
mkOption {
|
||||
description = resource.description;
|
||||
inherit (resource) description;
|
||||
type = types.attrsOf (submoduleForDefinition' resource);
|
||||
default = {};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
kubernetes-helm,
|
||||
cacert,
|
||||
}: let
|
||||
cleanName = name: lib.replaceStrings ["/"] ["-"] name;
|
||||
cleanName = lib.replaceStrings ["/"] ["-"];
|
||||
in
|
||||
{
|
||||
# name of the chart
|
||||
|
|
|
|||
|
|
@ -80,6 +80,6 @@ with lib; rec {
|
|||
// labels;
|
||||
};
|
||||
|
||||
toBase64 = lib.toBase64;
|
||||
octalToDecimal = lib.octalToDecimal;
|
||||
inherit (lib) toBase64;
|
||||
inherit (lib) octalToDecimal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ with lib; {
|
|||
|
||||
_m.propagate = mkOption {
|
||||
description = "Module propagation options";
|
||||
type = types.listOf (types.submodule ({ ...}: {
|
||||
type = types.listOf (types.submodule (_: {
|
||||
options = {
|
||||
features = mkOption {
|
||||
description = "List of features that submodule has to have to propagate module";
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ in {
|
|||
_m.propagate = [
|
||||
{
|
||||
features = ["docker"];
|
||||
module = {
|
||||
...
|
||||
}: {
|
||||
module = _: {
|
||||
# propagate registry options
|
||||
docker.registry = cfg.registry;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ with lib; let
|
|||
else let coerced = coerceFunc val; in assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||
|
|
@ -62,7 +62,7 @@ with lib; let
|
|||
values);
|
||||
|
||||
submoduleOf = ref:
|
||||
types.submodule ({ ...}: {
|
||||
types.submodule (_: {
|
||||
options = definitions."${ref}".options or {};
|
||||
config = definitions."${ref}".config or {};
|
||||
});
|
||||
|
|
@ -74,7 +74,7 @@ with lib; let
|
|||
then toInt name
|
||||
else name;
|
||||
in {
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config =
|
||||
definitions."${ref}".config
|
||||
// {
|
||||
|
|
@ -90,7 +90,7 @@ with lib; let
|
|||
in
|
||||
types.submodule ({name, ...}: {
|
||||
imports = getDefaults resource group version kind;
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config = mkMerge [
|
||||
definitions."${ref}".config
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ with lib; let
|
|||
else let coerced = coerceFunc val; in assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||
|
|
@ -62,7 +62,7 @@ with lib; let
|
|||
values);
|
||||
|
||||
submoduleOf = ref:
|
||||
types.submodule ({ ...}: {
|
||||
types.submodule (_: {
|
||||
options = definitions."${ref}".options or {};
|
||||
config = definitions."${ref}".config or {};
|
||||
});
|
||||
|
|
@ -74,7 +74,7 @@ with lib; let
|
|||
then toInt name
|
||||
else name;
|
||||
in {
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config =
|
||||
definitions."${ref}".config
|
||||
// {
|
||||
|
|
@ -90,7 +90,7 @@ with lib; let
|
|||
in
|
||||
types.submodule ({name, ...}: {
|
||||
imports = getDefaults resource group version kind;
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config = mkMerge [
|
||||
definitions."${ref}".config
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ with lib; let
|
|||
else let coerced = coerceFunc val; in assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||
|
|
@ -62,7 +62,7 @@ with lib; let
|
|||
values);
|
||||
|
||||
submoduleOf = ref:
|
||||
types.submodule ({ ...}: {
|
||||
types.submodule (_: {
|
||||
options = definitions."${ref}".options or {};
|
||||
config = definitions."${ref}".config or {};
|
||||
});
|
||||
|
|
@ -74,7 +74,7 @@ with lib; let
|
|||
then toInt name
|
||||
else name;
|
||||
in {
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config =
|
||||
definitions."${ref}".config
|
||||
// {
|
||||
|
|
@ -90,7 +90,7 @@ with lib; let
|
|||
in
|
||||
types.submodule ({name, ...}: {
|
||||
imports = getDefaults resource group version kind;
|
||||
options = definitions."${ref}".options;
|
||||
inherit (definitions."${ref}") options;
|
||||
config = mkMerge [
|
||||
definitions."${ref}".config
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ in {
|
|||
map
|
||||
(object: let
|
||||
apiVersion = parseApiVersion object.apiVersion;
|
||||
name = object.metadata.name;
|
||||
inherit (object.metadata) name;
|
||||
in {
|
||||
"${apiVersion.group}"."${apiVersion.version}".${object.kind}."${name}" = mkMerge ([
|
||||
object
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ with lib; let
|
|||
assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||
|
|
@ -41,9 +41,9 @@ with lib; let
|
|||
};
|
||||
|
||||
submoduleOf = ref:
|
||||
types.submodule ({ ...}: {
|
||||
options = definitions."${ref}".options;
|
||||
config = definitions."${ref}".config;
|
||||
types.submodule (_: {
|
||||
inherit (definitions."${ref}") options;
|
||||
inherit (definitions."${ref}") config;
|
||||
});
|
||||
|
||||
definitions =
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ with lib; let
|
|||
|
||||
moduleToAttrs = value:
|
||||
if isAttrs value
|
||||
then mapAttrs (_n: v: moduleToAttrs v) (filterAttrs (n: v: v != null && !(hasPrefix "_" n)) value)
|
||||
then mapAttrs (_n: moduleToAttrs) (filterAttrs (n: v: v != null && !(hasPrefix "_" n)) value)
|
||||
else if isList value
|
||||
then map (v: moduleToAttrs v) value
|
||||
then map moduleToAttrs value
|
||||
else value;
|
||||
|
||||
apiOptions = {config, ...}: {
|
||||
|
|
@ -38,7 +38,7 @@ with lib; let
|
|||
|
||||
defaults = mkOption {
|
||||
description = "Kubernetes defaults to apply to resources";
|
||||
type = types.listOf (types.submodule ({ ...}: {
|
||||
type = types.listOf (types.submodule (_: {
|
||||
options = {
|
||||
group = mkOption {
|
||||
description = "Group to apply default to (all by default)";
|
||||
|
|
@ -132,7 +132,7 @@ with lib; let
|
|||
lst));
|
||||
|
||||
compareVersions = ver1: ver2: let
|
||||
getVersion = v: substring 1 10 v;
|
||||
getVersion = substring 1 10;
|
||||
splittedVer1 = builtins.splitVersion (getVersion ver1);
|
||||
splittedVer2 = builtins.splitVersion (getVersion ver2);
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ with lib; let
|
|||
customResourceTypesByAttrName;
|
||||
|
||||
latestCustomResourceTypes =
|
||||
mapAttrsToList (_: resources: last resources) customResourceTypesByAttrNameSortByVersion;
|
||||
mapAttrsToList (_: last) customResourceTypesByAttrNameSortByVersion;
|
||||
|
||||
customResourceModuleForType = config: ct: {name, ...}: {
|
||||
imports = getDefaults ct.name ct.group ct.version ct.kind;
|
||||
|
|
@ -207,7 +207,7 @@ with lib; let
|
|||
module = customResourceModuleForType config ct;
|
||||
in {
|
||||
options.resources.${ct.group}.${ct.version}.${ct.kind} = mkOption {
|
||||
description = ct.description;
|
||||
inherit (ct) description;
|
||||
type = types.attrsOf (types.submodule module);
|
||||
default = {};
|
||||
};
|
||||
|
|
@ -222,7 +222,7 @@ with lib; let
|
|||
module = customResourceModuleForType config ct;
|
||||
in {
|
||||
options.resources.${ct.attrName} = mkOption {
|
||||
description = ct.description;
|
||||
inherit (ct) description;
|
||||
type = types.attrsOf (types.submodule module);
|
||||
default = {};
|
||||
};
|
||||
|
|
@ -255,8 +255,8 @@ with lib; let
|
|||
else let coerced = coerceFunc val; in assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||
|
|
@ -405,7 +405,7 @@ in {
|
|||
_m.propagate = [
|
||||
{
|
||||
features = ["k8s"];
|
||||
module = { ...}: {
|
||||
module = _: {
|
||||
# propagate kubernetes version and namespace
|
||||
kubernetes.version = mkDefault cfg.version;
|
||||
kubernetes.namespace = mkDefault cfg.namespace;
|
||||
|
|
@ -415,9 +415,7 @@ in {
|
|||
features = ["k8s" "submodule"];
|
||||
module = {config, ...}: {
|
||||
# set module defaults
|
||||
kubernetes.api.defaults = (
|
||||
# propagate defaults if default propagation is enabled
|
||||
(filter (default: default.propagate) cfg.api.defaults)
|
||||
kubernetes.api.defaults = (filter (default: default.propagate) cfg.api.defaults)
|
||||
++ [
|
||||
# set module name and version for all kuberentes resources
|
||||
{
|
||||
|
|
@ -426,8 +424,7 @@ in {
|
|||
"kubenix/module-version" = config.submodule.version;
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
|
@ -470,13 +467,13 @@ in {
|
|||
# load yaml file
|
||||
object = importYAML i;
|
||||
groupVersion = splitString "/" object.apiVersion;
|
||||
name = object.metadata.name;
|
||||
inherit (object.metadata) name;
|
||||
version = last groupVersion;
|
||||
group =
|
||||
if version == (head groupVersion)
|
||||
then "core"
|
||||
else head groupVersion;
|
||||
kind = object.kind;
|
||||
inherit (object) kind;
|
||||
in {
|
||||
resources.${group}.${version}.${kind}.${name} = object;
|
||||
})
|
||||
|
|
@ -485,7 +482,7 @@ in {
|
|||
kubernetes.objects = flatten (mapAttrsToList
|
||||
(
|
||||
_: type:
|
||||
mapAttrsToList (_name: resource: moduleToAttrs resource)
|
||||
mapAttrsToList (_name: moduleToAttrs)
|
||||
cfg.api.resources.${type.group}.${type.version}.${type.kind}
|
||||
)
|
||||
cfg.api.types);
|
||||
|
|
@ -500,6 +497,6 @@ in {
|
|||
pkgs.writeText "${config.kubenix.project}-generated.json" (builtins.toJSON cfg.generated);
|
||||
|
||||
kubernetes.resultYAML =
|
||||
toMultiDocumentYaml "${config.kubenix.project}-generated.yaml" (config.kubernetes.objects);
|
||||
toMultiDocumentYaml "${config.kubenix.project}-generated.yaml" config.kubernetes.objects;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ in {
|
|||
|
||||
submodules.defaults = mkOption {
|
||||
description = "List of defaults to apply to submodule instances";
|
||||
type = types.listOf (types.submodule ({ ...}: {
|
||||
type = types.listOf (types.submodule (_: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
description = "Name of the submodule to apply defaults for";
|
||||
|
|
@ -279,7 +279,7 @@ in {
|
|||
inherit (evaledSubmodule.config.submodule) name description version tags exports;
|
||||
};
|
||||
|
||||
features = evaledSubmodule.config._m.features;
|
||||
inherit (evaledSubmodule.config._m) features;
|
||||
};
|
||||
})
|
||||
)
|
||||
|
|
@ -299,7 +299,7 @@ in {
|
|||
# submodule associated with
|
||||
submodule = findSubmodule {
|
||||
name = config.submodule;
|
||||
version = config.version;
|
||||
inherit (config) version;
|
||||
};
|
||||
|
||||
# definition of a submodule
|
||||
|
|
@ -307,10 +307,10 @@ in {
|
|||
|
||||
# submodule defaults
|
||||
defaults = getDefaults {
|
||||
name = submoduleDefinition.name;
|
||||
version = submoduleDefinition.version;
|
||||
tags = submoduleDefinition.tags;
|
||||
features = submodule.features;
|
||||
inherit (submoduleDefinition) name;
|
||||
inherit (submoduleDefinition) version;
|
||||
inherit (submoduleDefinition) tags;
|
||||
inherit (submodule) features;
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
|
|
@ -390,7 +390,7 @@ in {
|
|||
|
||||
(map
|
||||
(propagate: {
|
||||
features = propagate.features;
|
||||
inherit (propagate) features;
|
||||
default = propagate.module;
|
||||
})
|
||||
config._m.propagate)
|
||||
|
|
@ -404,8 +404,8 @@ in {
|
|||
features = ["submodules"];
|
||||
default = {
|
||||
submodules = {
|
||||
defaults = cfg.defaults;
|
||||
imports = cfg.imports;
|
||||
inherit (cfg) defaults;
|
||||
inherit (cfg) imports;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ in {
|
|||
|
||||
common = mkOption {
|
||||
description = "List of common options to apply to tests";
|
||||
type = types.listOf (types.submodule ({ ...}: {
|
||||
type = types.listOf (types.submodule (_: {
|
||||
options = {
|
||||
features = mkOption {
|
||||
description = "List of features that test has to have to apply options";
|
||||
|
|
@ -70,7 +70,7 @@ in {
|
|||
inherit module;
|
||||
})
|
||||
(types.submodule testModule));
|
||||
apply = tests: filter isTestEnabled tests;
|
||||
apply = filter isTestEnabled;
|
||||
};
|
||||
|
||||
testsByName = mkOption {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}:
|
||||
with lib;
|
||||
with import ../../lib/docker {inherit lib pkgs;}; let
|
||||
testing = config.testing;
|
||||
inherit (config) testing;
|
||||
|
||||
allImages = unique (flatten (map (t: t.evaled.config.docker.export or []) testing.tests));
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ in {
|
|||
images = allImages;
|
||||
|
||||
copyScript = copyDockerImages {
|
||||
images = cfg.images;
|
||||
inherit (cfg) images;
|
||||
dest = "docker://" + cfg.registryUrl;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
testing = config.testing;
|
||||
inherit (config) testing;
|
||||
cfg = testing.driver.kubetest;
|
||||
|
||||
kubetest = import ./kubetestdrv.nix {inherit pkgs;};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
testing = config.testing;
|
||||
inherit (config) testing;
|
||||
|
||||
script = pkgs.writeScript "run-local-k8s-tests-${testing.name}.sh" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
testing = config.testing;
|
||||
inherit (config) testing;
|
||||
# kubeconfig = "/etc/${config.services.kubernetes.pki.etcClusterAdminKubeconfig}";
|
||||
kubeconfig = "/etc/kubernetes/cluster-admin.kubeconfig";
|
||||
kubecerts = "/var/lib/kubernetes/secrets";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
{system ? builtins.currentSystem}: let
|
||||
in
|
||||
(
|
||||
{system ? builtins.currentSystem}: (
|
||||
(import ./compat.nix).flake-compat {
|
||||
src = ./.;
|
||||
inherit system;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
doThrowError ? true, # whether any testing error should throw an error
|
||||
enabledTests ? null,
|
||||
}: let
|
||||
config =
|
||||
(evalModules {
|
||||
inherit ((evalModules {
|
||||
module = {
|
||||
kubenix,
|
||||
pkgs,
|
||||
|
|
@ -49,7 +48,6 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
})
|
||||
.config;
|
||||
})) config;
|
||||
in
|
||||
config.testing // {recurseForDerivations = true;}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
pod1 = config.kubernetes.api.resources.pods.pod1;
|
||||
pod2 = config.kubernetes.api.resources.pods.pod2;
|
||||
inherit (config.kubernetes.api.resources.pods) pod1;
|
||||
inherit (config.kubernetes.api.resources.pods) pod2;
|
||||
in {
|
||||
imports = with kubenix.modules; [test k8s];
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ with lib; let
|
|||
apiVersion = "v1";
|
||||
kind = "Pod";
|
||||
metadata = {
|
||||
namespace = config.kubernetes.namespace;
|
||||
inherit (config.kubernetes) namespace;
|
||||
name = "curl";
|
||||
};
|
||||
spec.containers = [
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
instance1 = config.submodules.instances.instance1;
|
||||
instance2 = config.submodules.instances.instance2;
|
||||
instance3 = config.submodules.instances.instance3;
|
||||
instance4 = config.submodules.instances.instance4;
|
||||
instance5 = config.submodules.instances.instance5;
|
||||
versioned-submodule = config.submodules.instances.versioned-submodule;
|
||||
inherit (config.submodules.instances) instance1;
|
||||
inherit (config.submodules.instances) instance2;
|
||||
inherit (config.submodules.instances) instance3;
|
||||
inherit (config.submodules.instances) instance4;
|
||||
inherit (config.submodules.instances) instance5;
|
||||
inherit (config.submodules.instances) versioned-submodule;
|
||||
|
||||
submodule = { ...}: {
|
||||
imports = [kubenix.modules.submodule];
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
}:
|
||||
with lib; let
|
||||
cfg = config.submodules.instances.instance;
|
||||
args = cfg.config.submodule.args;
|
||||
inherit (cfg.config.submodule) args;
|
||||
in {
|
||||
imports = with kubenix.modules; [test submodules];
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ in {
|
|||
}
|
||||
{
|
||||
message = "should have tag set";
|
||||
assertion = elem "tag" (cfg.config.submodule.tags);
|
||||
assertion = elem "tag" cfg.config.submodule.tags;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue