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

Cherry-pick #23973 to 7.x: Fix: select default agent policy if no enrollment token provided #24001

Merged
merged 2 commits into from
Feb 15, 2021

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Feb 11, 2021

Cherry-pick of PR #23973 to 7.x branch. Original message:

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

@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@elasticmachine
Copy link
Collaborator

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

@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 Feb 11, 2021
…stic#23973)

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

* Update CHANGELOG

(cherry picked from commit e3da3be)
@mtojek
Copy link
Contributor Author

mtojek commented Feb 11, 2021

/test

@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 11, 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 #24001 updated

  • Start Time: 2021-02-15T09:34:17.778+0000

  • Duration: 130 min 16 sec

  • Commit: 6810c9d

Test stats 🧪

Test Results
Failed 0
Passed 45744
Skipped 4799
Total 50543

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 45744
Skipped 4799
Total 50543

@mtojek
Copy link
Contributor Author

mtojek commented Feb 12, 2021

/packaging

1 similar comment
@mtojek
Copy link
Contributor Author

mtojek commented Feb 15, 2021

/packaging

@mtojek
Copy link
Contributor Author

mtojek commented Feb 15, 2021

/test

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.

backport looks good

@mtojek
Copy link
Contributor Author

mtojek commented Feb 15, 2021

E2E errors don't seem to be related.

@mtojek mtojek merged commit bf2881c into elastic:7.x Feb 15, 2021
@zube zube bot removed the [zube]: Done label May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants