-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Ingest Manager] Upgrade Agents in Fleet #78810
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
Show resolved
Hide resolved
correctly detects snapshot, visualisation of non snapshot commented in the code |
@@ -60,13 +60,16 @@ export class IngestManagerPlugin | |||
implements | |||
Plugin<IngestManagerSetup, IngestManagerStart, IngestManagerSetupDeps, IngestManagerStartDeps> { | |||
private config: IngestManagerConfigType; | |||
private kibanaVersion: string; |
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
|
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) |
type: AGENT_SAVED_OBJECT_TYPE, | ||
filter: _joinFilters(filters), | ||
sortField, | ||
sortOrder, | ||
page, | ||
perPage, | ||
}); | ||
// 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
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 <42973632+kibanamachine@users.noreply.github.com>
* 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 <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 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_upgrade
endpoint which expects payload:Agent should not upgrade agents that are currently unenrolled or unenrolling.
Update
GET api/ingest_manager/fleet/agents
endpoint to acceptshowUpgradeable
option. This will filter for agents that are less than this kibana version withlocal_metadata.elastic.agent.upgradeable: true
Agent Details page now reports release based on
local_metadata.elastic.agents.snapshot
being 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
upgradeable action menuAgent 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
After a few seconds, Agent should turn green and version should be updated. Upgrade Available indication should be gone.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-agent
DEV=true PLATFORMS=darwin mage package
mkdir -p ~/server/beats/elastic-agent
and copy the built files therecp build/distributions/*tar* ~/server/beats/elastic-agent
cd ~/server/beats/elastic-agent
and start the serverpython3 -m http.server
beats/x-pack/elastic-agent
vi ../../libbeat/version/version.go
and change version to 7.9.0DEV=true PLATFORMS=darwin mage package
againbuilds/distribution/elastic-agent
and unpack the 7.9 *.tar.gzelastic-agent.yml
and 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