Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only added breaking changes for the settings that are documented.

=== `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[]
10 changes: 0 additions & 10 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-utils/src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
41 changes: 8 additions & 33 deletions src/core/server/config/deprecation/core_deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,30 @@ 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({
server: { cors: true },
});
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(`
Array [
"\\"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 } },
Expand Down
18 changes: 1 addition & 17 deletions src/core/server/config/deprecation/core_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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}"`,
Expand Down Expand Up @@ -353,11 +341,7 @@ const logFilterDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecat
};

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,
opsLoggingEventDeprecation,
Expand Down
8 changes: 6 additions & 2 deletions src/core/server/config/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ function collectDeprecations(
) {
const deprecations = provider(configDeprecationFactory);
const deprecationMessages: string[] = [];
const deprecationLevels: string[] = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to test changing the rewriteCorsSetting level from critical to warning.

const { config: migrated } = applyDeprecations(
settings,
deprecations.map((deprecation) => ({
deprecation,
path,
})),
() =>
({ message }) =>
deprecationMessages.push(message)
({ message, level }) => {
deprecationMessages.push(message);
deprecationLevels.push(level ?? '');
}
);
return {
messages: deprecationMessages,
levels: deprecationLevels,
migrated,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -186,7 +184,6 @@ kibana_vars=(
server.uuid
server.xsrf.allowlist
server.xsrf.disableProtection
server.xsrf.whitelist
status.allowAnonymous
status.v6ApiFormat
telemetry.allowChangingOptInStatus
Expand Down Expand Up @@ -437,7 +434,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.

Expand Down
3 changes: 0 additions & 3 deletions src/plugins/home/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/newsfeed/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
});
Expand Down
1 change: 0 additions & 1 deletion src/plugins/newsfeed/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const config: PluginConfigDescriptor<NewsfeedConfigType> = {
mainInterval: true,
fetchInterval: true,
},
deprecations: ({ unused }) => [unused('defaultLanguage')],
};

export function plugin() {
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/usage_collection/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
38 changes: 0 additions & 38 deletions x-pack/plugins/banners/server/config.test.ts

This file was deleted.

21 changes: 1 addition & 20 deletions x-pack/plugins/banners/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -39,23 +39,4 @@ export type BannersConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<BannersConfigType> = {
schema: configSchema,
exposeToBrowser: {},
deprecations: () => [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests only tested 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' }],
};
}
},
],
};
1 change: 1 addition & 0 deletions x-pack/plugins/licensing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugins/licensing/server/licensing_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
),
],
};
2 changes: 1 addition & 1 deletion x-pack/test/banners_functional/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"',
],
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/case_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/rule_registry/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/timeline/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down