2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.heapster;
|
|
|
|
in {
|
|
|
|
options.services.heapster = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "Heapster monitoring";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
source = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Heapster metric source";
|
2020-04-24 23:36:52 +00:00
|
|
|
example = "kubernetes:https://kubernetes.default";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
sink = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Heapster metic sink";
|
2020-04-24 23:36:52 +00:00
|
|
|
example = "influxdb:http://localhost:8086";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOpts = mkOption {
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Heapster extra options";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = "";
|
|
|
|
type = types.separatedString " ";
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "heapster" { };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|