Skip to content

Agent should attempt a POLICY_CHANGE action before checking in #10130

@michel-laterman

Description

@michel-laterman

The current action handling behaviour dispatches actions completely asynchrously from the checkin-loop:

case <-f.scheduler.WaitTick():
f.log.Debug("FleetGateway calling Checkin API")
// Execute the checkin call and for any errors returned by the fleet-server API
// the function will retry to communicate with fleet-server with an exponential delay and some
// jitter to help better distribute the load from a fleet of agents.
resp, err := f.doExecute(ctx, requestBackoff)
if err != nil {
continue
}
actions := make([]fleetapi.Action, len(resp.Actions))
copy(actions, resp.Actions)
if len(actions) > 0 {
f.actionCh <- actions
}

After fleet checkin, the agent sends all actions through a channel to the dispatcher. They are executed concurrently with the checkin loop; the ticker by default has a 1s duration with up to 500ms jitter.
There is no guarantee that the POLICY_CHANGE action is executed before the next checkin.

We should adjust this to attempt to run a POLICY_CHANGE action before the next checkin is sent.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions