Skip to content

Commit

Permalink
[7.x] Explicitly set level for core deprecations (#115501)
Browse files Browse the repository at this point in the history
* Explicitly set `level` for core deprecations

* Set for internal deprecations

* fix unit tests
  • Loading branch information
pgayvallet authored Oct 19, 2021
1 parent bd42367 commit 4317d06
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 42 deletions.
93 changes: 58 additions & 35 deletions src/core/server/config/deprecation/core_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const kibanaPathConf: ConfigDeprecation = (settings, fromPath, addDeprecation) =
if (process.env?.KIBANA_PATH_CONF) {
addDeprecation({
configPath: 'env.KIBANA_PATH_CONF',
level: 'critical',
message: `Environment variable "KIBANA_PATH_CONF" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
correctiveActions: {
manualSteps: [
Expand All @@ -27,6 +28,7 @@ const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDepreca
if (process.env?.CONFIG_PATH) {
addDeprecation({
configPath: 'env.CONFIG_PATH',
level: 'critical',
message: `Environment variable "CONFIG_PATH" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
correctiveActions: {
manualSteps: ['Use "KBN_PATH_CONF" instead of "CONFIG_PATH" to point to a config folder.'],
Expand All @@ -39,6 +41,7 @@ const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
if (process.env?.DATA_PATH) {
addDeprecation({
configPath: 'env.DATA_PATH',
level: 'critical',
message: `Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`,
correctiveActions: {
manualSteps: [
Expand All @@ -53,13 +56,13 @@ const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDe
if (settings.server?.basePath && !settings.server?.rewriteBasePath) {
addDeprecation({
configPath: 'server.basePath',
level: 'warning',
title: 'Setting "server.rewriteBasePath" should be set when using "server.basePath"',
message:
'You should set server.basePath along with server.rewriteBasePath. Starting in 7.0, Kibana ' +
'will expect that all requests start with server.basePath rather than expecting you to rewrite ' +
'the requests in your reverse proxy. Set server.rewriteBasePath to false to preserve the ' +
'current behavior and silence this warning.',
level: 'warning',
correctiveActions: {
manualSteps: [
`Set 'server.rewriteBasePath' in the config file, CLI flag, or environment variable (in Docker only).`,
Expand All @@ -75,6 +78,7 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati
if (typeof corsSettings === 'boolean') {
addDeprecation({
configPath: 'server.cors',
level: 'warning',
title: 'Setting "server.cors" is deprecated',
message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"',
correctiveActions: {
Expand Down Expand Up @@ -113,6 +117,7 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
if (sourceList.find((source) => source.includes(NONCE_STRING))) {
addDeprecation({
configPath: 'csp.rules',
level: 'critical',
message: `csp.rules no longer supports the {nonce} syntax. Replacing with 'self' in ${policy}`,
correctiveActions: {
manualSteps: [`Replace {nonce} syntax with 'self' in ${policy}`],
Expand All @@ -132,6 +137,7 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
) {
addDeprecation({
configPath: 'csp.rules',
level: 'critical',
message: `csp.rules must contain the 'self' source. Automatically adding to ${policy}.`,
correctiveActions: {
manualSteps: [`Add 'self' source to ${policy}.`],
Expand All @@ -156,6 +162,7 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (
if (settings.map?.manifestServiceUrl) {
addDeprecation({
configPath: 'map.manifestServiceUrl',
level: 'critical',
message:
'You should no longer use the map.manifestServiceUrl setting in kibana.yml to configure the location ' +
'of the Elastic Maps Service settings. These settings have moved to the "map.emsTileApiUrl" and ' +
Expand All @@ -175,6 +182,7 @@ const serverHostZeroDeprecation: ConfigDeprecation = (settings, fromPath, addDep
if (settings.server?.host === '0') {
addDeprecation({
configPath: 'server.host',
level: 'critical',
message:
'Support for setting server.host to "0" in kibana.yml is deprecated and will be removed in Kibana version 8.0.0. ' +
'Instead use "0.0.0.0" to bind to all interfaces.',
Expand Down Expand Up @@ -206,6 +214,7 @@ const opsLoggingEventDeprecation: ConfigDeprecation = (
if (settings.logging?.events?.ops) {
addDeprecation({
configPath: 'logging.events.ops',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsOps.deprecationTitle', {
defaultMessage: `Setting "logging.events.ops" is deprecated`,
Expand Down Expand Up @@ -237,6 +246,7 @@ const requestLoggingEventDeprecation: ConfigDeprecation = (
if (settings.logging?.events?.request) {
addDeprecation({
configPath: 'logging.events.request',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsRequest.deprecationTitle', {
defaultMessage: `Setting "logging.events.request" is deprecated`,
Expand Down Expand Up @@ -268,6 +278,7 @@ const responseLoggingEventDeprecation: ConfigDeprecation = (
if (settings.logging?.events?.response) {
addDeprecation({
configPath: 'logging.events.response',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsResponse.deprecationTitle', {
defaultMessage: `Setting "logging.events.response" is deprecated`,
Expand Down Expand Up @@ -299,6 +310,7 @@ const timezoneLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.timezone) {
addDeprecation({
configPath: 'logging.timezone',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingtimezone`,
title: i18n.translate('core.deprecations.loggingTimezone.deprecationTitle', {
defaultMessage: `Setting "logging.timezone" is deprecated`,
Expand Down Expand Up @@ -330,6 +342,7 @@ const destLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.dest) {
addDeprecation({
configPath: 'logging.dest',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingdest`,
title: i18n.translate('core.deprecations.loggingDest.deprecationTitle', {
defaultMessage: `Setting "logging.dest" is deprecated`,
Expand Down Expand Up @@ -361,6 +374,7 @@ const quietLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.quiet) {
addDeprecation({
configPath: 'logging.quiet',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingquiet`,
title: i18n.translate('core.deprecations.loggingQuiet.deprecationTitle', {
defaultMessage: `Setting "logging.quiet" is deprecated`,
Expand Down Expand Up @@ -391,6 +405,7 @@ const silentLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.silent) {
addDeprecation({
configPath: 'logging.silent',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingsilent`,
title: i18n.translate('core.deprecations.loggingSilent.deprecationTitle', {
defaultMessage: `Setting "logging.silent" is deprecated`,
Expand Down Expand Up @@ -421,6 +436,7 @@ const verboseLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.verbose) {
addDeprecation({
configPath: 'logging.verbose',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingverbose`,
title: i18n.translate('core.deprecations.loggingVerbose.deprecationTitle', {
defaultMessage: `Setting "logging.verbose" is deprecated`,
Expand Down Expand Up @@ -455,6 +471,7 @@ const jsonLoggingDeprecation: ConfigDeprecation = (
if (settings.logging?.json && settings.env !== 'development') {
addDeprecation({
configPath: 'logging.json',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx`,
title: i18n.translate('core.deprecations.loggingJson.deprecationTitle', {
defaultMessage: `Setting "logging.json" is deprecated`,
Expand Down Expand Up @@ -487,6 +504,7 @@ const logRotateDeprecation: ConfigDeprecation = (
if (settings.logging?.rotate) {
addDeprecation({
configPath: 'logging.rotate',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#rolling-file-appender`,
title: i18n.translate('core.deprecations.loggingRotate.deprecationTitle', {
defaultMessage: `Setting "logging.rotate" is deprecated`,
Expand Down Expand Up @@ -518,6 +536,7 @@ const logEventsLogDeprecation: ConfigDeprecation = (
if (settings.logging?.events?.log) {
addDeprecation({
configPath: 'logging.events.log',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsLog.deprecationTitle', {
defaultMessage: `Setting "logging.events.log" is deprecated`,
Expand Down Expand Up @@ -548,6 +567,7 @@ const logEventsErrorDeprecation: ConfigDeprecation = (
if (settings.logging?.events?.error) {
addDeprecation({
configPath: 'logging.events.error',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsError.deprecationTitle', {
defaultMessage: `Setting "logging.events.error" is deprecated`,
Expand Down Expand Up @@ -578,6 +598,7 @@ const logFilterDeprecation: ConfigDeprecation = (
if (settings.logging?.filter) {
addDeprecation({
configPath: 'logging.filter',
level: 'critical',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingfilter`,
title: i18n.translate('core.deprecations.loggingFilter.deprecationTitle', {
defaultMessage: `Setting "logging.filter" is deprecated`,
Expand All @@ -596,40 +617,42 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
unusedFromRoot,
renameFromRoot,
}) => [
unusedFromRoot('savedObjects.indexCheckTimeout'),
unusedFromRoot('server.xsrf.token'),
unusedFromRoot('maps.manifestServiceUrl'),
unusedFromRoot('optimize.lazy'),
unusedFromRoot('optimize.lazyPort'),
unusedFromRoot('optimize.lazyHost'),
unusedFromRoot('optimize.lazyPrebuild'),
unusedFromRoot('optimize.lazyProxyTimeout'),
unusedFromRoot('optimize.enabled'),
unusedFromRoot('optimize.bundleFilter'),
unusedFromRoot('optimize.bundleDir'),
unusedFromRoot('optimize.viewCaching'),
unusedFromRoot('optimize.watch'),
unusedFromRoot('optimize.watchPort'),
unusedFromRoot('optimize.watchHost'),
unusedFromRoot('optimize.watchPrebuild'),
unusedFromRoot('optimize.watchProxyTimeout'),
unusedFromRoot('optimize.useBundleCache'),
unusedFromRoot('optimize.sourceMaps'),
unusedFromRoot('optimize.workers'),
unusedFromRoot('optimize.profile'),
unusedFromRoot('optimize.validateSyntaxOfNodeModules'),
renameFromRoot('xpack.xpack_main.telemetry.config', 'telemetry.config'),
renameFromRoot('xpack.xpack_main.telemetry.url', 'telemetry.url'),
renameFromRoot('xpack.xpack_main.telemetry.enabled', 'telemetry.enabled'),
renameFromRoot('xpack.telemetry.enabled', 'telemetry.enabled'),
renameFromRoot('xpack.telemetry.config', 'telemetry.config'),
renameFromRoot('xpack.telemetry.banner', 'telemetry.banner'),
renameFromRoot('xpack.telemetry.url', 'telemetry.url'),
renameFromRoot('cpu.cgroup.path.override', 'ops.cGroupOverrides.cpuPath'),
renameFromRoot('cpuacct.cgroup.path.override', 'ops.cGroupOverrides.cpuAcctPath'),
renameFromRoot('server.xsrf.whitelist', 'server.xsrf.allowlist'),
unusedFromRoot('elasticsearch.preserveHost'),
unusedFromRoot('elasticsearch.startupTimeout'),
unusedFromRoot('savedObjects.indexCheckTimeout', { level: 'critical' }),
unusedFromRoot('server.xsrf.token', { level: 'critical' }),
unusedFromRoot('maps.manifestServiceUrl', { level: 'critical' }),
unusedFromRoot('optimize.lazy', { level: 'critical' }),
unusedFromRoot('optimize.lazyPort', { level: 'critical' }),
unusedFromRoot('optimize.lazyHost', { level: 'critical' }),
unusedFromRoot('optimize.lazyPrebuild', { level: 'critical' }),
unusedFromRoot('optimize.lazyProxyTimeout', { level: 'critical' }),
unusedFromRoot('optimize.enabled', { level: 'critical' }),
unusedFromRoot('optimize.bundleFilter', { level: 'critical' }),
unusedFromRoot('optimize.bundleDir', { level: 'critical' }),
unusedFromRoot('optimize.viewCaching', { level: 'critical' }),
unusedFromRoot('optimize.watch', { level: 'critical' }),
unusedFromRoot('optimize.watchPort', { level: 'critical' }),
unusedFromRoot('optimize.watchHost', { level: 'critical' }),
unusedFromRoot('optimize.watchPrebuild', { level: 'critical' }),
unusedFromRoot('optimize.watchProxyTimeout', { level: 'critical' }),
unusedFromRoot('optimize.useBundleCache', { level: 'critical' }),
unusedFromRoot('optimize.sourceMaps', { level: 'critical' }),
unusedFromRoot('optimize.workers', { level: 'critical' }),
unusedFromRoot('optimize.profile', { level: 'critical' }),
unusedFromRoot('optimize.validateSyntaxOfNodeModules', { level: 'critical' }),
renameFromRoot('xpack.xpack_main.telemetry.config', 'telemetry.config', { level: 'critical' }),
renameFromRoot('xpack.xpack_main.telemetry.url', 'telemetry.url', { level: 'critical' }),
renameFromRoot('xpack.xpack_main.telemetry.enabled', 'telemetry.enabled', { level: 'critical' }),
renameFromRoot('xpack.telemetry.enabled', 'telemetry.enabled', { level: 'critical' }),
renameFromRoot('xpack.telemetry.config', 'telemetry.config', { level: 'critical' }),
renameFromRoot('xpack.telemetry.banner', 'telemetry.banner', { level: 'critical' }),
renameFromRoot('xpack.telemetry.url', 'telemetry.url', { level: 'critical' }),
renameFromRoot('cpu.cgroup.path.override', 'ops.cGroupOverrides.cpuPath', { level: 'critical' }),
renameFromRoot('cpuacct.cgroup.path.override', 'ops.cGroupOverrides.cpuAcctPath', {
level: 'critical',
}),
renameFromRoot('server.xsrf.whitelist', 'server.xsrf.allowlist', { level: 'critical' }),
unusedFromRoot('elasticsearch.preserveHost', { level: 'critical' }),
unusedFromRoot('elasticsearch.startupTimeout', { level: 'critical' }),
rewriteCorsSettings,
configPathDeprecation,
kibanaPathConf,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/kibana_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const deprecations: ConfigDeprecationProvider = () => [
if (kibana?.index) {
addDeprecation({
configPath: 'kibana.index',
level: 'critical',
title: i18n.translate('core.kibana.index.deprecationTitle', {
defaultMessage: `Setting "kibana.index" is deprecated`,
}),
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/home/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
},
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
renameFromRoot('kibana.disableWelcomeScreen', 'home.disableWelcomeScreen'),
renameFromRoot('kibana.disableWelcomeScreen', 'home.disableWelcomeScreen', {
level: 'critical',
}),
],
};

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/newsfeed/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const config: PluginConfigDescriptor<NewsfeedConfigType> = {
mainInterval: true,
fetchInterval: true,
},
deprecations: ({ unused }) => [unused('defaultLanguage')],
deprecations: ({ unused }) => [unused('defaultLanguage', { level: 'critical' })],
};

export function plugin() {
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/telemetry/server/config/deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ describe('deprecateEndpointConfigs', () => {
"To send usage to the staging endpoint add \\"telemetry.sendUsageTo: staging\\" to the Kibana configuration.",
],
},
"level": "critical",
"message": "\\"telemetry.url\\" has been deprecated. Set \\"telemetry.sendUsageTo: staging\\" to the Kibana configurations to send usage to the staging endpoint.",
"title": "Setting \\"telemetry.url\\" is deprecated",
},
Expand All @@ -188,6 +189,7 @@ describe('deprecateEndpointConfigs', () => {
"To send usage to the staging endpoint add \\"telemetry.sendUsageTo: staging\\" to the Kibana configuration.",
],
},
"level": "critical",
"message": "\\"telemetry.optInStatusUrl\\" has been deprecated. Set \\"telemetry.sendUsageTo: staging\\" to the Kibana configurations to send usage to the staging endpoint.",
"title": "Setting \\"telemetry.optInStatusUrl\\" is deprecated",
},
Expand Down
1 change: 1 addition & 0 deletions src/plugins/telemetry/server/config/deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const deprecateEndpointConfigs: ConfigDeprecation = (

addDeprecation({
configPath: fullConfigPath,
level: 'critical',
title: i18n.translate('telemetry.endpointConfigs.deprecationTitle', {
defaultMessage: 'Setting "{configPath}" is deprecated',
values: { configPath: fullConfigPath },
Expand Down
14 changes: 10 additions & 4 deletions src/plugins/usage_collection/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ export type ConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigType> = {
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
renameFromRoot('ui_metric.enabled', 'usageCollection.uiCounters.enabled'),
renameFromRoot('ui_metric.debug', 'usageCollection.uiCounters.debug'),
renameFromRoot('usageCollection.uiMetric.enabled', 'usageCollection.uiCounters.enabled'),
renameFromRoot('usageCollection.uiMetric.debug', 'usageCollection.uiCounters.debug'),
renameFromRoot('ui_metric.enabled', 'usageCollection.uiCounters.enabled', {
level: 'critical',
}),
renameFromRoot('ui_metric.debug', 'usageCollection.uiCounters.debug', { level: 'critical' }),
renameFromRoot('usageCollection.uiMetric.enabled', 'usageCollection.uiCounters.enabled', {
level: 'critical',
}),
renameFromRoot('usageCollection.uiMetric.debug', 'usageCollection.uiCounters.debug', {
level: 'critical',
}),
],
exposeToBrowser: {
uiCounters: true,
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/licensing/server/licensing_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const config: PluginConfigDescriptor<LicenseConfigType> = {
deprecations: ({ renameFromRoot }) => [
renameFromRoot(
'xpack.xpack_main.xpack_api_polling_frequency_millis',
'xpack.licensing.api_polling_frequency'
'xpack.licensing.api_polling_frequency',
{ level: 'critical' }
),
],
};

0 comments on commit 4317d06

Please sign in to comment.