nixos/grafana: deprecate notifiers
This commit is contained in:
parent
0852dc859e
commit
34c2ea6750
3 changed files with 78 additions and 2 deletions
|
@ -250,7 +250,13 @@ let
|
|||
secure_settings = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
description = lib.mdDoc "Secure settings for the notifier type.";
|
||||
description = lib.mdDoc ''
|
||||
Secure settings for the notifier type. Please note that the contents of this option
|
||||
will end up in a world-readable Nix store. Use the file provider
|
||||
pointing at a reasonably secured file in the local filesystem
|
||||
to work around that. Look at the documentation for details:
|
||||
<https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#file-provider>
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -775,7 +781,7 @@ in {
|
|||
) "Datasource passwords will be stored as plaintext in the Nix store! Use file provider instead.")
|
||||
(optional (
|
||||
any (x: x.secure_settings != null) cfg.provision.notifiers
|
||||
) "Notifier secure settings will be stored as plaintext in the Nix store!")
|
||||
) "Notifier secure settings will be stored as plaintext in the Nix store! Use file provider instead.")
|
||||
(optional (
|
||||
builtins.isList cfg.provision.datasources
|
||||
) ''
|
||||
|
@ -790,6 +796,12 @@ in {
|
|||
Use `services.grafana.provision.dashboards.settings` or
|
||||
`services.grafana.provision.dashboards.path` instead.
|
||||
'')
|
||||
(optional (
|
||||
cfg.provision.notifiers != []
|
||||
) ''
|
||||
Notifiers are deprecated upstream and will be removed in Grafana 10.
|
||||
Use `services.grafana.provision.alerting.contactPoints` instead.
|
||||
'')
|
||||
];
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
basic = import ./basic.nix { inherit system pkgs; };
|
||||
provision-datasources = import ./provision-datasources { inherit system pkgs; };
|
||||
provision-dashboards = import ./provision-dashboards { inherit system pkgs; };
|
||||
provision-notifiers = import ./provision-notifiers.nix { inherit system pkgs; };
|
||||
}
|
||||
|
|
63
nixos/tests/grafana/provision-notifiers.nix
Normal file
63
nixos/tests/grafana/provision-notifiers.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
args@{ pkgs, ... }:
|
||||
|
||||
(import ../make-test-python.nix ({ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkMerge nameValuePair maintainers;
|
||||
|
||||
baseGrafanaConf = {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
addr = "localhost";
|
||||
analytics.reporting.enable = false;
|
||||
domain = "localhost";
|
||||
security = {
|
||||
adminUser = "testadmin";
|
||||
adminPassword = "snakeoilpwd";
|
||||
};
|
||||
provision.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraNodeConfs = {
|
||||
provisionNotifiers = {
|
||||
services.grafana.provision = {
|
||||
notifiers = [{
|
||||
uid = "test_notifiers";
|
||||
name = "Test Notifiers";
|
||||
type = "email";
|
||||
settings = {
|
||||
singleEmail = true;
|
||||
addresses = "test@test.com";
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodes = builtins.listToAttrs (map (provisionType:
|
||||
nameValuePair provisionType (mkMerge [
|
||||
baseGrafanaConf
|
||||
(extraNodeConfs.${provisionType} or {})
|
||||
])) [ "provisionNotifiers" ]);
|
||||
|
||||
in {
|
||||
name = "grafana-provision-notifiers";
|
||||
|
||||
meta = with maintainers; {
|
||||
maintainers = [ kfears willibutz ];
|
||||
};
|
||||
|
||||
inherit nodes;
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
with subtest("Successful notifiers provision with Nix"):
|
||||
provisionNotifiers.wait_for_unit("grafana.service")
|
||||
provisionNotifiers.wait_for_open_port(3000)
|
||||
provisionNotifiers.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/alert-notifications/uid/test_notifiers | grep Test\ Notifiers"
|
||||
)
|
||||
provisionNotifiers.shutdown()
|
||||
'';
|
||||
})) args
|
Loading…
Reference in a new issue