mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Stack monitoring] remove support for monitoring.cluster_alerts.allowedSpaces (#123229)
* remove allowed space setting * set allowedSpaces as unused setting * mock unused function in deprecation tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
95f2967c24
commit
24f0425284
7 changed files with 7 additions and 21 deletions
|
@ -149,7 +149,7 @@
|
|||
"signature": [
|
||||
"{ ui: { elasticsearch: ",
|
||||
"MonitoringElasticsearchConfig",
|
||||
"; enabled: boolean; container: Readonly<{} & { logstash: Readonly<{} & { enabled: boolean; }>; apm: Readonly<{} & { enabled: boolean; }>; elasticsearch: Readonly<{} & { enabled: boolean; }>; }>; logs: Readonly<{} & { index: string; }>; metricbeat: Readonly<{} & { index: string; }>; debug_mode: boolean; debug_log_path: string; ccs: Readonly<{} & { enabled: boolean; }>; max_bucket_size: number; min_interval_seconds: number; show_license_expiration: boolean; }; tests: Readonly<{} & { cloud_detector: Readonly<{} & { enabled: boolean; }>; }>; kibana: Readonly<{} & { collection: Readonly<{} & { interval: number; enabled: boolean; }>; }>; agent: Readonly<{} & { interval: string; }>; licensing: Readonly<{} & { api_polling_frequency: moment.Duration; }>; cluster_alerts: Readonly<{} & { enabled: boolean; allowedSpaces: string[]; email_notifications: Readonly<{} & { enabled: boolean; email_address: string; }>; }>; }"
|
||||
"; enabled: boolean; container: Readonly<{} & { logstash: Readonly<{} & { enabled: boolean; }>; apm: Readonly<{} & { enabled: boolean; }>; elasticsearch: Readonly<{} & { enabled: boolean; }>; }>; logs: Readonly<{} & { index: string; }>; metricbeat: Readonly<{} & { index: string; }>; debug_mode: boolean; debug_log_path: string; ccs: Readonly<{} & { enabled: boolean; }>; max_bucket_size: number; min_interval_seconds: number; show_license_expiration: boolean; }; tests: Readonly<{} & { cloud_detector: Readonly<{} & { enabled: boolean; }>; }>; kibana: Readonly<{} & { collection: Readonly<{} & { interval: number; enabled: boolean; }>; }>; agent: Readonly<{} & { interval: string; }>; licensing: Readonly<{} & { api_polling_frequency: moment.Duration; }>; cluster_alerts: Readonly<{} & { enabled: boolean; email_notifications: Readonly<{} & { enabled: boolean; email_address: string; }>; }>; }"
|
||||
],
|
||||
"path": "x-pack/plugins/monitoring/server/config.ts",
|
||||
"deprecated": false,
|
||||
|
@ -195,4 +195,4 @@
|
|||
"misc": [],
|
||||
"objects": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,9 +72,6 @@ For more information, see
|
|||
| `monitoring.ui.elasticsearch.ssl`
|
||||
| Shares the same configuration as <<elasticsearch-ssl-cert-key, `elasticsearch.ssl`>>. These settings configure encrypted communication between {kib} and the monitoring cluster.
|
||||
|
||||
| `monitoring.cluster_alerts.allowedSpaces` {ess-icon}
|
||||
| Specifies the spaces where cluster Stack Monitoring alerts can be created. You must specify all spaces where you want to generate alerts, including the default space. Defaults to `[ "default" ]`.
|
||||
|
||||
|===
|
||||
|
||||
[float]
|
||||
|
|
|
@ -31,9 +31,6 @@ describe('config schema', () => {
|
|||
"interval": "10s",
|
||||
},
|
||||
"cluster_alerts": Object {
|
||||
"allowedSpaces": Array [
|
||||
"default",
|
||||
],
|
||||
"email_notifications": Object {
|
||||
"email_address": "",
|
||||
"enabled": true,
|
||||
|
|
|
@ -55,7 +55,6 @@ export const configSchema = schema.object({
|
|||
}),
|
||||
}),
|
||||
cluster_alerts: schema.object({
|
||||
allowedSpaces: schema.arrayOf(schema.string(), { defaultValue: ['default'] }),
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
email_notifications: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
|
|
|
@ -13,10 +13,11 @@ describe('monitoring plugin deprecations', function () {
|
|||
const deprecate = jest.fn(() => jest.fn());
|
||||
const rename = jest.fn(() => jest.fn());
|
||||
const renameFromRoot = jest.fn(() => jest.fn());
|
||||
const unused = jest.fn(() => jest.fn());
|
||||
const fromPath = 'monitoring';
|
||||
|
||||
beforeAll(function () {
|
||||
const deprecations = deprecationsModule({ deprecate, rename, renameFromRoot });
|
||||
const deprecations = deprecationsModule({ deprecate, rename, renameFromRoot, unused });
|
||||
transformDeprecations = (settings, fromPath, addDeprecation = noop) => {
|
||||
deprecations.forEach((deprecation) => deprecation(settings, fromPath, addDeprecation));
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY } from '../common/constants';
|
|||
export const deprecations = ({
|
||||
rename,
|
||||
renameFromRoot,
|
||||
unused,
|
||||
}: ConfigDeprecationFactory): ConfigDeprecation[] => {
|
||||
return [
|
||||
// This order matters. The "blanket rename" needs to happen at the end
|
||||
|
@ -76,6 +77,8 @@ export const deprecations = ({
|
|||
level: 'warning',
|
||||
}),
|
||||
|
||||
unused('cluster_alerts.allowedSpaces', { level: 'warning' }),
|
||||
|
||||
// TODO: Add deprecations for "monitoring.ui.elasticsearch.username: elastic" and "monitoring.ui.elasticsearch.username: kibana".
|
||||
// TODO: Add deprecations for using "monitoring.ui.elasticsearch.ssl.certificate" without "monitoring.ui.elasticsearch.ssl.key", and
|
||||
// vice versa.
|
||||
|
|
|
@ -24,17 +24,6 @@ export function enableAlertsRoute(server: LegacyServer, npRoute: RouteDependenci
|
|||
},
|
||||
async (context, request, response) => {
|
||||
try {
|
||||
// Check to ensure the space is listed in monitoring.cluster_alerts.allowedSpaces
|
||||
const config = server.config();
|
||||
const allowedSpaces =
|
||||
config.get('monitoring.cluster_alerts.allowedSpaces') || ([] as string[]);
|
||||
if (!allowedSpaces.includes(context.infra.spaceId)) {
|
||||
server.log.info(
|
||||
`Skipping alert creation for "${context.infra.spaceId}" space; add space ID to 'monitoring.cluster_alerts.allowedSpaces' in your kibana.yml`
|
||||
);
|
||||
return response.ok({ body: undefined });
|
||||
}
|
||||
|
||||
const alerts = AlertsFactory.getAll();
|
||||
if (alerts.length) {
|
||||
const { isSufficientlySecure, hasPermanentEncryptionKey } = npRoute.alerting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue