-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Fleet] Display message explaining why agent is not upgradeable #173253
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
/ci |
@elasticmachine merge upstream |
/ci |
Pinging @elastic/fleet (Team:Fleet) |
describe('Fleet - getNotUpgradeableMessage', () => { | ||
it('if agent reports not upgradeable with agent version < latest agent version', () => { | ||
expect(getNotUpgradeableMessage(getAgent({ version: '7.9.0' }), '8.0.0')).toBe( | ||
'agent is marked as not upgradeable in elastic-agent.' |
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.
'agent is marked as not upgradeable in elastic-agent.' | |
'agent cannot be upgraded through Fleet. It may be running in a container.' |
cc @cmacknz - Any input on this particular message? I feel we don't want to surface something as technical as the supervisor process/PID 1 details here, but something explicit would be helpful until we get a more granular reason from #173281. Tried to borrow some wording from https://www.elastic.co/guide/en/fleet/current/elastic-agent-container.html#_what_you_need.
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.
My suggestion would be something like "It may be running in a container or is not installed as a service".
That second scenario is the case where someone has just executed ./elastic-agent.exe
directly out of the installation directory.
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/fleet/common/services/is_agent_upgradeable.test.ts
Outdated
Show resolved
Hide resolved
@kpollich thanks for the review, I'm going to update the messages and I'll also add a tooltip since it's a very easy change. We already have a tooltip on the version numbers of the agent list, we just need to reuse the same function. |
Perfect, @criamico thank you! |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
if (getRecentUpgradeInfoForAgent(agent).hasBeenUpgradedRecently) { | ||
const timeToWaitMins = getRecentUpgradeInfoForAgent(agent).timeToWaitMins; | ||
const elapsedMinsSinceUpgrade = getRecentUpgradeInfoForAgent(agent).elapsedMinsSinceUpgrade; | ||
// const upgradeStarted = moment().subtract(AGENT_UPGRADE_COOLDOWN_IN_MIN - timeToWaitMins).minutes(); |
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.
nit: comment should be removed
<em> | ||
<FormattedMessage | ||
id="xpack.fleet.upgradeAgents.upgradeSingleTimeout" | ||
// TODO: Add link to docs regarding agent upgrade cooldowns |
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.
do we have an issue for this in ingest-docs?
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.
Not sure, the comment was already there, I tried to find docs for it but couldn't. I can open an issue for it
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.
LGTM 🚀
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @criamico |
Fixes #173370 Closes #171941 ## Summary Show a warning when download upgrade is failing. This PR addresses a specific case of `upgrade downloading`: when the upgrade started but it's failing with an error. In this case, since 8.12, the agent metadata have a `retry_msg` that can be used to distinguish this case from the regular upgrade. I'm also fixing one smaller bug that I introduced with #173253, the tooltip shown in the case when the agent is not upgradeable was hiding the badge, so I'm moving the if as the last one in the function. ## Testing - Have an 8.12 agent installed with Multipass (it needs to be upgradeable) - Change the download binary url to something broken: `sourceURI: https://artifacts.elastic.co/notdownloads/` - Force upgrade from dev tools: ``` POST kbn:/api/fleet/agents/c3f09103-4e69-4a36-bee2-84223bedef36/upgrade { "version": "8.12.0", "force": true } ``` - Go to agent overview, the badge will show "upgrading" but will also have a warning icon with a tooltip, showing the retry message and the `retry_until` time in humanized format (retry until...remaining): ![Screenshot 2024-01-02 at 16 54 20](https://github.com/elastic/kibana/assets/16084106/ac340e7d-5151-4e4e-b6a6-731a113ff984) This way the message shows the values present in the agent metadata. - Same is reported in the agent list table: ![Screenshot 2024-01-02 at 16 54 28](https://github.com/elastic/kibana/assets/16084106/1f8823c4-9e5c-4f4c-9cdc-2839b16214bb) - After a while the retries will be finished and the agent will show the regular "upgrade failed" badge (this was already implemented): ![Screenshot 2023-12-21 at 12 07 27](https://github.com/elastic/kibana/assets/16084106/c1d5bf67-a4fd-4b04-aa8d-24dc8d4af54e) ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Closes #171840
Also implements the UI part of #173281
Summary
When trying to upgrade a single agent that is not upgradeable, the error message doesn't specify why the agent cannot be upgraded. This PR is introducing:
POST agent/{agent_id}/upgrade
. The messages are now different depending on which conditions are met. For the case when the agent is reported not upgradeable from elastic agent, there is now an error message the states it explicitly.upgrade 1 agent
from the bulk actions, if the agent is not upgradeable the submit button is now greyed out and a message explaining the reason is shown:The same warning appears when clicking on other upgrade actions in the bulk action menu, but only for a single agent. Multiple upgrades have not been changed.
Checklist