Skip to content

Conversation

@michalpristas
Copy link
Contributor

@michalpristas michalpristas commented Oct 2, 2025

In a context of agent migration.

When agent is migrated and still has some upgrade details or upgrade was triggered manually for some reason we should reflect that in UI.

This PR makes action optional and updates upgrade details anyways.

I'd like ACK handling of upgrade to be reworked, but ideally in a separate PR to lower risk as I'd like this one to be in 9.2

Fixes: #5564

@michalpristas michalpristas requested a review from cmacknz October 2, 2025 08:22
@michalpristas michalpristas self-assigned this Oct 2, 2025
@michalpristas michalpristas requested a review from a team as a code owner October 2, 2025 08:22
@michalpristas michalpristas added the bug Something isn't working label Oct 2, 2025
@michalpristas michalpristas added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-9.2 Automated backport to the 9.2 branch labels Oct 2, 2025
@prodsecmachine
Copy link

prodsecmachine commented Oct 2, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@michalpristas michalpristas changed the title Fix/migrate watching Make action optional when upgrade details are provided Oct 2, 2025
Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I am having trouble following how this PR works.

Does this fix the issue where if you check-in to a new cluster for the first time after migrate that it will reflect the upgrade state of that agent? If so, could you walk me through how this is done in this code.

@pchila pchila removed the request for review from pkoutsovasilis November 11, 2025 17:30
@cmacknz
Copy link
Member

cmacknz commented Nov 14, 2025

@michalpristas is this PR still relevant?

@michalpristas
Copy link
Contributor Author

Yes it is

Copy link
Contributor

@michel-laterman michel-laterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is doing a few things; the changes to allow for missing actions (in case of migrations) makes sense; however I don't understand why the ack endpoint is being changed, or why the status is not being set to nil if a checkin indicates an upgrade completes.

Also can you please add a changelog fragment

@michalpristas
Copy link
Contributor Author

code cleanup: moved updgrade status removal to a separate PR: #5970
now this change should be cleaner and more readable

if err != nil {

var actionTraceparent string
if action, err := ct.verifyActionExists(ctx, vSpan, agent, details); err == nil && action != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Kibana tolerate having an action ID it doesn't recognize as well?

I think passing through the upgrade details unmodified is correct, but we need to avoid Kibana now or in the future trying to do this same validation or making assumption about this field.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think passing through the upgrade details unmodified is correct

Well a possibility here would be removing the action_id if it doesn't exist so kibana can't depend on it, or putting some marker in the details about whether the action exists or not (though kibana can also just check this).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliaElastic any opinions on if sending upgrade_details to Kibana for action_ids that don't exist or are from another cluster is a problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fine to have an upgrade_details with a non existent action_id, the UI doesn't validate the action_id. The only difference I can think of is that these actions won't appear in Agent activity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions not in activity is fine imho. this should make reporting upgrades possible, during migration or triggered from CLI

Copy link
Contributor

@michel-laterman michel-laterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.2 Automated backport to the 9.2 branch bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ingored upgrade details after migration

6 participants