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

[Manual backport][Heartbeat] Unpack beats in elastic-agent docker image #30873

Merged
merged 3 commits into from
Mar 31, 2022

Conversation

emilioalvap
Copy link
Collaborator

Manual backport of elastic/elastic-agent#202

What does this PR do?

This PR enables unpacking of beats inside the container at build time, so that required cap_net_raw, cap_setuid capabilities can be assigned to the binary.

Why is it important?

Without the required capabilities, heartbeat cannot execute ICMP pings or setuid calls. As it is now, agent is unpacking beats at runtime, most likely with a user that doesn't have permission to assign capabilities.

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

Author's Checklist

  • [ ]

How to test this PR locally

  • Build elastic-agent containers, run:
    DEV=true SNAPSHOT=true PLATFORMS=linux/amd64 TYPES=docker mage package
  • Run one of the built containers and provide some heartbeat configuration:
docker run --name agent -it -u root --env FLEET_ENROLL=1 --env \
FLEET_URL=<url> --env \ 
FLEET_ENROLLMENT_TOKEN=<token> \ 
docker.elastic.co/beats/elastic-agent:8.2.0-SNAPSHOT

Related issues

Screenshots

image

Logs

15:38:37.323
elastic_agent.heartbeat
[elastic_agent.heartbeat][info] heartbeat start running.
15:38:37.323
elastic_agent.heartbeat
[elastic_agent.heartbeat][warn] BETA: Fleet management is enabled
15:38:37.323
elastic_agent.heartbeat
[elastic_agent.heartbeat][info] Starting fleet management service
15:38:37.323
elastic_agent.heartbeat
[elastic_agent.heartbeat][info] heartbeat is running! Hit CTRL-C to stop it.
15:38:37.323
elastic_agent.heartbeat
[elastic_agent.heartbeat][info] Effective user/group ids: 1000/1000, with groups: [0]

@emilioalvap emilioalvap added bug Team:obs-ds-hosted-services Label for the Observability Hosted Services team release-note:skip The PR should be ignored when processing the changelog Team:Elastic-Agent Label for the Agent team backport-7.17 Automated backport to the 7.17 branch with mergify labels Mar 16, 2022
@emilioalvap emilioalvap requested a review from a team as a code owner March 16, 2022 18:02
@emilioalvap emilioalvap requested a review from a team March 16, 2022 18:03
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@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 Mar 16, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 16, 2022

💚 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-03-24T10:06:05.934+0000

  • Duration: 182 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 25667
Skipped 2192
Total 27859

💚 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!)

@emilioalvap
Copy link
Collaborator Author

/test

@andrewvc
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 21, 2022

update

✅ Branch has been successfully updated

@cmacknz cmacknz added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Mar 22, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@cmacknz cmacknz removed the Team:Elastic-Agent Label for the Agent team label Mar 22, 2022
@emilioalvap
Copy link
Collaborator Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 24, 2022

update

✅ Branch has been successfully updated

@emilioalvap
Copy link
Collaborator Author

Hi @elastic/beats, could someone provide a review for this PR? Thanks!

@cmacknz cmacknz requested review from a team and removed request for a team March 31, 2022 13:49
@cmacknz
Copy link
Member

cmacknz commented Mar 31, 2022

LGTM, you should be good with just the approval from the agent control plane team (which Michel has provided).

@emilioalvap emilioalvap merged commit 37e2649 into elastic:8.1 Mar 31, 2022
mergify bot pushed a commit that referenced this pull request Mar 31, 2022
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 37e2649)
emilioalvap added a commit that referenced this pull request Apr 19, 2022
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 37e2649)

Co-authored-by: Emilio Alvarez Piñeiro <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify bug release-note:skip The PR should be ignored when processing the changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:obs-ds-hosted-services Label for the Observability Hosted Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants