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 Agent failing to run in standalone mode #501

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

aleksmaus
Copy link
Member

What does this PR do?

Fixes Agent failing to run in standalone mode.

Error: could not load agent info: storing generated agent id: open /usr/share/elastic-agent/state/data/vault/2bb80d5...7bf527a25b: no such file or directory

Related to the following issue: elastic/cloud-on-k8s#5720

The root cause of the issue here is that Agent when running standalone tries to write the agentID into fleet.enc (which is encrypted former fleet.yml).
If fails because the the encryption seed was not created if the agent was not enrolled.

The fix here is to create the agent secret on run. This will not create the new key if there is one that already exists after enrollment. At it allows the agent to write the agentID into fleet.enc file.

Why is it important?

Fixes Agent failing to run in standalone mode: elastic/cloud-on-k8s#5720

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas

How to test this PR locally

Run the agent locally without enrolling it first with fleet.

Related issues

Screenshots

The agent runs in the standalone mode successfully.
Screen Shot 2022-06-02 at 11 53 07 AM

@aleksmaus aleksmaus added bug Something isn't working backport-v8.3.0 Automated backport with mergify labels Jun 2, 2022
@aleksmaus aleksmaus requested review from ph and blakerouse June 2, 2022 16:19
@aleksmaus aleksmaus requested a review from a team as a code owner June 2, 2022 16:19
@aleksmaus aleksmaus self-assigned this Jun 2, 2022
@ph ph added the ci:end-to-end Enable the e2e-testing label Jun 2, 2022
@elasticmachine
Copy link
Contributor

💚 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: 2022-06-02T16:19:54.476+0000

  • Duration: 38 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 5973
Skipped 23
Total 5996

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

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

@elasticmachine
Copy link
Contributor

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 97.183% (69/71) 👍
Files 68.493% (150/219) 👍
Classes 68.109% (299/439) 👍
Methods 51.7% (821/1588) 👍
Lines 38.064% (8806/23135) 👍 0.011
Conditionals 100.0% (0/0) 💚

@aleksmaus aleksmaus merged commit d35148f into elastic:main Jun 2, 2022
aleksmaus added a commit to aleksmaus/elastic-agent that referenced this pull request Jun 2, 2022
aleksmaus added a commit to aleksmaus/elastic-agent that referenced this pull request Jun 3, 2022
michalpristas pushed a commit to michalpristas/elastic-agent that referenced this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.3.0 Automated backport with mergify bug Something isn't working ci:end-to-end Enable the e2e-testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestFleetMode/ES_data_should_pass_validations is flaky (again) with 8.3.0-SNAPSHOT
3 participants