feat(k8s): allow to define customTypes from CRDs

This commit is contained in:
Jaka Hudoklin 2019-10-20 13:36:10 +02:00
parent baea3cc3b3
commit 086780088c
No known key found for this signature in database
GPG key ID: D1F18234B07BD6E2
4 changed files with 144 additions and 59 deletions

View file

@ -61,39 +61,64 @@ in {
};
};
kubernetes.customTypes = [{
name = "crontabs";
group = "stable.example.com";
version = "v1";
kind = "CronTab";
description = "CronTabs resources";
module = {
options.schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
};
} {
name = "crontabs";
group = "stable.example.com";
version = "v2";
kind = "CronTab";
description = "CronTabs resources";
module = {
options = {
schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
kubernetes.createCustomTypesFromCRDs = true;
command = mkOption {
description = "Command to run";
type = types.str;
kubernetes.customTypes = mkMerge [
{
"stable.example.com/v1/CronTab" = {
attrName = "cronTabs";
description = "CronTabs resources";
module = {
options.schedule = mkOption {
description = "Crontab schedule script";
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";
description = "CronTabs resources";
attrName = "cronTabsV3";
module = {
options = {
schedule = mkOption {
description = "Crontab schedule script";
type = types.str;
};
command = mkOption {
description = "Command to run";
type = types.str;
};
};
};
}]
];
kubernetes.resources."stable.example.com"."v1".CronTab.versioned.spec.schedule = "* * * * *";
kubernetes.resources.crontabs.latest.spec.schedule = "* * * * *";
kubernetes.resources.cronTabs.latest.spec.schedule = "* * * * *";
kubernetes.resources.cronTabsV3.latest.spec.schedule = "* * * * *";
}