-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Replace INTERNAL_POLICY_REASSIGN by POLICY_REASSIGN #94116
[Fleet] Replace INTERNAL_POLICY_REASSIGN by POLICY_REASSIGN #94116
Conversation
Pinging @elastic/fleet (Team:Fleet) |
…nal-policy-reassign
…nal-policy-reassign
@elasticmachine merge upstream |
@@ -261,25 +261,6 @@ export function agentCheckinStateNewActionsFactory() { | |||
return EMPTY; | |||
} | |||
|
|||
const hasConfigReassign = newActions.some( |
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.
Can you help me understand why this is no longer needed?
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.
Sure, previously we were relying on Kibana to handle an action INTERNAL_POLICY_REASSIGN
and transform this to a POLICY_CHANGE
action so the agent get the new policy.
With the move to fleet server we are going to simplify that, we are introducting a new action POLICY_REASSIGN
that will be send to the agent, then the agent will handle that, then checkin again and get the new POLICY_CHANGE
action.
Does it make things clearer?
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @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.
I tested reassigning agents to another policy locally and it seems to have worked as expected, I confirmed that corresponding fleet-agent-actions
SO that is created has "type": "POLICY_REASSIGN"
. I have a question regarding need for migration, but otherwise code LGTM.
@@ -36,8 +36,7 @@ export type AgentActionType = | |||
| 'UNENROLL' | |||
| 'UPGRADE' | |||
| 'SETTINGS' | |||
// INTERNAL* actions are mean to interupt long polling calls these actions will not be distributed to the agent | |||
| 'INTERNAL_POLICY_REASSIGN'; | |||
| 'POLICY_REASSIGN'; |
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 you think we would need to add a migration script for existing fleet-agent-actions
SOs to transform INTERNAL_POLICY_REASSIGN
to POLICY_REASSIGN
?
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.
I think it's okay actions are not mean to stay for a long time, so I guess we are okay moreover with the move to fleet server we should start from a fresh ground and do not have any agent already enrolled.
@@ -36,8 +36,7 @@ export type AgentActionType = | |||
| 'UNENROLL' | |||
| 'UPGRADE' | |||
| 'SETTINGS' | |||
// INTERNAL* actions are mean to interupt long polling calls these actions will not be distributed to the agent | |||
| 'INTERNAL_POLICY_REASSIGN'; | |||
| 'POLICY_REASSIGN'; |
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.
I forgot to mention, do we have any integration tests for these agent actions that would need to get updated to cover this?
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.
it's well covered by the e2e tests
…95406) Co-authored-by: Nicolas Chaulet <[email protected]>
Resolve elastic/fleet-server#84 |
Context
The way we reassign an agent to a new policy is a little different than other fleet actions:
we update the agent doc
INTERNAL_POLICY_REASSIGN
that is handler in kibana checkin to refresh the agent and send a new policy to the agentPOLICY_REASSIGN
action that will be sent to the agentwe update the agent doc
POLICY_REASSIGN
action to the agentHow to test
Without fleet server
With Fleet server it's still a little hard to setup Fleet server and there is a few bugs currently, I think there is not major difference here that need a test with Fleet Server.