-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#208833) # Backport This will backport the following commits from `main` to `8.x`: - [Add warnings to upgrade assistant for search sessions (#206998)](#206998) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Lukas Olson","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-28T22:13:53Z","message":"Add warnings to upgrade assistant for search sessions (#206998)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/203925.\r\nResolves https://github.com/elastic/kibana/issues/205813.\r\n\r\nAdds warning messages to the upgrade assistant if a cluster has\r\nunexpired search sessions, since the feature is being disabled by\r\ndefault and will have to be explicitly re-enabled to manage the\r\nsessions.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"b998946003273245f9ea851ad60347c9f83c593a","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:DataDiscovery","Feature:Search Sessions","backport:prev-minor"],"title":"Add warnings to upgrade assistant for search sessions","number":206998,"url":"https://github.com/elastic/kibana/pull/206998","mergeCommit":{"message":"Add warnings to upgrade assistant for search sessions (#206998)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/203925.\r\nResolves https://github.com/elastic/kibana/issues/205813.\r\n\r\nAdds warning messages to the upgrade assistant if a cluster has\r\nunexpired search sessions, since the feature is being disabled by\r\ndefault and will have to be explicitly re-enabled to manage the\r\nsessions.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"b998946003273245f9ea851ad60347c9f83c593a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206998","number":206998,"mergeCommit":{"message":"Add warnings to upgrade assistant for search sessions (#206998)\n\n## Summary\r\n\r\nPart of https://github.com/elastic/kibana/issues/203925.\r\nResolves https://github.com/elastic/kibana/issues/205813.\r\n\r\nAdds warning messages to the upgrade assistant if a cluster has\r\nunexpired search sessions, since the feature is being disabled by\r\ndefault and will have to be explicitly re-enabled to manage the\r\nsessions.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"b998946003273245f9ea851ad60347c9f83c593a"}}]}] BACKPORT-->
- Loading branch information
1 parent
7638b23
commit ea52646
Showing
7 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/platform/plugins/shared/data/server/deprecations/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export { createSearchSessionsDeprecationsConfig } from './search_sessions'; |
93 changes: 93 additions & 0 deletions
93
src/platform/plugins/shared/data/server/deprecations/search_sessions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import type { | ||
CoreSetup, | ||
DeprecationsDetails, | ||
GetDeprecationsContext, | ||
RegisterDeprecationsConfig, | ||
SavedObjectsFindResult, | ||
} from '@kbn/core/server'; | ||
import { i18n } from '@kbn/i18n'; | ||
import type { DeprecationDetailsMessage } from '@kbn/core-deprecations-common'; | ||
import { SEARCH_SESSION_TYPE, SearchSessionSavedObjectAttributes } from '../../common'; | ||
|
||
type SearchSessionAttributes = Pick< | ||
SearchSessionSavedObjectAttributes, | ||
'name' | 'username' | 'expires' | ||
>; | ||
|
||
export const createSearchSessionsDeprecationsConfig: ( | ||
core: CoreSetup | ||
) => RegisterDeprecationsConfig = (core: CoreSetup) => ({ | ||
getDeprecations: async (context: GetDeprecationsContext): Promise<DeprecationsDetails[]> => { | ||
const searchSessionsLink = core.http.basePath.prepend('/app/management/kibana/search_sessions'); | ||
const [coreStart] = await core.getStartServices(); | ||
const savedObjectsClient = coreStart.savedObjects.getScopedClient(context.request, { | ||
includedHiddenTypes: [SEARCH_SESSION_TYPE], | ||
}); | ||
const results = await savedObjectsClient.find<SearchSessionAttributes>({ | ||
type: 'search-session', | ||
perPage: 1000, | ||
fields: ['name', 'username', 'expires'], | ||
sortField: 'created', | ||
sortOrder: 'desc', | ||
namespaces: ['*'], | ||
}); | ||
|
||
const searchSessions: Array<SavedObjectsFindResult<SearchSessionAttributes>> = | ||
results.saved_objects.filter((so) => new Date(so.attributes.expires).getTime() > Date.now()); | ||
|
||
if (!searchSessions.length) { | ||
return []; | ||
} | ||
|
||
return [ | ||
{ | ||
title: i18n.translate('data.deprecations.searchSessionsTitle', { | ||
defaultMessage: 'Search sessions will be disabled by default', | ||
}), | ||
message: buildMessage({ searchSessions, searchSessionsLink }), | ||
deprecationType: 'feature', | ||
level: 'warning', | ||
correctiveActions: { | ||
manualSteps: [ | ||
i18n.translate('data.deprecations.searchSessions.manualStepOneMessage', { | ||
defaultMessage: 'Navigate to Stack Management > Kibana > Search Sessions', | ||
}), | ||
i18n.translate('data.deprecations.searchSessions.manualStepTwoMessage', { | ||
defaultMessage: 'Delete search sessions that have not expired', | ||
}), | ||
i18n.translate('data.deprecations.searchSessions.manualStepTwoMessage', { | ||
defaultMessage: | ||
'Alternatively, to continue using search sessions until 9.1, open the kibana.yml config file and add the following: "data.search.sessions.enabled: true"', | ||
}), | ||
], | ||
}, | ||
}, | ||
]; | ||
}, | ||
}); | ||
|
||
const buildMessage = ({ | ||
searchSessions, | ||
searchSessionsLink, | ||
}: { | ||
searchSessions: Array<SavedObjectsFindResult<SearchSessionAttributes>>; | ||
searchSessionsLink: string; | ||
}): DeprecationDetailsMessage => ({ | ||
type: 'markdown', | ||
content: i18n.translate('data.deprecations.scriptedFieldsMessage', { | ||
defaultMessage: `The search sessions feature is deprecated and is disabled by default in 9.0. You currently have {numberOfSearchSessions} active search session(s): [Manage Search Sessions]({searchSessionsLink})`, | ||
values: { | ||
numberOfSearchSessions: searchSessions.length, | ||
searchSessionsLink, | ||
}, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters