Removes unused and renamed deprecated core settings and deprecated settings from core plugins (#113653)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Christiane (Tina) Heiligers 2021-10-05 12:30:49 -07:00 committed by GitHub
parent 3f4240bdf1
commit 67be0a8e68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 52 additions and 148 deletions

View file

@ -364,4 +364,34 @@ Configuration management tools and automation will need to be updated to use the
=== `server.xsrf.token` is no longer valid
*Details:* The deprecated `server.xsrf.token` setting in the `kibana.yml` file has been removed.
[float]
=== `newsfeed.defaultLanguage` is no longer valid
*Details:* Specifying a default language to retrieve newsfeed items is no longer supported.
*Impact:* Newsfeed items will be retrieved based on the browser locale and fallback to 'en' if an item does not have a translation for the locale. Configure {kibana-ref}/i18n-settings-kb.html#general-i18n-settings-kb[`i18n.locale`] to override the default behavior.
[float]
=== `xpack.banners.placement` has changed value
*Details:* `xpack.banners.placement: 'header'` setting in `kibana.yml` has changed value.
*Impact:* Use {kibana-ref}/banners-settings-kb.html#banners-settings-kb[`xpack.banners.placement: 'top'`] instead.
[float]
=== `cpu.cgroup.path.override` is no longer valid
*Details:* The deprecated `cpu.cgroup.path.override` setting is no longer supported.
*Impact:* Configure {kibana-ref}/settings.html#ops-cGroupOverrides-cpuPath[`ops.cGroupOverrides.cpuPath`] instead.
[float]
=== `cpuacct.cgroup.path.override` is no longer valid
*Details:* The deprecated `cpuacct.cgroup.path.override` setting is no longer supported.
*Impact:* Configure {kibana-ref}/settings.html#ops-cGroupOverrides-cpuAcctPath[`ops.cGroupOverrides.cpuAcctPath`] instead.
[float]
=== `server.xsrf.whitelist` is no longer valid
*Details:* The deprecated `server.xsrf.whitelist` setting is no longer supported.
*Impact:* Use {kibana-ref}/settings.html#settings-xsrf-allowlist[`server.xsrf.allowlist`] instead.
// end::notable-breaking-changes[]

View file

@ -26,16 +26,6 @@ Toggling this causes the server to regenerate assets on the next startup,
which may cause a delay before pages start being served.
Set to `false` to disable Console. *Default: `true`*
| `cpu.cgroup.path.override:`
| deprecated:[7.10.0,"In 8.0 and later, this setting will no longer be supported."]
This setting has been renamed to
<<ops-cGroupOverrides-cpuPath,`ops.cGroupOverrides.cpuPath`>>.
| `cpuacct.cgroup.path.override:`
| deprecated:[7.10.0,"In 8.0 and later, this setting will no longer be supported."]
This setting has been renamed to
<<ops-cGroupOverrides-cpuAcctPath, `ops.cGroupOverrides.cpuAcctPath`>>.
| `csp.rules:`
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
A https://w3c.github.io/webappsec-csp/[Content Security Policy] template

View file

@ -15,14 +15,12 @@ const isString = (v: any): v is string => typeof v === 'string';
const CONFIG_PATHS = [
process.env.KBN_PATH_CONF && join(process.env.KBN_PATH_CONF, 'kibana.yml'),
process.env.KIBANA_PATH_CONF && join(process.env.KIBANA_PATH_CONF, 'kibana.yml'), // deprecated
join(REPO_ROOT, 'config/kibana.yml'),
'/etc/kibana/kibana.yml',
].filter(isString);
const CONFIG_DIRECTORIES = [
process.env.KBN_PATH_CONF,
process.env.KIBANA_PATH_CONF, // deprecated
join(REPO_ROOT, 'config'),
'/etc/kibana',
].filter(isString);

View file

@ -19,38 +19,6 @@ describe('core deprecations', () => {
process.env = { ...initialEnv };
});
describe('kibanaPathConf', () => {
it('logs a warning if KIBANA_PATH_CONF environ variable is set', () => {
process.env.KIBANA_PATH_CONF = 'somepath';
const { messages } = applyCoreDeprecations();
expect(messages).toMatchInlineSnapshot(`
Array [
"Environment variable \\"KIBANA_PATH_CONF\\" is deprecated. It has been replaced with \\"KBN_PATH_CONF\\" pointing to a config folder",
]
`);
});
it('does not log a warning if KIBANA_PATH_CONF environ variable is unset', () => {
delete process.env.KIBANA_PATH_CONF;
const { messages } = applyCoreDeprecations();
expect(messages).toHaveLength(0);
});
});
describe('xsrfDeprecation', () => {
it('logs a warning if server.xsrf.whitelist is set', () => {
const { migrated, messages } = applyCoreDeprecations({
server: { xsrf: { whitelist: ['/path'] } },
});
expect(migrated.server.xsrf.allowlist).toEqual(['/path']);
expect(messages).toMatchInlineSnapshot(`
Array [
"Setting \\"server.xsrf.whitelist\\" has been replaced by \\"server.xsrf.allowlist\\"",
]
`);
});
});
describe('server.cors', () => {
it('renames server.cors to server.cors.enabled', () => {
const { migrated } = applyCoreDeprecations({
@ -58,8 +26,9 @@ describe('core deprecations', () => {
});
expect(migrated.server.cors).toEqual({ enabled: true });
});
it('logs a warning message about server.cors renaming', () => {
const { messages } = applyCoreDeprecations({
const { messages, levels } = applyCoreDeprecations({
server: { cors: true },
});
expect(messages).toMatchInlineSnapshot(`
@ -67,7 +36,13 @@ describe('core deprecations', () => {
"\\"server.cors\\" is deprecated and has been replaced by \\"server.cors.enabled\\"",
]
`);
expect(levels).toMatchInlineSnapshot(`
Array [
"warning",
]
`);
});
it('does not log deprecation message when server.cors.enabled set', () => {
const { migrated, messages } = applyCoreDeprecations({
server: { cors: { enabled: true } },

View file

@ -8,19 +8,6 @@
import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
const kibanaPathConf: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (process.env?.KIBANA_PATH_CONF) {
addDeprecation({
message: `Environment variable "KIBANA_PATH_CONF" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
correctiveActions: {
manualSteps: [
'Use "KBN_PATH_CONF" instead of "KIBANA_PATH_CONF" to point to a config folder.',
],
},
});
}
};
const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (settings.server?.basePath && !settings.server?.rewriteBasePath) {
addDeprecation({
@ -44,6 +31,7 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati
if (typeof corsSettings === 'boolean') {
addDeprecation({
message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"',
level: 'warning',
correctiveActions: {
manualSteps: [
`Replace "server.cors: ${corsSettings}" with "server.cors.enabled: ${corsSettings}"`,
@ -114,11 +102,7 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
};
export const coreDeprecationProvider: ConfigDeprecationProvider = ({ rename, unusedFromRoot }) => [
rename('cpu.cgroup.path.override', 'ops.cGroupOverrides.cpuPath'),
rename('cpuacct.cgroup.path.override', 'ops.cGroupOverrides.cpuAcctPath'),
rename('server.xsrf.whitelist', 'server.xsrf.allowlist'),
rewriteCorsSettings,
kibanaPathConf,
rewriteBasePathDeprecation,
cspRulesDeprecation,
];

View file

@ -16,6 +16,7 @@ function collectDeprecations(
) {
const deprecations = provider(configDeprecationFactory);
const deprecationMessages: string[] = [];
const deprecationLevels: string[] = [];
const { config: migrated } = applyDeprecations(
settings,
deprecations.map((deprecation) => ({
@ -23,11 +24,14 @@ function collectDeprecations(
path,
})),
() =>
({ message }) =>
deprecationMessages.push(message)
({ message, level }) => {
deprecationMessages.push(message);
deprecationLevels.push(level ?? '');
}
);
return {
messages: deprecationMessages,
levels: deprecationLevels,
migrated,
};
}

View file

@ -26,8 +26,6 @@ kibana_vars=(
console.enabled
console.proxyConfig
console.proxyFilter
cpu.cgroup.path.override
cpuacct.cgroup.path.override
csp.rules
csp.strict
csp.warnLegacyBrowsers
@ -175,7 +173,6 @@ kibana_vars=(
server.uuid
server.xsrf.allowlist
server.xsrf.disableProtection
server.xsrf.whitelist
status.allowAnonymous
status.v6ApiFormat
telemetry.allowChangingOptInStatus
@ -423,7 +420,7 @@ umask 0002
# paths. Therefore, Kibana provides a mechanism to override
# reading the cgroup path from /proc/self/cgroup and instead uses the
# cgroup path defined the configuration properties
# cpu.cgroup.path.override and cpuacct.cgroup.path.override.
# ops.cGroupOverrides.cpuPath and ops.cGroupOverrides.cpuAcctPath.
# Therefore, we set this value here so that cgroup statistics are
# available for the container this process will run in.

View file

@ -18,9 +18,6 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
disableWelcomeScreen: true,
},
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
renameFromRoot('kibana.disableWelcomeScreen', 'home.disableWelcomeScreen'),
],
};
export const plugin = (initContext: PluginInitializerContext) => new HomeServerPlugin(initContext);

View file

@ -11,7 +11,6 @@ import {
NEWSFEED_DEFAULT_SERVICE_PATH,
NEWSFEED_DEFAULT_SERVICE_BASE_URL,
NEWSFEED_DEV_SERVICE_BASE_URL,
NEWSFEED_FALLBACK_LANGUAGE,
} from '../common/constants';
export const configSchema = schema.object({
@ -25,7 +24,6 @@ export const configSchema = schema.object({
schema.string({ defaultValue: NEWSFEED_DEV_SERVICE_BASE_URL })
),
}),
defaultLanguage: schema.string({ defaultValue: NEWSFEED_FALLBACK_LANGUAGE }), // TODO: Deprecate since no longer used
mainInterval: schema.duration({ defaultValue: '2m' }), // (2min) How often to retry failed fetches, and/or check if newsfeed items need to be refreshed from remote
fetchInterval: schema.duration({ defaultValue: '1d' }), // (1day) How often to fetch remote and reset the last fetched time
});

View file

@ -17,7 +17,6 @@ export const config: PluginConfigDescriptor<NewsfeedConfigType> = {
mainInterval: true,
fetchInterval: true,
},
deprecations: ({ unused }) => [unused('defaultLanguage')],
};
export function plugin() {

View file

@ -29,12 +29,6 @@ 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'),
],
exposeToBrowser: {
uiCounters: true,
},

View file

@ -1,38 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { config } from './config';
import { getDeprecationsFor } from '../../../../src/core/server/test_utils';
function applyDeprecations(settings?: Record<string, any>) {
return getDeprecationsFor({ provider: config.deprecations!, settings, path: 'xpack.banners' });
}
describe('deprecations', () => {
it('replaces xpack.banners.placement from "header" to "top"', () => {
const { migrated } = applyDeprecations({
placement: 'header',
});
expect(migrated.xpack.banners.placement).toBe('top');
});
it('logs a warning message about xpack.banners.placement renaming', () => {
const { messages } = applyDeprecations({
placement: 'header',
});
expect(messages).toMatchInlineSnapshot(`
Array [
"The \`header\` value for xpack.banners.placement has been replaced by \`top\`",
]
`);
});
it('do not rename other placement values', () => {
const { migrated, messages } = applyDeprecations({
placement: 'disabled',
});
expect(migrated.xpack.banners.placement).toBe('disabled');
expect(messages.length).toBe(0);
});
});

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { get } from 'lodash';
// import { get } from 'lodash';
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from 'kibana/server';
import { isHexColor } from './utils';
@ -39,23 +39,4 @@ export type BannersConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<BannersConfigType> = {
schema: configSchema,
exposeToBrowser: {},
deprecations: () => [
(rootConfig, fromPath, addDeprecation) => {
const pluginConfig = get(rootConfig, fromPath);
if (pluginConfig?.placement === 'header') {
addDeprecation({
message: 'The `header` value for xpack.banners.placement has been replaced by `top`',
correctiveActions: {
manualSteps: [
`Remove "xpack.banners.placement: header" from your kibana configs.`,
`Add "xpack.banners.placement: to" to your kibana configs instead.`,
],
},
});
return {
set: [{ path: `${fromPath}.placement`, value: 'top' }],
};
}
},
],
};

View file

@ -126,6 +126,7 @@ This change makes NP & LP licensing service not compatible. We have to keep both
**LP**: `xpack.xpack_main.xpack_api_polling_frequency_millis`
**NP**: `xpack.licensing.api_polling_frequency`
Support for deprecated `xpack.xpack_main.xpack_api_polling_frequency_millis` is removed in v8.0.0. See https://github.com/elastic/kibana/issues/103915 for more details.
#### License
**NP**: `mode` field is provided, but deprecated.

View file

@ -18,10 +18,4 @@ export const config: PluginConfigDescriptor<LicenseConfigType> = {
schema: schema.object({
api_polling_frequency: schema.duration({ defaultValue: '30s' }),
}),
deprecations: ({ renameFromRoot }) => [
renameFromRoot(
'xpack.xpack_main.xpack_api_polling_frequency_millis',
'xpack.licensing.api_polling_frequency'
),
],
};

View file

@ -32,7 +32,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
...kibanaFunctionalConfig.get('kbnTestServer'),
serverArgs: [
...kibanaFunctionalConfig.get('kbnTestServer.serverArgs'),
'--xpack.banners.placement=header',
'--xpack.banners.placement=top',
'--xpack.banners.textContent="global banner text"',
],
},

View file

@ -140,7 +140,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
(pluginDir) =>
`--plugin-path=${path.resolve(__dirname, 'fixtures', 'plugins', pluginDir)}`
),
`--server.xsrf.whitelist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
`--server.xsrf.allowlist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
...(ssl
? [
`--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`,

View file

@ -83,7 +83,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
// TO DO: Remove feature flags once we're good to go
'--xpack.securitySolution.enableExperimental=["ruleRegistryEnabled"]',
'--xpack.ruleRegistry.write.enabled=true',
`--server.xsrf.whitelist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
`--server.xsrf.allowlist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
...(ssl
? [
`--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`,

View file

@ -83,7 +83,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
// TO DO: Remove feature flags once we're good to go
'--xpack.securitySolution.enableExperimental=["ruleRegistryEnabled"]',
'--xpack.ruleRegistry.write.enabled=true',
`--server.xsrf.whitelist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
`--server.xsrf.allowlist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`,
...(ssl
? [
`--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`,