Skip to content

Commit

Permalink
remove allowed space setting
Browse files Browse the repository at this point in the history
  • Loading branch information
klacabane committed Jan 18, 2022
1 parent c1b98ba commit 2e9110e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions api_docs/monitoring.json
Expand Up @@ -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,
Expand Down Expand Up @@ -195,4 +195,4 @@
"misc": [],
"objects": []
}
}
}
3 changes: 0 additions & 3 deletions docs/settings/monitoring-settings.asciidoc
Expand Up @@ -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]
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/monitoring/server/config.test.ts
Expand Up @@ -31,9 +31,6 @@ describe('config schema', () => {
"interval": "10s",
},
"cluster_alerts": Object {
"allowedSpaces": Array [
"default",
],
"email_notifications": Object {
"email_address": "",
"enabled": true,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/monitoring/server/config.ts
Expand Up @@ -58,7 +58,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 }),
Expand Down
11 changes: 0 additions & 11 deletions x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts
Expand Up @@ -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
Expand Down

0 comments on commit 2e9110e

Please sign in to comment.