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] Fix status and inspect command to work inside running container #25204

Merged
merged 2 commits into from
Apr 21, 2021

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Apr 21, 2021

What does this PR do?

Fixes issue where the status and inspect command did not work. This has to do with how the container command must setup the paths so it works correctly in a container.

Why is it important?

So the status and the inspect command can work inside of a container, without setting a special environment for it to work.

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.

Related issues

@blakerouse blakerouse added Team:Elastic-Agent Label for the Agent team backport-v7.13.0 Automated backport with mergify backport-v7.14.0 Automated backport with mergify labels Apr 21, 2021
@blakerouse blakerouse self-assigned this Apr 21, 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 Apr 21, 2021
@blakerouse blakerouse marked this pull request as ready for review April 21, 2021 14:48
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@blakerouse blakerouse added the bug label Apr 21, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 21, 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 #25204 updated

  • Start Time: 2021-04-21T14:49:34.634+0000

  • Duration: 54 min 57 sec

  • Commit: 67a8cbd

Test stats 🧪

Test Results
Failed 0
Passed 6788
Skipped 16
Total 6804

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 6788
Skipped 16
Total 6804

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

LGTM. Did not run it locally but code change makes sense.

Would be nice to also add these kind of things to our e2e test suite or something that is closer to the PR.

}

func writeContainerPaths(original, statePath, configPath, logsPath string) error {
pathFile := filepath.Join(original, "container-paths.yml")
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a new file for this or could we use an existing "state" file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is only specific to running in container mode. Being that Elastic Agent ships with pre-built binaries and the state will normally be mounted from a volume we need to do a lot to ensure that the containers paths are correct.

The code will not know the path of state.yml because that is based on the STATE_PATH adjusting that location. So we use a unique file to just do this one thing, for the status and inspect commands. All other commands should either not be used in the container or are used as children of the container command itself.

@blakerouse blakerouse merged commit b88ad8d into elastic:master Apr 21, 2021
@blakerouse blakerouse deleted the fix-container-status-cmd branch April 21, 2021 18:43
mergify bot pushed a commit that referenced this pull request Apr 21, 2021
… container (#25204)

* Fix status and inspect command to work inside running container.

* Add changelog.

(cherry picked from commit b88ad8d)
mergify bot pushed a commit that referenced this pull request Apr 21, 2021
… container (#25204)

* Fix status and inspect command to work inside running container.

* Add changelog.

(cherry picked from commit b88ad8d)
blakerouse added a commit that referenced this pull request Apr 21, 2021
… container (#25204) (#25210)

* Fix status and inspect command to work inside running container.

* Add changelog.

(cherry picked from commit b88ad8d)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
blakerouse added a commit that referenced this pull request Apr 21, 2021
… container (#25204) (#25209)

* Fix status and inspect command to work inside running container.

* Add changelog.

(cherry picked from commit b88ad8d)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
v1v added a commit to v1v/beats that referenced this pull request Apr 22, 2021
…-github-pr-comment-template

* upstream/master:
  Add support for parsers in filestream input (elastic#24763)
  Skip flaky test TestFilestreamTruncate (elastic#25218)
  backport: Add 7.13 branch (elastic#25189)
  Update decode_json_fields.asciidoc (elastic#25056)
  [Elastic Agent] Fix status and inspect command to work inside running container (elastic#25204)
v1v added a commit to v1v/beats that referenced this pull request Apr 22, 2021
…ng-versions-stack

* upstream/master: (28 commits)
  Add support for parsers in filestream input (elastic#24763)
  Skip flaky test TestFilestreamTruncate (elastic#25218)
  backport: Add 7.13 branch (elastic#25189)
  Update decode_json_fields.asciidoc (elastic#25056)
  [Elastic Agent] Fix status and inspect command to work inside running container (elastic#25204)
  Check native environment before starting (elastic#25186)
  Change event.code and winlog.event_id type (elastic#25176)
  [Ingest Manager] Proxy processes/elastic-agent to stats (elastic#25193)
  Update mergify backporting to 7.x and 7.13 (elastic#25196)
  [Heartbeat]: ensure synthetics version co* [Heartbeat]: ensure synthetics version compatability for suites  * address review and fix notice  * fix lowercase struct  * fix version conflict and rebase  * update go.* stuff to master  * fix notice.txt  * move validate inside sourcempatability for suites (elastic#24777)
  [Filebeat] Ensure Kibana audit `event.category` and `event.type` are still processed as strings. (elastic#25101)
  Update replace.asciidoc (elastic#25055)
  Fix nil panic when overwriting metadata (elastic#24741)
  [Filebeat] Add Malware Bazaar to Threat Intel Module (elastic#24570)
  Fix k8s svc selectors mapping (elastic#25169)
  [Ingest Manager] Make agent retry values for bootstraping configurable (elastic#25163)
  [Metricbeat] Remove elasticsearc.index.created from the SM code (elastic#25113)
  [Ingest Manager] Keep http and logging config during enroll (elastic#25132)
  Refactor kubernetes autodiscover to avoid skipping short-living pods (elastic#24742)
  [libbeat] New decode xml wineventlog processor (elastic#25115)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.13.0 Automated backport with mergify backport-v7.14.0 Automated backport with mergify bug Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

elastic-agent status: elastic-agent-control.sock: connect: no such file or directory
3 participants