-
Notifications
You must be signed in to change notification settings - Fork 144
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
Make Wolfi a part of Docker packaging #5062
Conversation
Once you get this working, post a comparison of the container sizes to the most recently released agent container. Benign looking changes have doubled the size of the container in the past. |
2b22147
to
b532368
Compare
* New images with `-wolfi` suffix are created * The `-cloud` image is now based on Wolfi * Refactored the packaging spec for better readability * Fixed ignored architecture flags when building Docker images. Building ARM64 on AMD64 and AMD64 or ARM64 is now possible
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Are you able to collect container logs on Kubernetes with this container using the default k8s manifests? The default manifests run the container as root. Does this work? elastic-agent/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset.yaml Lines 73 to 74 in 341a24e
What happens if you remove that and run as the elastic-agent user? |
@cmacknz if I remove the lines you referred to the agent crashes on startup with:
Any idea how to fix it? |
@cmacknz looks like it requires more changes to the manifest to make it work https://stackoverflow.com/a/57917406 However, I tried to set this for the pod:
and still have this error on agent's startup. |
I created a follow up issue #5141 |
We need to add automated tests for this container, this can probably be achieved on k8s using #5013. This can also be a follow up issue. Please create one so we can track this, and I'll approve this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
When testing on Elastic Cloud, the integration server failed to start, I'm investigating. |
I followed this guide https://github.com/elastic/elastic-agent?tab=readme-ov-file#testing-on-elastic-cloud to test my custom image on Elastic Cloud. I found that the Integration Server component didn't start using the new Wolfi-based image. The cloud injects scripts into our image from here https://github.com/elastic/cloud-assets/tree/master/stackpack/apm and these scripts require Bash https://github.com/elastic/cloud-assets/blob/6c0db22c475b9b2347d5b1cbe484f7c604468501/stackpack/apm/apm.sh#L1 So, I had to install Bash in Wolfi to maintain compatibility with the scripts 01b1ef2 This would cost us around 17MB in the image size which I don't consider to be critical. I re-tested everything with the fix and everything works normally: the integration server starts, I can enroll a Wolfi-based agent into it. |
Quality Gate passedIssues Measures |
What does this PR do?
-wolfi
suffix are created-cloud
image is now based on WolfiWhy is it important?
Wolfi is a security-focused Linux image for containers, see more here https://github.com/wolfi-dev/
Checklist
- [ ] 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./changelog/fragments
using the changelog tool- [ ] I have added an integration test or an E2E testHow to test this PR locally
Images
x86
Before this change:
After this change:
Run this command to verify the correct architecture and layers
Output for X86
Note: the base layer is always different except
elastic-agent-cloud:8.16.0
andelastic-agent-wolfi:8.16.0
which share the same base image – Wolfi.ARM64
Before this change:
After this change:
Run this command to verify the correct architecture and layers
Output for ARM64
Note: the base layer is always different except
elastic-agent-cloud:8.16.0
andelastic-agent-wolfi:8.16.0
which share the same base image – Wolfi.Size change
The different size of the x86
docker.elastic.co/beats/elastic-agent
image between main and this branch is due to the fixed bug (ignored architecture flag). Before this change, one could not build an amd64 image on an arm64 machine. Now, the architecture is correct and the size of the base layer is different.Elastic Agent functionality in Wolfi
note: fill the
<host>
and<value>
placeholdersI repeated the steps for
docker.elastic.co/beats/elastic-agent:8.16.0-SNAPSHOT
anddocker.elastic.co/beats-ci/elastic-agent-cloud:8.16.0-SNAPSHOT
images to check for regressions. Both of them enrolled and sent data successfully.I also double-checked that the capabilities is still there:
The output was:
Kubernetes integration
-wolfi
imageElastic Cloud
I followed this guide to test the new Wolfi-based cloud image https://github.com/elastic/elastic-agent?tab=readme-ov-file#testing-on-elastic-cloud