2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.heapster;
|
|
|
|
in {
|
|
|
|
options.services.heapster = {
|
|
|
|
enable = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Whether to enable heapster monitoring";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
|
|
|
|
|
|
|
source = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Heapster metric source";
|
2020-04-24 23:36:52 +00:00
|
|
|
example = "kubernetes:https://kubernetes.default";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
sink = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Heapster metic sink";
|
2020-04-24 23:36:52 +00:00
|
|
|
example = "influxdb:http://localhost:8086";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOpts = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Heapster extra options";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = "";
|
|
|
|
type = types.separatedString " ";
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Package to use by heapster";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = pkgs.heapster;
|
2021-10-06 13:57:05 +00:00
|
|
|
defaultText = literalExpression "pkgs.heapster";
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.package;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.heapster = {
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
after = ["cadvisor.service" "kube-apiserver.service"];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${cfg.package}/bin/heapster --source=${cfg.source} --sink=${cfg.sink} ${cfg.extraOpts}";
|
|
|
|
User = "heapster";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.heapster = {
|
2021-09-22 15:38:15 +00:00
|
|
|
isSystemUser = true;
|
|
|
|
group = "heapster";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Heapster user";
|
|
|
|
};
|
2021-09-22 15:38:15 +00:00
|
|
|
users.groups.heapster = {};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|