-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Ingest Manager] Upgrade Agents in Fleet #78810
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
Conversation
d975ffe to
156e02f
Compare
|
works ok with elastic/beats#21372 what in case of error should agent ack the action? if it's not acked will it be resend indefinitely? |
...c/applications/ingest_manager/sections/fleet/agent_details_page/components/agent_details.tsx
Outdated
Show resolved
Hide resolved
|
correctly detects snapshot, visualisation of non snapshot commented in the code |
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.
What do you think about changing this to env? It seems similar to what we have in config.
useKibanaVersion could be updated to read the EnvContext and other hooks/functions could get branch, or dev vs prod, etc if/when it comes up.
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.
Sounds good to me. I didn't put it in IngestManagerConfigType just because those are from the config file, so I think like you said something like "env" sounds good. I opened a follow up issue #79483
x-pack/plugins/ingest_manager/common/services/is_agent_upgradeable.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/ingest_manager/common/services/is_agent_upgradeable.ts
Outdated
Show resolved
Hide resolved
|
|
|
After suggested changes (i did them manually) i started agent without starting a file server so UPDATE fails i got this (as expected) UPDATE is ACK-ed and Error there is reported, under ACK there is line saying STATE was switched to UPDATING after i started server and rekicked UPDATE action update was ACKed and state switched to RUNNING after it finished. Status on list page was |
8839ccc to
76b2ba6
Compare
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
| }); | ||
| // filtering for a range on the version string will not work, | ||
| // nor does filtering on a flattened field (local_metadata), so filter here | ||
| if (showUpgradeable) { |
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.
this is not ideal, but i decided to filter on the results of the soClient.find(). As we discussed earlier I was unable to filter through the flattened field local_metadata and even if I could I still need to use semver to compare local_metadata.elastic.agent.version which is a string so I could not do a range comparison in KQL. @jen-huang @nchaulet
nchaulet
left a comment
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 🚀 tested with API calls (not a real agent but work as expected)
|
Tested ok today with elastic/beats#21461 |
|
@elasticmachine merge upstream |
* add kibanaVersion context and hook, add upgrade available indications * add agent upgrade modals and action buttons * fix import * add bulk actions api and remove source_uri as required * add upgrading to AgentHealth status * buildKueryForUpgradingAgents * bulk actions UI * remove source_uri * add release type to agent details * don't allow upgrade of unenrolled/unenrolling agent * hide upgradeable button when not upgradeable * fix test * add udpating agent status * remove upgrade available filter button for now * update isUpgradeAvailable to use local_metadata upgradeable * add UPDATING to agent event subtype * use saved object for updating agent status * add updating badge type label * add upgrade available button and update agent list endpoint to accept showUpgradeable * add schema and type for UPDATING * fix type * dont try to upgrade local_metadata * exclude from AAD upgrade_started_at and upgraded_at Co-authored-by: Kibana Machine <[email protected]>
* add kibanaVersion context and hook, add upgrade available indications * add agent upgrade modals and action buttons * fix import * add bulk actions api and remove source_uri as required * add upgrading to AgentHealth status * buildKueryForUpgradingAgents * bulk actions UI * remove source_uri * add release type to agent details * don't allow upgrade of unenrolled/unenrolling agent * hide upgradeable button when not upgradeable * fix test * add udpating agent status * remove upgrade available filter button for now * update isUpgradeAvailable to use local_metadata upgradeable * add UPDATING to agent event subtype * use saved object for updating agent status * add updating badge type label * add upgrade available button and update agent list endpoint to accept showUpgradeable * add schema and type for UPDATING * fix type * dont try to upgrade local_metadata * exclude from AAD upgrade_started_at and upgraded_at Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
distributable file count
miscellaneous assets size
page load bundle size
Saved Objects .kibana field count
History
To update your PR or re-run it, just comment with: |


Resolves #78469
Summary
Adds the ability to upgrade agents in the Fleet UI
Changes
POST /api/ingest_manager/fleet/agents/bulk_upgradeendpoint which expects payload:Agent should not upgrade agents that are currently unenrolled or unenrolling.
Update
GET api/ingest_manager/fleet/agentsendpoint to acceptshowUpgradeableoption. This will filter for agents that are less than this kibana version withlocal_metadata.elastic.agent.upgradeable: trueAgent Details page now reports release based on
local_metadata.elastic.agents.snapshotbeing true/false. For older Agent versions that do not send this data, the value will be '-'. The snapshot version cannot be tested until we have a snapshot with this functionality.Agent Details screenshot
Agent Details for upgradeable agent
Agent Detail for non upgradeable agent
Agent List non upgradeable action menu
Agent List upgradeable action menu
Agent List bulk upgrade
Agent List filter upgradeable
This will filter for agents that are less than this kibana version with `local_metadata.elastic.agent.upgradeable: true`Agent List when upgrading
Testing
To test the upgrade flow through Kibana UI (agent gets the download file and no source_uri is provided to the api), follow these steps:
beats/x-pack/elastic-agentDEV=true PLATFORMS=darwin mage packagemkdir -p ~/server/beats/elastic-agentand copy the built files therecp build/distributions/*tar* ~/server/beats/elastic-agentcd ~/server/beats/elastic-agentand start the serverpython3 -m http.serverbeats/x-pack/elastic-agentvi ../../libbeat/version/version.goand change version to 7.9.0DEV=true PLATFORMS=darwin mage packageagainbuilds/distribution/elastic-agentand unpack the 7.9 *.tar.gzelastic-agent.ymland uncomment and update sourceUri to where the server is running and saveTo simulate testing with the
source_uri, see testing steps in this PR:elastic/beats#21002