Skip to content

Fix discovery of Nomad allocations#28700

Merged
jsoriano merged 3 commits intoelastic:masterfrom
jsoriano:nomad-watcher-fix-allocation-update
Nov 22, 2021
Merged

Fix discovery of Nomad allocations#28700
jsoriano merged 3 commits intoelastic:masterfrom
jsoriano:nomad-watcher-fix-allocation-update

Conversation

@jsoriano
Copy link
Copy Markdown
Member

@jsoriano jsoriano commented Oct 28, 2021

What does this PR do?

Fixes issues with the discovery of Nomad allocations.

Nomad keeps track of changes in its resources using sequential "indexes", each resource has an index that indicates when it was updated.

Autodiscover watcher works by polling, on each iteration it keeps track of the last index used for all resources. On each iteration, events with older indexes are ignored.
When discovering allocations, it was using the allocation index, that doesn't seem to be updated every time the allocation is modified. Modification index is used now.

Detailed investigation of the issue can be found in #27035, thanks to @zemm.

Why is it important?

In some cases there can be multiple events during the startup of Nomad allocations. These updates were being ignored, so the allocation was not discovered, missing events.

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.

How to test this PR locally

Related issues

@jsoriano jsoriano added bug Team:Integrations Label for the Integrations team backport-v8.0.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify labels Oct 28, 2021
@jsoriano jsoriano self-assigned this Oct 28, 2021
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/integrations (Team:Integrations)

@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 Oct 28, 2021
In some cases there can be multiple events during the startup of Nomad
allocations. These updates were being ignored, so the allocation was not
discovered, missing events.
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Oct 28, 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 preview

Expand to view the summary

Build stats

  • Start Time: 2021-11-22T16:03:02.316+0000

  • Duration: 87 min 53 sec

  • Commit: bd1e4b4

Test stats 🧪

Test Results
Failed 0
Passed 19449
Skipped 594
Total 20043

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Nov 2, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b nomad-watcher-fix-allocation-update upstream/nomad-watcher-fix-allocation-update
git merge upstream/master
git push upstream nomad-watcher-fix-allocation-update

@jsoriano jsoriano merged commit 389da94 into elastic:master Nov 22, 2021
@jsoriano jsoriano deleted the nomad-watcher-fix-allocation-update branch November 22, 2021 17:39
mergify bot pushed a commit that referenced this pull request Nov 22, 2021
In some cases there can be multiple events during the startup of Nomad
allocations. These updates were being ignored, so the allocation was not
discovered, missing events.

(cherry picked from commit 389da94)
mergify bot pushed a commit that referenced this pull request Nov 22, 2021
In some cases there can be multiple events during the startup of Nomad
allocations. These updates were being ignored, so the allocation was not
discovered, missing events.

(cherry picked from commit 389da94)
v1v added a commit to v1v/beats that referenced this pull request Nov 22, 2021
…ws-on-file-changes

* upstream/master:
  Fix discovery of Nomad allocations (elastic#28700)
  Add null (`\u0000`) as a valid line terminator (elastic#28998)
  Remove `logging.files.suffix` option and always use datetime suffixes (elastic#28927)
  x-pack/filebeat/module: add note for default var.input (elastic#28324)
  Fix AccessList & AccessMask processing in security data_stream (elastic#29016)
  [Metricbeat] Fix wrong mapping on "info" subkey (elastic#28782)
  ci: daily/weekly jobs (elastic#29050)
  [mergify] report open backported PRs once a week (elastic#28964)
jsoriano added a commit that referenced this pull request Nov 23, 2021
In some cases there can be multiple events during the startup of Nomad
allocations. These updates were being ignored, so the allocation was not
discovered, missing events.

(cherry picked from commit 389da94)

Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
jsoriano added a commit that referenced this pull request Nov 23, 2021
In some cases there can be multiple events during the startup of Nomad
allocations. These updates were being ignored, so the allocation was not
discovered, missing events.

(cherry picked from commit 389da94)

Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v7.16.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify bug Team:Integrations Label for the Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nomad autodiscover fails to pick up some tasks

3 participants