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

Fix: select default agent policy if no enrollment token provided #23973

Merged
merged 3 commits into from
Feb 11, 2021

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Feb 10, 2021

What does this PR do?

This PR fixes the non-determinism in agent's policy selection. With this bugfix, the agent will always enroll using the default policy unless the custom enrollment token is selected.

Why is it important?

Currently the enrollment script (Docker) selects the newest policy. It may happen that the selected policy is not active or it is not intended to be used.

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.

Author's Checklist

  • [ ]

How to test this PR locally

  1. Create new custom policy in the Kibana UI.
  2. Start new Docker container with Elastic Agent, don't provide the enrollment token.

Expected:
3. Elastic Agent should be started with Default policy, not the newest one (just added).

Related issues

Use cases

Screenshots

Logs

@mtojek mtojek self-assigned this Feb 10, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 10, 2021
@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 10, 2021
@mtojek mtojek added the Team:Elastic-Agent Label for the Agent team label Feb 10, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 10, 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: mtojek commented: /test

  • Start Time: 2021-02-11T11:39:12.660+0000

  • Duration: 121 min 55 sec

  • Commit: e181b1c

Test stats 🧪

Test Results
Failed 0
Passed 45794
Skipped 4762
Total 50556

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 45794
Skipped 4762
Total 50556

Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

LGTM

@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

jenkins run the tests please

@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

/test

2 similar comments
@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

/test

@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

/test

@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

Errors seem to be unrelated.

@mtojek mtojek merged commit e3da3be into elastic:master Feb 11, 2021
@mtojek mtojek added the v7.12.0 label Feb 11, 2021
mtojek added a commit to mtojek/beats that referenced this pull request Feb 11, 2021
…stic#23973)

* Fix: select default agent policy if no enrollment token provided

* Update CHANGELOG

(cherry picked from commit e3da3be)
mtojek added a commit that referenced this pull request Feb 15, 2021
) (#24001)

* Fix: select default agent policy if no enrollment token provided

* Update CHANGELOG

(cherry picked from commit e3da3be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team v7.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants