Skip to content
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] Allow to reassign agent to a new config #63847

Merged

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Apr 17, 2020

Summary

Resolves #63021

This PR allow a fleet user to assign an already enrolled agent to a new configuration.

Done in this PR

  • UI Create a new flyout to reassign an agent
  • Create a new API to reassign an agent
  • Updated unenroll API to not support bulk operations

UI Changes

Screen Shot 2020-04-17 at 9 19 31 AM

2020-04-17 09-17-38 2020-04-17 09_19_03

Screen Shot 2020-04-21 at 4 02 11 PM

Screen Shot 2020-04-21 at 4 02 00 PM

API Change

Create a new route similar to the one used for unenrolling agent

POST /api/ingest_manager/fleet/agents/{agentId}reassign
{
  "config_id": "25f8b9f0-7fe4-11ea-b993-1723d0399bd5"
}

// Response 
{
  "success": true
}

@nchaulet nchaulet added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.8.0 Team:Fleet Team label for Observability Data Collection Fleet team labels Apr 17, 2020
@nchaulet nchaulet self-assigned this Apr 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@nchaulet nchaulet marked this pull request as ready for review April 17, 2020 14:03
@nchaulet nchaulet requested a review from a team April 17, 2020 14:03
@ruflin
Copy link
Contributor

ruflin commented Apr 20, 2020

Lets focus this for now on just reassigning a single agent to a new config. This will make also error handling easier so we don't have to think about what if 2 out of 4 reassignements worked?

@nchaulet
Copy link
Member Author

Updated the API to not support bulk operations.

@nchaulet nchaulet requested review from jen-huang and neptunian April 21, 2020 19:58
@neptunian
Copy link
Contributor

neptunian commented Apr 22, 2020

Testing this locally. When I reassign my agent to a new config I get this error in the console where the agent is running:

Screen Shot 2020-04-22 at 11 20 38 AM

Is this expected?

@nchaulet
Copy link
Member Author

@neptunian no the error is not expected, just tested locally it's working fine for me, how do you get the error?

@nchaulet nchaulet requested a review from neptunian April 22, 2020 17:17
@nchaulet
Copy link
Member Author

@elasticmachine merge upstream

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

When the reassignment flyout is open on the agent list page with many agents, the context of which agent is being reassigned gets lost since we don't have a visual indicator of which agent is selected (when it was a bulk action, the indicator is selected rows, but we are not doing bulk at the moment). Maybe we can include the selected agent host as part of the flyout info. @hbharding could you suggest a design for this? (Not a blocker for this PR; enhancement can be done in follow up PR.)

I have some other small copy suggestions below, otherwise tested locally and LGTM 👍

@jen-huang
Copy link
Contributor

Btw I also see the same errors in agent sdout that @neptunian saw:

2020-04-22T10:52:42-07:00 DEBUG	action_dispatcher.go:96	Successfully dispatched action: 'action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE'
2020-04-22T10:52:42-07:00 DEBUG	client.go:170	Request method: POST, path: /api/ingest_manager/fleet/agents/0b78c480-84c1-11ea-9a94-79f7dbd8dc26/acks
2020-04-22T10:52:42-07:00 ERROR	fleet_gateway.go:143	failed to dispatch actions, error: acknowledge 132 actions '[action_id: 256098e0-8427-11ea-b57d-d145f25d3ece, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26, type: CONFIG_CHANGE action_id: 15396920-84c1-11ea-9a94-79f7dbd8dc26,
...

I think I have seen the above ^ outside of this PR, though.

I also have a bunch of errors like this:

2020-04-22T10:53:28-07:00 ERROR	fleet_gateway.go:162	Could not communicate with Checking API will retry, error: Status code: 500, Kibana returned an error: Internal Server Error, message: Unexpected token o in JSON at position 1
	Status code: 500, Kibana returned an error: Internal Server Error, message: Unexpected token o in JSON at position 1
2020-04-22T10:53:37-07:00 DEBUG	client.go:170	Request method: POST, path: /api/ingest_manager/fleet/agents/0b78c480-84c1-11ea-9a94-79f7dbd8dc26/checkin

The only thing I did was rapidly reassign an agent between two configs.

@nchaulet
Copy link
Member Author

@jen-huang did you re-enroll multiple time an agent from the same folder? if yes it's probably related to this error elastic/beats#17389

Co-Authored-By: Jen Huang <its.jenetic@gmail.com>
@jen-huang
Copy link
Contributor

Interesting, that may be the case. Thanks for the link.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nchaulet nchaulet merged commit 7eab5d2 into elastic:master Apr 22, 2020
@nchaulet nchaulet deleted the feature-fleet-support-config-reassignment branch April 22, 2020 20:26
nchaulet added a commit to nchaulet/kibana that referenced this pull request Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Allow to reassign agent configuration to agents
6 participants