alertmanager/notify
Eric R. Rath efc956c7f7
SMTP config: add global and local password file fields (#3038)
* SMTP config: add global and local password file fields

Add config fields (for both global email config and route-specific email
config) that specify path to file containing SMTP password.  We don't
want the password in the config file itself, and reading the password
from a k8s-secret-backed file keeps the password itself "encrypted at
rest" in etcd, and cleanly separated from the rest of the AM config.

I used the same approach as pull request #2534 "Add support to set the
Slack URL in the file"
<https://github.com/prometheus/alertmanager/pull/2534/files> in the
upstream repo.

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* changed *AuthPasswordFile field types to string per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added error to getPassword() retval per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* simplified conf.smtp-* files

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* update docs to reflect field type change

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* don't treat username-without-password as invalid

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* test cleanup

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* Apply suggestions from code review

Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>

* Updated per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added sub-test per review feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* added test on Email.getPassword() per feedback

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* only inherit global SMTP passwords if neither local password field is set

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

* removed blank line caught by gofumpt

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>

Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-09-16 14:36:57 +02:00
..
email SMTP config: add global and local password file fields (#3038) 2022-09-16 14:36:57 +02:00
opsgenie Remove ioutil 2022-07-18 22:01:02 +09:00
pagerduty Update golangci-lint and fix complaints (#2853) 2022-03-25 17:59:51 +01:00
pushover Update golangci-lint and fix complaints (#2853) 2022-03-25 17:59:51 +01:00
slack Trim contents of slack api urls from files (#2929) 2022-09-09 16:37:31 +02:00
sns Update golangci-lint and fix complaints (#2853) 2022-03-25 17:59:51 +01:00
telegram notify/telegram: Fix test 2022-07-05 13:12:07 +02:00
test Update golangci-lint and fix complaints (#2853) 2022-03-25 17:59:51 +01:00
victorops Update golangci-lint and fix complaints (#2853) 2022-03-25 17:59:51 +01:00
webhook Enable HTTP 2 again (#2720) 2021-11-10 17:28:47 +01:00
wechat Remove ioutil 2022-07-18 22:01:02 +09:00
notify.go Sort receiver stage constructions by pipeline order 2022-04-29 23:59:31 +02:00
notify_test.go Marker: Rename `SetSilenced` to `SetActiveOrSilenced` 2022-06-17 12:51:23 +01:00
util.go replace 3 dots with ellipsis (#3072) 2022-09-12 17:28:10 +02:00
util_test.go replace 3 dots with ellipsis (#3072) 2022-09-12 17:28:10 +02:00