Skip to content

Change config flags, add flags to disable Alertmanager notifications methods: email & webhoook #2187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Mar 4, 2020

Conversation

Wing924
Copy link
Contributor

@Wing924 Wing924 commented Feb 26, 2020

What this PR does:

Added flags to disable Alertmanager notifications methods.

  • [CHANGE] Renamed Configs configuration options.
    • configuration options
      • -database.* -> -configs.database.*
      • -database.migrations -> -configs.database.migrations-dir
    • config file
      • configdb.uri: -> configs.database.uri:
      • configdb.migrationsdir: -> configs.database.migrations_dir:
      • configdb.passwordfile: -> configs.database.password_file:

Which issue(s) this PR fixes:

The Alertmanager notifications via email is disabled in cortex.
I tested on my cluster and found email works without any problems.

I asked on Slack and found the reason is email may attack SaaS.
I other words, we can enable email on on-premises.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Wing924 <[email protected]>
Signed-off-by: Wing924 <[email protected]>
@bboreham
Copy link
Contributor

So many flags seems like overkill to me.
I could see an argument to disable (anything with an email address) and (anything with a URL); I don't really see the case to selectively disable Wechat over OpsGenie.

@Wing924
Copy link
Contributor Author

Wing924 commented Feb 26, 2020

you’re right. we don’t need so many flags.
what flags should we keep?

@@ -108,6 +108,10 @@ Where default_value is the value to use if the environment variable is undefined
# The ruler_config configures the Cortex ruler.
[ruler: <ruler_config>]

# The configs_api_config configures the configs API used by the 'configs'
# service to expose APIs to manage them.
[configs_api: <configs_api_config>]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the configuration perspective, I'm a bit concerned having another root block config. Ideally we should have 1 root config block for each service (even if in the past some weird things have been done), so think it would be better adding the NotificationsConfig as part of the ConfigDB config.

@Wing924
Copy link
Contributor Author

Wing924 commented Feb 27, 2020

@bboreham
I reduced the options to only email and webhook.

@pracucci
Thank you for your advice.
I changed the configurations structure.

@Wing924 Wing924 requested a review from pracucci February 27, 2020 07:06
Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor nit around the error message.

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job! I love your contributions: clean and concise ❤️

I left few minor comments, then will LGTM. Thanks!

Wing924 added 4 commits March 2, 2020 11:42
Signed-off-by: Wing924 <[email protected]>
Signed-off-by: Wing924 <[email protected]>
Signed-off-by: Wing924 <[email protected]>
@Wing924
Copy link
Contributor Author

Wing924 commented Mar 2, 2020

@pracucci
I fixed it as you described.
I renamed configs.Config to userconfig.Config due to circular dependency.
Please check it again.

@Wing924 Wing924 requested review from pracucci and gouthamve March 2, 2020 04:17
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Wing924 for addressing my feedback! I just left minor comments, but LGTM. I would like to get @jtlisi on this review, cause he's more familiar with this stuff.

Wing924 added 3 commits March 2, 2020 18:50
Signed-off-by: Wing924 <[email protected]>
Signed-off-by: Wing924 <[email protected]>
Signed-off-by: Wing924 <[email protected]>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Wing924 for addressing my comment! I left few comments and then it will be good to go to me! Thanks 🙏

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a nit!

Signed-off-by: Wing924 <[email protected]>
@bboreham
Copy link
Contributor

bboreham commented Mar 3, 2020

Please edit the PR title and description to cover all that it now changes.

@Wing924 Wing924 changed the title Added flags to disable Alertmanager notifications methods. Added flags to disable Alertmanager notifications methods: email & webhoook Mar 3, 2020
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Mar 3, 2020
@bboreham bboreham changed the title Added flags to disable Alertmanager notifications methods: email & webhoook Change config flags, add flags to disable Alertmanager notifications methods: email & webhoook Mar 4, 2020
@gouthamve gouthamve merged commit f0d8d6a into cortexproject:master Mar 4, 2020
@Wing924 Wing924 deleted the opt-in-alert-email branch March 4, 2020 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants