mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.12`: - [[Fleet] adding upgrade details UPG_FAILED check to stuck in updating (#173628)](https://github.com/elastic/kibana/pull/173628) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-21T08:06:02Z","message":"[Fleet] adding upgrade details UPG_FAILED check to stuck in updating (#173628)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/171419\r\n\r\nAdded upgrade details check to restart upgrade callout when agent is\r\nstuck in updating.\r\nChanged the copy slightly when the agent has failed upgrade state.\r\n\r\n<img width=\"653\" alt=\"image\"\r\nsrc=\"50061732
-aa92-495b-b683-4d96114a1d5a\">\r\n\r\nExisting copy when there is no upgrade details (stuck in updating for\r\nmore than 2 hours):\r\n<img width=\"609\" alt=\"image\"\r\nsrc=\"14413c4a
-ce51-49fa-a217-68993c4378fd\">\r\n\r\nAdjusted Agent list tooltip as well if upgrade details state is failed.\r\n\r\n<img width=\"513\" alt=\"image\"\r\nsrc=\"6836e02e
-2c30-4c0a-91ea-8baddb0ccf03\">\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"1f3d3eaaa703ddc470ebe3e2e6140cd068434f14","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.12.0","v8.13.0"],"number":173628,"url":"https://github.com/elastic/kibana/pull/173628","mergeCommit":{"message":"[Fleet] adding upgrade details UPG_FAILED check to stuck in updating (#173628)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/171419\r\n\r\nAdded upgrade details check to restart upgrade callout when agent is\r\nstuck in updating.\r\nChanged the copy slightly when the agent has failed upgrade state.\r\n\r\n<img width=\"653\" alt=\"image\"\r\nsrc=\"50061732
-aa92-495b-b683-4d96114a1d5a\">\r\n\r\nExisting copy when there is no upgrade details (stuck in updating for\r\nmore than 2 hours):\r\n<img width=\"609\" alt=\"image\"\r\nsrc=\"14413c4a
-ce51-49fa-a217-68993c4378fd\">\r\n\r\nAdjusted Agent list tooltip as well if upgrade details state is failed.\r\n\r\n<img width=\"513\" alt=\"image\"\r\nsrc=\"6836e02e
-2c30-4c0a-91ea-8baddb0ccf03\">\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"1f3d3eaaa703ddc470ebe3e2e6140cd068434f14"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173628","number":173628,"mergeCommit":{"message":"[Fleet] adding upgrade details UPG_FAILED check to stuck in updating (#173628)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/171419\r\n\r\nAdded upgrade details check to restart upgrade callout when agent is\r\nstuck in updating.\r\nChanged the copy slightly when the agent has failed upgrade state.\r\n\r\n<img width=\"653\" alt=\"image\"\r\nsrc=\"50061732
-aa92-495b-b683-4d96114a1d5a\">\r\n\r\nExisting copy when there is no upgrade details (stuck in updating for\r\nmore than 2 hours):\r\n<img width=\"609\" alt=\"image\"\r\nsrc=\"14413c4a
-ce51-49fa-a217-68993c4378fd\">\r\n\r\nAdjusted Agent list tooltip as well if upgrade details state is failed.\r\n\r\n<img width=\"513\" alt=\"image\"\r\nsrc=\"6836e02e
-2c30-4c0a-91ea-8baddb0ccf03\">\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"1f3d3eaaa703ddc470ebe3e2e6140cd068434f14"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
This commit is contained in:
parent
2a8afed857
commit
170a221708
6 changed files with 90 additions and 17 deletions
|
@ -61,10 +61,15 @@ export const AGENT_UPDATING_TIMEOUT_HOURS = 2;
|
|||
|
||||
export function isStuckInUpdating(agent: Agent): boolean {
|
||||
return (
|
||||
agent.status === 'updating' &&
|
||||
!!agent.upgrade_started_at &&
|
||||
!agent.upgraded_at &&
|
||||
Date.now() - Date.parse(agent.upgrade_started_at) >
|
||||
AGENT_UPDATING_TIMEOUT_HOURS * 60 * 60 * 1000
|
||||
(agent.status !== 'offline' && agent.active && isAgentInFailedUpgradeState(agent)) ||
|
||||
(agent.status === 'updating' &&
|
||||
!!agent.upgrade_started_at &&
|
||||
!agent.upgraded_at &&
|
||||
Date.now() - Date.parse(agent.upgrade_started_at) >
|
||||
AGENT_UPDATING_TIMEOUT_HOURS * 60 * 60 * 1000)
|
||||
);
|
||||
}
|
||||
|
||||
export function isAgentInFailedUpgradeState(agent: Agent): boolean {
|
||||
return agent.upgrade_details?.state === 'UPG_FAILED';
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ describe('AgentHealth', () => {
|
|||
true
|
||||
);
|
||||
|
||||
utils.getByText('Agent may be stuck updating.');
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(utils.getByTestId('restartUpgradeBtn'));
|
||||
});
|
||||
|
@ -47,6 +49,56 @@ describe('AgentHealth', () => {
|
|||
utils.findByText('Upgrade Modal');
|
||||
});
|
||||
|
||||
it('should render agent health with callout when agent has upgrade state failed', () => {
|
||||
const { utils } = renderAgentHealth(
|
||||
{
|
||||
active: true,
|
||||
status: 'online',
|
||||
upgrade_started_at: '2022-11-21T12:27:24Z',
|
||||
upgrade_details: {
|
||||
state: 'UPG_FAILED',
|
||||
},
|
||||
} as any,
|
||||
true
|
||||
);
|
||||
|
||||
utils.getByText('Agent upgrade is stuck in failed state.');
|
||||
|
||||
utils.getByTestId('restartUpgradeBtn');
|
||||
});
|
||||
|
||||
it('should not render agent health with callout when agent has upgrade state failed but offline', () => {
|
||||
const { utils } = renderAgentHealth(
|
||||
{
|
||||
active: true,
|
||||
status: 'offline',
|
||||
upgrade_started_at: '2022-11-21T12:27:24Z',
|
||||
upgrade_details: {
|
||||
state: 'UPG_FAILED',
|
||||
},
|
||||
} as any,
|
||||
true
|
||||
);
|
||||
|
||||
expect(utils.queryByTestId('restartUpgradeBtn')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render agent health with callout when agent has upgrade state failed but inactive', () => {
|
||||
const { utils } = renderAgentHealth(
|
||||
{
|
||||
active: false,
|
||||
status: 'unenrolled',
|
||||
upgrade_started_at: '2022-11-21T12:27:24Z',
|
||||
upgrade_details: {
|
||||
state: 'UPG_FAILED',
|
||||
},
|
||||
} as any,
|
||||
true
|
||||
);
|
||||
|
||||
expect(utils.queryByTestId('restartUpgradeBtn')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render agent health with callout when agent not stuck updating', () => {
|
||||
const { utils } = renderAgentHealth(
|
||||
{
|
||||
|
@ -58,6 +110,7 @@ describe('AgentHealth', () => {
|
|||
);
|
||||
|
||||
expect(utils.queryByTestId('restartUpgradeBtn')).not.toBeInTheDocument();
|
||||
expect(utils.queryByText('Agent may be stuck updating.')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render agent health with callout when not from details', () => {
|
||||
|
|
|
@ -23,6 +23,7 @@ import { euiLightVars as euiVars } from '@kbn/ui-theme';
|
|||
|
||||
import {
|
||||
getPreviousAgentStatusForOfflineAgents,
|
||||
isAgentInFailedUpgradeState,
|
||||
isStuckInUpdating,
|
||||
} from '../../../../../../common/services/agent_status';
|
||||
|
||||
|
@ -152,12 +153,19 @@ export const AgentHealth: React.FunctionComponent<Props> = ({ agent, fromDetails
|
|||
<p>{lastCheckinText}</p>
|
||||
<p>{lastCheckInMessageText}</p>
|
||||
{isStuckInUpdating(agent) ? (
|
||||
<p>
|
||||
isAgentInFailedUpgradeState(agent) ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.restartUpgradeTooltipText"
|
||||
defaultMessage="Agent may be stuck updating. Consider restarting the upgrade."
|
||||
id="xpack.fleet.agentHealth.failedUpgradeTooltipText"
|
||||
defaultMessage="Agent upgrade failed. Consider restarting the upgrade."
|
||||
/>
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.restartUpgradeTooltipText"
|
||||
defaultMessage="Agent may be stuck updating. Consider restarting the upgrade."
|
||||
/>
|
||||
</p>
|
||||
)
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
|
@ -183,17 +191,27 @@ export const AgentHealth: React.FunctionComponent<Props> = ({ agent, fromDetails
|
|||
size="m"
|
||||
color="warning"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.stuckUpdatingTitle"
|
||||
defaultMessage="Agent may be stuck updating."
|
||||
/>
|
||||
isAgentInFailedUpgradeState(agent) ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.failedUpgradeTitle"
|
||||
defaultMessage="Agent upgrade is stuck in failed state."
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.stuckUpdatingTitle"
|
||||
defaultMessage="Agent may be stuck updating."
|
||||
/>
|
||||
)
|
||||
}
|
||||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentHealth.stuckUpdatingText"
|
||||
defaultMessage="Agent has been updating for a while, and may be stuck. Consider restarting the upgrade. {learnMore}"
|
||||
defaultMessage="{stuckMessage} Consider restarting the upgrade. {learnMore}"
|
||||
values={{
|
||||
stuckMessage: isAgentInFailedUpgradeState(agent)
|
||||
? 'Agent upgrade failed.'
|
||||
: 'Agent has been updating for a while, and may be stuck.',
|
||||
learnMore: (
|
||||
<div>
|
||||
<EuiLink href={docLinks.links.fleet.upgradeElasticAgent} target="_blank">
|
||||
|
|
|
@ -16716,7 +16716,6 @@
|
|||
"xpack.fleet.agentFlyout.standaloneRadioOption": "{standaloneMessage} – Exécutez un agent Elastic Agent de façon autonome pour le configurer et le mettre à jour manuellement sur l'hôte sur lequel il est installé.",
|
||||
"xpack.fleet.agentHealth.checkinMessageText": "Dernier message de vérification : {lastCheckinMessage}",
|
||||
"xpack.fleet.agentHealth.checkInTooltipText": "Dernier archivage le {lastCheckIn}",
|
||||
"xpack.fleet.agentHealth.stuckUpdatingText": "L'agent effectue la mise à jour depuis un certain temps ; il est peut-être bloqué. Envisagez de redémarrer la mise à niveau. {learnMore}",
|
||||
"xpack.fleet.agentList.noFilteredAgentsPrompt": "Aucun agent trouvé. {clearFiltersLink}",
|
||||
"xpack.fleet.agentLogs.logDisabledCallOutDescription": "Mettez à jour la politique de l'agent {settingsLink} pour activer la collecte de logs.",
|
||||
"xpack.fleet.agentLogs.oldAgentWarningTitle": "La vue Logs requiert Elastic Agent 7.11 ou une version ultérieure. Pour mettre à niveau un agent, accédez au menu Actions ou {downloadLink} une version plus récente.",
|
||||
|
|
|
@ -16729,7 +16729,6 @@
|
|||
"xpack.fleet.agentFlyout.standaloneRadioOption": "{standaloneMessage} – Elasticエージェントをスタンドアロンで実行して、エージェントがインストールされているホストで、手動でエージェントを構成および更新します。",
|
||||
"xpack.fleet.agentHealth.checkinMessageText": "前回のチェックインメッセージ:{lastCheckinMessage}",
|
||||
"xpack.fleet.agentHealth.checkInTooltipText": "前回確認日時:{lastCheckIn}",
|
||||
"xpack.fleet.agentHealth.stuckUpdatingText": "エージェントはしばらく更新が止まっている可能性があります。アップグレードの再開を検討してください。{learnMore}",
|
||||
"xpack.fleet.agentList.noFilteredAgentsPrompt": "エージェントが見つかりません。{clearFiltersLink}",
|
||||
"xpack.fleet.agentLogs.logDisabledCallOutDescription": "エージェントのポリシー{settingsLink}を更新して、ログ収集を有効にします。",
|
||||
"xpack.fleet.agentLogs.oldAgentWarningTitle": "ログの表示には、Elastic Agent 7.11以降が必要です。エージェントをアップグレードするには、[アクション]メニューに移動するか、新しいバージョンを{downloadLink}。",
|
||||
|
|
|
@ -16729,7 +16729,6 @@
|
|||
"xpack.fleet.agentFlyout.standaloneRadioOption": "{standaloneMessage} – 独立运行 Elastic 代理,以在安装代理的主机上手动配置和更新代理。",
|
||||
"xpack.fleet.agentHealth.checkinMessageText": "上次签入消息:{lastCheckinMessage}",
|
||||
"xpack.fleet.agentHealth.checkInTooltipText": "上次签入时间 {lastCheckIn}",
|
||||
"xpack.fleet.agentHealth.stuckUpdatingText": "代理已更新一段时间,并可能陷入停滞。请考虑重新开始升级。{learnMore}",
|
||||
"xpack.fleet.agentList.noFilteredAgentsPrompt": "找不到代理。{clearFiltersLink}",
|
||||
"xpack.fleet.agentLogs.logDisabledCallOutDescription": "更新代理的策略 {settingsLink} 以启用日志收集。",
|
||||
"xpack.fleet.agentLogs.oldAgentWarningTitle": "“日志”视图需要 Elastic Agent 7.11 或更高版本。要升级代理,请前往“操作”菜单或{downloadLink}更新的版本。",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue