diff --git a/docs/migration/migrate_7_0.asciidoc b/docs/migration/migrate_7_0.asciidoc index c51f85d4179de1..5ee81d54a69852 100644 --- a/docs/migration/migrate_7_0.asciidoc +++ b/docs/migration/migrate_7_0.asciidoc @@ -85,6 +85,34 @@ to Kibana's advanced setting. on each Elasticsearch node, Logstash node, Kibana instance, and Beat to collect and index metrics. Each node and instance is considered unique based on its persistent UUID, which is written to the path.data directory when the node or instance starts. +[float] +=== kibana.yml setting `xpack.monitoring.elasticsearch.url` is no longer valid +*Details:* This deprecated setting has been removed and `xpack.monitoring.elasticsearch.hosts` should be used instead. +In prior versions of Kibana, if no port was specified in `xpack.monitoring.elasticsearch.url` a default of 9200 was chosen. +The port in `xpack.monitoring.elasticsearch.hosts` is protocol dependent: https ports will use 443, and http ports will use 80. + +*Impact:* Users with `xpack.monitoring.elasticsearch.url` set should use `xpack.monitoring.elasticsearch.hosts` instead and if +`xpack.monitoring.elasticsearch.url` was dependent on an unspecified port set to 9200, `:9200` will have to be appended to the url. + +[float] +=== kibana.yml setting `xpack.monitoring.elasticsearch.ssl.cert` is no longer valid +*Details:* This deprecated setting has been removed and `xpack.monitoring.elasticsearch.ssl.certificate` should be used instead. + +*Impact:* Users with `xpack.monitoring.elasticsearch.ssl.cert` set should use `xpack.monitoring.elasticsearch.ssl.certificate` instead + +[float] +=== kibana.yml setting `xpack.monitoring.elasticsearch.ssl.ca` is no longer valid +*Details:* This deprecated setting has been removed and `xpack.monitoring.elasticsearch.ssl.certificateAuthorities` should be used instead. + +*Impact:* Users with `xpack.monitoring.elasticsearch.ssl.ca` set should use `xpack.monitoring.elasticsearch.ssl.certificateAuthorities` instead + +[float] +=== kibana.yml setting `xpack.monitoring.elasticsearch.ssl.verify` is no longer valid +*Details:* This deprecated setting has been removed and `xpack.monitoring.elasticsearch.ssl.verificationMode` should be used instead. + +*Impact:* Users with `xpack.monitoring.elasticsearch.ssl.verify` set should use `xpack.monitoring.elasticsearch.ssl.verificationMode` instead. +Previously set `xpack.monitoring.elasticsearch.ssl.verify` is equal to `xpack.monitoring.elasticsearch.ssl.verificationMode: full`. + [float] === Deprecated API `/shorten` has been removed *Details:* The `/shorten` API has been deprecated since 6.5, when it was replaced by the `/api/shorten_url` API. @@ -97,13 +125,6 @@ considered unique based on its persistent UUID, which is written to the path.dat *Impact:* The logging.useUTC flag will have to be replaced with a timezone id. If set to true the id is `UTC`. -[float] -=== kibana.yml setting `elasticsearch.url` sets port based on protocol -*Details:* In prior versions of Kibana, if no port was specified in `elasticsearch.url` a default of 9200 was chosen. -The port is now protocol dependent: https ports will use 443, and http ports will use 80. - -*Impact:* If your `elasticsearch.url` was dependent on an unspecified port set to 9200, `:9200` will have to be appended to the url. - [float] === kibana.yml setting `server.ssl.supportedProtocols` excludes TLSv1 by default *Details:* TLSv1 support has been removed by default, it's still possible to opt-in to TLSv1 support by explicitly setting @@ -129,3 +150,31 @@ It's now required that the user sets `server.ssl.enabled` to true for this to oc *Details:* This deprecated setting has been removed and `i18n.locale` should be used instead. *Impact:* Users with `i18n.defaultLocale` set should use `i18n.locale` instead + +[float] +=== kibana.yml setting `elasticsearch.url` is no longer valid +*Details:* This deprecated setting has been removed and `elasticsearch.hosts` should be used instead. +In prior versions of Kibana, if no port was specified in `elasticsearch.url` a default of 9200 was chosen. The port in +`elasticsearch.hosts` is protocol dependent: https ports will use 443, and http ports will use 80. + +*Impact:* Users with `elasticsearch.url` set should use `elasticsearch.hosts` instead and if `elasticsearch.url` was +dependent on an unspecified port set to 9200, `:9200` will have to be appended to the url. + +[float] +=== kibana.yml setting `elasticsearch.ssl.cert` is no longer valid +*Details:* This deprecated setting has been removed and `elasticsearch.ssl.certificate` should be used instead. + +*Impact:* Users with `elasticsearch.ssl.cert` set should use `elasticsearch.ssl.certificate` instead + +[float] +=== kibana.yml setting `elasticsearch.ssl.ca` is no longer valid +*Details:* This deprecated setting has been removed and `elasticsearch.ssl.certificateAuthorities` should be used instead. + +*Impact:* Users with `elasticsearch.ssl.ca` set should use `elasticsearch.ssl.certificateAuthorities` instead + +[float] +=== kibana.yml setting `elasticsearch.ssl.verify` is no longer valid +*Details:* This deprecated setting has been removed and `elasticsearch.ssl.verificationMode` should be used instead. + +*Impact:* Users with `elasticsearch.ssl.verify` set should use `elasticsearch.ssl.verificationMode` instead. +Previously set `elasticsearch.ssl.verify` is equal to `elasticsearch.ssl.verificationMode: full`. diff --git a/src/legacy/core_plugins/elasticsearch/__tests__/index.js b/src/legacy/core_plugins/elasticsearch/__tests__/index.js deleted file mode 100644 index 3ac93781834d20..00000000000000 --- a/src/legacy/core_plugins/elasticsearch/__tests__/index.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Deprecations } from '../../../../deprecation'; -import expect from 'expect.js'; -import index from '../index'; -import { noop, set } from 'lodash'; -import sinon from 'sinon'; - -describe('plugins/elasticsearch', function () { - describe('#deprecations()', function () { - let transformDeprecations; - - before(function () { - const Plugin = function (options) { - this.deprecations = options.deprecations; - }; - - const plugin = index({ Plugin }); - - const deprecations = plugin.deprecations(Deprecations); - transformDeprecations = (settings, log = noop) => { - deprecations.forEach(deprecation => deprecation(settings, log)); - }; - }); - - describe('ssl.verificationMode', function () { - let settings; - let sslSettings; - - beforeEach(function () { - settings = {}; - sslSettings = {}; - set(settings, 'ssl', sslSettings); - }); - - it(`sets verificationMode to none when verify is false`, function () { - sslSettings.verify = false; - - transformDeprecations(settings); - expect(sslSettings.verificationMode).to.be('none'); - expect(sslSettings.verify).to.be(undefined); - }); - - it('should log when deprecating verify from false', function () { - sslSettings.verify = false; - - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.calledOnce).to.be(true); - }); - - it('sets verificationMode to full when verify is true', function () { - sslSettings.verify = true; - - transformDeprecations(settings); - expect(sslSettings.verificationMode).to.be('full'); - expect(sslSettings.verify).to.be(undefined); - }); - - it('should log when deprecating verify from true', function () { - sslSettings.verify = true; - - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.calledOnce).to.be(true); - }); - - it(`shouldn't set verificationMode when verify isn't present`, function () { - transformDeprecations(settings); - expect(sslSettings.verificationMode).to.be(undefined); - }); - - it(`shouldn't log when verify isn't present`, function () { - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.called).to.be(false); - }); - }); - }); -}); diff --git a/src/legacy/core_plugins/elasticsearch/index.js b/src/legacy/core_plugins/elasticsearch/index.js index 8c1426a4560f4d..70583783e0cd89 100644 --- a/src/legacy/core_plugins/elasticsearch/index.js +++ b/src/legacy/core_plugins/elasticsearch/index.js @@ -17,9 +17,6 @@ * under the License. */ -import { compact, get, has, set } from 'lodash'; -import { unset } from '../../../utils'; - import healthCheck from './lib/health_check'; import { createDataCluster } from './lib/create_data_cluster'; import { createAdminCluster } from './lib/create_admin_cluster'; @@ -67,52 +64,6 @@ export default function (kibana) { }).default(); }, - deprecations({ rename }) { - const sslVerify = (basePath) => { - const getKey = (path) => { - return compact([basePath, path]).join('.'); - }; - - return (settings, log) => { - const sslSettings = get(settings, getKey('ssl')); - - if (!has(sslSettings, 'verify')) { - return; - } - - const verificationMode = get(sslSettings, 'verify') ? 'full' : 'none'; - set(sslSettings, 'verificationMode', verificationMode); - unset(sslSettings, 'verify'); - - log(`Config key "${getKey('ssl.verify')}" is deprecated. It has been replaced with "${getKey('ssl.verificationMode')}"`); - }; - }; - - const url = () => { - return (settings, log) => { - const deprecatedUrl = get(settings, 'url'); - const hosts = get(settings, 'hosts.length'); - if (!deprecatedUrl) { - return; - } - if (hosts) { - log('Deprecated config key "elasticsearch.url" conflicts with "elasticsearch.hosts". Ignoring "elasticsearch.url"'); - } else { - set(settings, 'hosts', [deprecatedUrl]); - log('Config key "elasticsearch.url" is deprecated. It has been replaced with "elasticsearch.hosts"'); - } - unset(settings, 'url'); - }; - }; - - return [ - rename('ssl.ca', 'ssl.certificateAuthorities'), - rename('ssl.cert', 'ssl.certificate'), - url(), - sslVerify(), - ]; - }, - uiExports: { injectDefaultVars(server, options) { return { diff --git a/x-pack/plugins/monitoring/__tests__/deprecations.js b/x-pack/plugins/monitoring/__tests__/deprecations.js index 6b8668b156a8f2..2bc46bbe997429 100644 --- a/x-pack/plugins/monitoring/__tests__/deprecations.js +++ b/x-pack/plugins/monitoring/__tests__/deprecations.js @@ -13,105 +13,12 @@ describe('monitoring plugin deprecations', function () { let transformDeprecations; before(function () { - const noopDeprecation = () => noop; - const deprecations = deprecationsModule({ rename: noopDeprecation }); + const deprecations = deprecationsModule(); transformDeprecations = (settings, log = noop) => { deprecations.forEach(deprecation => deprecation(settings, log)); }; }); - it('verificationMode is set to full when elasticsearch.ssl.verify is true', function () { - const settings = { - elasticsearch: { - ssl: { - verify: true - } - } - }; - - transformDeprecations(settings); - expect(settings.elasticsearch.ssl.verificationMode).to.eql('full'); - }); - - it(`sets verificationMode to none when verify is false`, function () { - const settings = { - elasticsearch: { - ssl: { - verify: false - } - } - }; - - transformDeprecations(settings); - expect(settings.elasticsearch.ssl.verificationMode).to.be('none'); - expect(settings.elasticsearch.ssl.verify).to.be(undefined); - }); - - it('should log when deprecating verify from false', function () { - const settings = { - elasticsearch: { - ssl: { - verify: false - } - } - }; - - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.calledOnce).to.be(true); - }); - - it('sets verificationMode to full when verify is true', function () { - const settings = { - elasticsearch: { - ssl: { - verify: true - } - } - }; - - transformDeprecations(settings); - expect(settings.elasticsearch.ssl.verificationMode).to.be('full'); - expect(settings.elasticsearch.ssl.verify).to.be(undefined); - }); - - it('should log when deprecating verify from true', function () { - const settings = { - elasticsearch: { - ssl: { - verify: true - } - } - }; - - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.calledOnce).to.be(true); - }); - - it(`shouldn't set verificationMode when verify isn't present`, function () { - const settings = { - elasticsearch: { - ssl: {} - } - }; - - transformDeprecations(settings); - expect(settings.elasticsearch.ssl.verificationMode).to.be(undefined); - }); - - it(`shouldn't log when verify isn't present`, function () { - const settings = { - elasticsearch: { - ssl: {} - } - }; - - const log = sinon.spy(); - transformDeprecations(settings, log); - expect(log.called).to.be(false); - }); - describe('cluster_alerts.email_notifications.email_address', function () { it(`shouldn't log when email notifications are disabled`, function () { const settings = { diff --git a/x-pack/plugins/monitoring/deprecations.js b/x-pack/plugins/monitoring/deprecations.js index ae418e141c8615..81d08d45963421 100644 --- a/x-pack/plugins/monitoring/deprecations.js +++ b/x-pack/plugins/monitoring/deprecations.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get, has, set, unset } from 'lodash'; +import { get, has } from 'lodash'; import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY } from './common/constants'; /** @@ -13,25 +13,10 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY } from './common/constants'; * * Important: Do not remove any deprecation warning until at least the next * major version! - * @param rename {Function} config rename function from Kibana * @return {Array} array of rename operations and callback function for rename logging */ -export const deprecations = ({ rename }) => { +export const deprecations = () => { return [ - rename('elasticsearch.ssl.ca', 'elasticsearch.ssl.certificateAuthorities'), - rename('elasticsearch.ssl.cert', 'elasticsearch.ssl.certificate'), - (settings, log) => { - if (!has(settings, 'elasticsearch.ssl.verify')) { - return; - } - - const verificationMode = get(settings, 'elasticsearch.ssl.verify') ? 'full' : 'none'; - set(settings, 'elasticsearch.ssl.verificationMode', verificationMode); - delete settings.elasticsearch.ssl.verify; - - log('Config key "xpack.monitoring.elasticsearch.ssl.verify" is deprecated. ' + - 'It has been replaced with "xpack.monitoring.elasticsearch.ssl.verificationMode"'); - }, (settings, log) => { if (has(settings, 'report_stats')) { log('Config key "xpack.monitoring.report_stats" is deprecated and will be removed in 7.0. ' + @@ -44,22 +29,6 @@ export const deprecations = ({ rename }) => { 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."`); } - }, - (settings, log) => { - const deprecatedUrl = get(settings, 'url'); - const hosts = get(settings, 'hosts.length'); - if (!deprecatedUrl) { - return; - } - if (hosts) { - log('Deprecated config key "xpack.monitoring.elasticsearch.url" ' + - 'conflicts with "xpack.monitoring.elasticsearch.hosts". Ignoring "elasticsearch.url"'); - } else { - set(settings, 'hosts', [deprecatedUrl]); - log('Config key "xpack.monitoring.elasticsearch.url" is deprecated.' + - 'It has been replaced with "xpack.monitoring.elasticsearch.hosts"'); - } - unset(settings, 'url'); } ]; };