fix tests, do not test k8s 1.8 to 1.10 anymore

This commit is contained in:
Jaka Hudoklin 2020-04-04 18:44:43 +07:00
parent 3534f5fc61
commit b2c91dfa4b
7 changed files with 35 additions and 112 deletions

View file

@ -3,7 +3,6 @@
with lib;
let
crd = config.kubernetes.api.resources.customResourceDefinitions.crontabs;
latestCrontab = config.kubernetes.api.resources.cronTabs.latest;
in {
imports = with kubenix.modules; [ test k8s ];
@ -13,11 +12,6 @@ in {
description = "Simple test tesing CRD";
enable = builtins.compareVersions config.kubernetes.version "1.8" >= 0;
assertions = [{
message = "CRD should have group and version set";
assertion =
crd.spec.group == "stable.example.com" &&
crd.spec.version == "v1";
} {
message = "Custom resource should have correct version set";
assertion = latestCrontab.apiVersion == "stable.example.com/v2";
}];
@ -31,72 +25,40 @@ in {
kubernetes.version = k8sVersion;
kubernetes.resources.customResourceDefinitions.crontabs = {
metadata.name = "crontabs.stable.example.com";
spec = {
kubernetes.customTypes = [
{
group = "stable.example.com";
version = "v1";
scope = "Namespaced";
names = {
plural = "crontabs";
singular = "crontab";
kind = "CronTab";
shortNames = ["ct"];
kind = "CronTab";
attrName = "cronTabs";
description = "CronTabs resources";
module = {
options.schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
};
};
};
kubernetes.resources.customResourceDefinitions.crontabsv2 = {
metadata.name = "crontabs.stable.example.com";
spec = {
} {
group = "stable.example.com";
version = "v2";
scope = "Namespaced";
names = {
plural = "crontabs";
singular = "crontab";
kind = "CronTab";
shortNames = ["ct"];
};
};
};
kubernetes.createCustomTypesFromCRDs = true;
kubernetes.customTypes = mkMerge [
{
"stable.example.com/v1/CronTab" = {
attrName = "cronTabs";
description = "CronTabs resources";
module = {
options.schedule = mkOption {
kind = "CronTab";
description = "CronTabs resources";
attrName = "cronTabs";
module = {
options = {
schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
command = mkOption {
description = "Command to run";
type = types.str;
};
};
};
}
{
"stable.example.com/v2/CronTab" = {
description = "CronTabs resources";
attrName = "cronTabs";
module = {
options = {
schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
command = mkOption {
description = "Command to run";
type = types.str;
};
};
};
};
}
[{
} {
group = "stable.example.com";
version = "v3";
kind = "CronTab";
@ -115,7 +77,7 @@ in {
};
};
};
}]
}
];
kubernetes.resources."stable.example.com"."v1".CronTab.versioned.spec.schedule = "* * * * *";