-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Deprecate xpack:defaultAdminEmail for monitoring alerts #22195
Deprecate xpack:defaultAdminEmail for monitoring alerts #22195
Conversation
💚 Build Succeeded |
|
||
let loggedDeprecationWarning = false; | ||
|
||
export function resetDeprecationWarning() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only exists to enable test cases to reset the module state. I realize how ugly this is, but I was weighing the tradeoff of this vs a larger, more complex solution. I chose this because it is a short-lived feature that we will remove with 7.0
💚 Build Succeeded |
@tsullivan @pickypg |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export const CLUSTER_ALERTS_ADDRESS_CONFIG_KEY = 'cluster_alerts.email_notifications.email_address'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to put this in x-pack/plugins/monitoring/common/constants.js
💚 Build Succeeded |
@@ -49,7 +49,8 @@ export const config = (Joi) => { | |||
enabled: boolean().default(true), | |||
index: string().default('.monitoring-alerts-6'), | |||
email_notifications: object({ | |||
enabled: boolean().default(true) | |||
enabled: boolean().default(true), | |||
email_address: string().email(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to keep a similar name as the setting getting deprecated. Maybe default_admin_email
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered default_admin_email
, but to me, that implies that the email address can be overridden somewhere else. If I understand it correctly, Monitoring doesn't allow the email address to be changed for cluster alerts.
The xpack:defaultAdminEmail
advanced setting makes sense as a default option when creating new watcher jobs through the UI, because it really is the default setting, which the user can change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xpack:defaultAdminEmail advanced setting makes sense as a default option when creating new watcher jobs through the UI, because it really is the default setting, which the user can change.
Interesting, I didn't realize Watcher UI uses this setting!
I'm OK with how you had it.
I still need to look through in more depth, but one thing I want to test is that https://github.com/elastic/kibana/pull/22220/files isn't affected. I think this will need to get the master branch merged in |
💚 Build Succeeded |
// DEPRECATED (Remove below in 7.0): If an email address is not configured in kibana.yml, then fallback to xpack:defaultAdminEmail | ||
if (!loggedDeprecationWarning) { | ||
const message = ( | ||
`Monitoring is using ${XPACK_DEFAULT_ADMIN_EMAIL_UI_SETTING} for cluster alert notifications,` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need a space at end end of this line's string, so notifications, which
has a space between
const clusterAlertsEnabled = get(settings, 'cluster_alerts.enabled'); | ||
const emailNotificationsEnabled = clusterAlertsEnabled && get(settings, 'cluster_alerts.email_notifications.enabled'); | ||
if (emailNotificationsEnabled && !get(settings, CLUSTER_ALERTS_ADDRESS_CONFIG_KEY)) { | ||
log(`Config key "${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}" will be required for email notifications to work in 7.0."`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running this PR branch and trying to get this log to show up, but I'm not seeing it. I see undefined
for clusterAlertsEnabled
, emailNotificationsEnabled
. I have a trial license and cluster alerts are enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discovered while putting this PR together that the depreciation system only passes through the settings that are explicitly defined in your kibana.yml
. Settings that are defaulted via the plugin schema are not provided.
To say another way, you'll see this warning if and only if you define the following in your kibana.yml
:
xpack.monitoring.cluster_alerts.enabled: true
xpack.monitoring.cluster_alerts.email_notifications.enabled: true
This is what led me to implement the other deprecation warning, so that it would be more obvious/helpful to ordinary installations that don't redefine default configuration settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comma thing should be fixed. It looks like the deprecation log does too, but that might be an external issue
💔 Build Failed |
Seemingly unrelated viz test failure. |
💚 Build Succeeded |
@tsullivan do you have any other feedback for this PR? If not, are you available to give it a LGTM? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
💚 Build Succeeded |
This PR introduces a new
kibana.yml
setting to allow users to set the email address used to receive cluster alert notifications:xpack.monitoring.cluster_alerts.email_notifications.email_address
If this is not set, then a deprecation warning will be logged warning that it will be required for Kibana 7.0. For the remainder of 6.x, Kibana will fallback to using the
xpack:defaultAdminEmail
setting from the advanced settings. When Spaces is enabled, then the setting will be retrieved from the Default Space's advanced settings.Fixes #22146
"Release note: The
xpack:defaultAdminEmail
UI Setting is deprecated for Monitoring, but is still fully supported for the Watcher UI. Users who wish to receive cluster alert notification emails should configurexpack.monitoring.cluster_alerts.email_notifications.email_address
inkibana.yml
instead."