-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Upgrade Assistant] Add warning when remote clusters are configured #125138
Merged
alisonelizabeth
merged 5 commits into
elastic:7.17
from
alisonelizabeth:ua/remote_cluster_check
Feb 10, 2022
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
dba67fd
add warning when user has remote clusters configured
alisonelizabeth 5046115
fix CI
alisonelizabeth 5edf3cc
update debug log
alisonelizabeth f023090
Merge branch '7.17' into ua/remote_cluster_check
kibanamachine 917fe2b
Update x-pack/plugins/upgrade_assistant/public/application/components…
alisonelizabeth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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 type { SerializableRecord } from '@kbn/utility-types'; | ||
import { ManagementAppLocator } from 'src/plugins/management/common'; | ||
import { LocatorDefinition } from '../../../../src/plugins/share/public/'; | ||
|
||
export const REMOTE_CLUSTERS_LOCATOR_ID = 'REMOTE_CLUSTERS_LOCATOR'; | ||
|
||
export interface RemoteClustersLocatorParams extends SerializableRecord { | ||
page: 'remoteClusters'; | ||
} | ||
|
||
export interface RemoteClustersLocatorDefinitionDependencies { | ||
managementAppLocator: ManagementAppLocator; | ||
} | ||
|
||
export class RemoteClustersLocatorDefinition | ||
implements LocatorDefinition<RemoteClustersLocatorParams> | ||
{ | ||
constructor(protected readonly deps: RemoteClustersLocatorDefinitionDependencies) {} | ||
|
||
public readonly id = REMOTE_CLUSTERS_LOCATOR_ID; | ||
|
||
public readonly getLocation = async (params: RemoteClustersLocatorParams) => { | ||
const location = await this.deps.managementAppLocator.getLocation({ | ||
sectionId: 'data', | ||
appId: 'remote_clusters', | ||
}); | ||
|
||
switch (params.page) { | ||
case 'remoteClusters': { | ||
return { | ||
...location, | ||
path: location.path, | ||
}; | ||
} | ||
} | ||
}; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
import React, { useEffect, useMemo } from 'react'; | ||
import { withRouter, RouteComponentProps } from 'react-router-dom'; | ||
|
||
import { EuiPageHeader, EuiSpacer, EuiPageContent, EuiLink } from '@elastic/eui'; | ||
import { EuiPageHeader, EuiSpacer, EuiPageContent, EuiLink, EuiCallOut } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { DocLinksStart } from 'kibana/public'; | ||
|
@@ -51,6 +51,26 @@ const i18nTexts = { | |
isLoading: i18n.translate('xpack.upgradeAssistant.esDeprecations.loadingText', { | ||
defaultMessage: 'Loading deprecation issues…', | ||
}), | ||
remoteClustersDetectedTitle: i18n.translate( | ||
'xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedTitle', | ||
{ | ||
defaultMessage: 'Remote cluster compatibility', | ||
} | ||
), | ||
getRemoteClustersDetectedDescription: (remoteClustersCount: number) => | ||
i18n.translate('xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedDescription', { | ||
defaultMessage: | ||
'You have {remoteClustersCount} {remoteClustersCount, plural, one {remote cluster} other {remote clusters}} configured. If you use cross-cluster search, note that 8.x can only search remote clusters 7.17 or later. If you use cross-cluster replication, a cluster that contains follower indices must run the same or newer version as the remote cluster.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jrodewig do you have bandwidth to review this text?
alisonelizabeth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
values: { | ||
remoteClustersCount, | ||
}, | ||
}), | ||
remoteClustersLinkText: i18n.translate( | ||
'xpack.upgradeAssistant.esDeprecations.remoteClustersLinkText', | ||
{ | ||
defaultMessage: 'View remote clusters.', | ||
} | ||
), | ||
}; | ||
|
||
const getBatchReindexLink = (docLinks: DocLinksStart) => { | ||
|
@@ -75,6 +95,22 @@ const getBatchReindexLink = (docLinks: DocLinksStart) => { | |
); | ||
}; | ||
|
||
const RemoteClustersAppLink: React.FunctionComponent = () => { | ||
const { | ||
plugins: { share }, | ||
} = useAppContext(); | ||
|
||
const remoteClustersUrl = share.url.locators | ||
.get('REMOTE_CLUSTERS_LOCATOR') | ||
?.useUrl({ page: 'remoteClusters' }); | ||
|
||
return ( | ||
<EuiLink href={remoteClustersUrl} data-test-subj="remoteClustersLink"> | ||
{i18nTexts.remoteClustersLinkText} | ||
</EuiLink> | ||
); | ||
}; | ||
|
||
export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => { | ||
const { | ||
services: { | ||
|
@@ -85,6 +121,7 @@ export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => { | |
} = useAppContext(); | ||
|
||
const { data: esDeprecations, isLoading, error, resendRequest } = api.useLoadEsDeprecations(); | ||
const { data: remoteClusters } = api.useLoadRemoteClusters(); | ||
|
||
const deprecationsCountByLevel: { | ||
warningDeprecations: number; | ||
|
@@ -140,10 +177,29 @@ export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => { | |
</> | ||
} | ||
> | ||
<DeprecationCount | ||
totalCriticalDeprecations={deprecationsCountByLevel.criticalDeprecations} | ||
totalWarningDeprecations={deprecationsCountByLevel.warningDeprecations} | ||
/> | ||
<> | ||
{remoteClusters && remoteClusters.length > 0 && ( | ||
<> | ||
<EuiCallOut | ||
title={i18nTexts.remoteClustersDetectedTitle} | ||
color="warning" | ||
iconType="help" | ||
data-test-subj="remoteClustersWarningCallout" | ||
> | ||
<p> | ||
{i18nTexts.getRemoteClustersDetectedDescription(remoteClusters.length)}{' '} | ||
<RemoteClustersAppLink /> | ||
</p> | ||
</EuiCallOut> | ||
<EuiSpacer /> | ||
</> | ||
)} | ||
|
||
<DeprecationCount | ||
totalCriticalDeprecations={deprecationsCountByLevel.criticalDeprecations} | ||
totalWarningDeprecations={deprecationsCountByLevel.warningDeprecations} | ||
/> | ||
</> | ||
</EuiPageHeader> | ||
|
||
<EuiSpacer size="l" /> | ||
|
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
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/upgrade_assistant/server/routes/remote_clusters.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,40 @@ | ||
/* | ||
* 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 { API_BASE_PATH } from '../../common/constants'; | ||
import { versionCheckHandlerWrapper } from '../lib/es_version_precheck'; | ||
import { RouteDependencies } from '../types'; | ||
|
||
export function registerRemoteClustersRoute({ router, lib: { handleEsError } }: RouteDependencies) { | ||
router.get( | ||
{ | ||
path: `${API_BASE_PATH}/remote_clusters`, | ||
validate: false, | ||
}, | ||
versionCheckHandlerWrapper( | ||
async ( | ||
{ | ||
core: { | ||
elasticsearch: { client }, | ||
}, | ||
}, | ||
request, | ||
response | ||
) => { | ||
try { | ||
const { body: clustersByName } = await client.asCurrentUser.cluster.remoteInfo(); | ||
|
||
const remoteClusters = Object.keys(clustersByName); | ||
|
||
return response.ok({ body: remoteClusters }); | ||
} catch (error) { | ||
return handleEsError({ error, response }); | ||
} | ||
} | ||
) | ||
); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed pattern used in #109543