2019-02-10 21:03:47 +01:00
|
|
|
{ lib, ... }:
|
|
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
k8s = {
|
2019-03-01 09:53:38 +01:00
|
|
|
mkSecretOption = {description ? "", default ? null}: mkOption {
|
2019-02-10 21:03:47 +01:00
|
|
|
inherit description;
|
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
|
options = {
|
|
|
|
|
name = mkOption {
|
|
|
|
|
description = "Name of the secret where secret is stored";
|
|
|
|
|
type = types.str;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
key = mkOption {
|
|
|
|
|
description = "Name of the key where secret is stored";
|
|
|
|
|
type = types.str;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-01 09:53:38 +01:00
|
|
|
config = mkDefault (if default == null then {} else default);
|
2019-02-10 21:03:47 +01:00
|
|
|
});
|
|
|
|
|
default = {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
secretToEnv = value: {
|
|
|
|
|
valueFrom.secretKeyRef = {
|
|
|
|
|
inherit (value) name key;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in {
|
|
|
|
|
_module.args.k8s = k8s;
|
|
|
|
|
}
|