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

[Elastic Agent] Retry deamon reload during enroll #25590

Merged
merged 8 commits into from
May 14, 2021

Conversation

michalpristas
Copy link
Contributor

What does this PR do?

Adds retry for daemon reload

Why is it important?

elastic/fleet-server#297

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@michalpristas michalpristas added bug needs_backport PR is waiting to be backported to other branches. Team:Elastic-Agent Label for the Agent team labels May 6, 2021
@michalpristas michalpristas self-assigned this May 6, 2021
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 6, 2021
@michalpristas
Copy link
Contributor Author

/package

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 6, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #25590 updated

  • Start Time: 2021-05-13T14:57:06.930+0000

  • Duration: 93 min 58 sec

  • Commit: d3167a5

Test stats 🧪

Test Results
Failed 0
Passed 6892
Skipped 16
Total 6908

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 6892
Skipped 16
Total 6908

@michalpristas
Copy link
Contributor Author

/package

@michalpristas michalpristas marked this pull request as ready for review May 10, 2021 12:16
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@ph
Copy link
Contributor

ph commented May 11, 2021

@blakerouse Can you review this, @michalpristas I've moved to the right board :)


for i := 5; i >= 0; i-- {
retry := false
if errors.Is(err, fleetapi.ErrTooManyRequests) {
Copy link
Contributor

Choose a reason for hiding this comment

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

These errors don't seem to apply to daemon reloading.

func (c *enrollCmd) daemonReloadWithBackoff(ctx context.Context) error {
err := c.daemonReload(ctx)
signal := make(chan struct{})
backExp := backoff.NewExpBackoff(signal, 60*time.Second, 10*time.Minute)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we start with lower amounts? This seems rather large initial wait. Maybe lets do like 10 seconds to maximum of 1 minute?

This is a local daemon it should be quick to connect and communicate.

@@ -323,6 +323,24 @@ func (c *enrollCmd) prepareFleetTLS() error {
return nil
}

func (c *enrollCmd) daemonReloadWithBackoff(ctx context.Context) error {
err := c.daemonReload(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

If no error here then no reason to continue. Just return as it has been reloaded.

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.

Looks good. Thanks for the fixes.

@michalpristas michalpristas merged commit c45d0db into elastic:master May 14, 2021
michalpristas added a commit to michalpristas/beats that referenced this pull request May 14, 2021
[Elastic Agent] Retry deamon reload during enroll (elastic#25590)
michalpristas added a commit to michalpristas/beats that referenced this pull request May 14, 2021
[Elastic Agent] Retry deamon reload during enroll (elastic#25590)
michalpristas added a commit that referenced this pull request May 14, 2021
[Elastic Agent] Retry deamon reload during enroll (#25590)
michalpristas added a commit that referenced this pull request May 14, 2021
Cherry-pick #25590 to 7.x: Retry deamon reload during enroll (#25719)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs_backport PR is waiting to be backported to other branches. Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants