feat(k8s): allow to specify custom defaults condition, add test

This commit is contained in:
Jaka Hudoklin 2019-02-27 12:06:18 +01:00
parent 8536b03151
commit bae2b8d3e6
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95
11 changed files with 79 additions and 18 deletions

View file

@ -126,6 +126,7 @@ in {
options.${cr.group}.${cr.version}.${cr.kind} = mkOption {
description = cr.description;
type = types.attrsOf (types.submodule ({name, ...}: {
imports = getDefaults cr.resource cr.group cr.version cr.kind;
options = {
apiVersion = mkOption {
description = "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources";
@ -149,11 +150,11 @@ in {
};
};
config = mkMerge ([{
config = {
apiVersion = mkOptionDefault "${cr.group}/${cr.version}";
kind = mkOptionDefault cr.kind;
metadata.name = mkOptionDefault name;
}] ++ (getDefaults cr.resource cr.group cr.version cr.kind));
};
}));
default = {};
};