-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
working OpenTelemetry sidecar solution #8622
Conversation
Welcome @Tobrek! |
Hi @Tobrek. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Tobrek The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
You have change the nginx base image entry point and it needs a lot of reading to make sense of it. Is it ok to ask for simple but elaborate and detailed explanation on why you need that change to the nginx Dockerfile. |
@longwuyuan Good point about test for use case without sidecar. I catch up on that test and the nginx is running without any errors, when started without the sidecar. Regarding the changes in nginx Dockerfile: I removed all the (opentelemetry) entrypoint.sh parts, because i think they are not necessary. In the opentelemetry sidecar there are the files for the OpenTelemetry module and the libraries. The only difference for the module location (etc/nginx/modules vs /modules_mount/...) i recognized is that the The only change which is "new", is adding the /modules_mount path to the library search path by using In this context ... i reverted the copy of OpenTelemetry library files to /etc/nginx/modules in the sidecar init script. In this proposed solution the module and the library files are used by explicit path. That's why i don't see the need to mix the files up and have a clean path structure in the modules_mount. |
@Tobrek part of what you described is acceptable and it will help if we can moe ahead with that. But there are other parts that are helpful but not integrated yet. The project does want to move to having all modules as sidecars but it is not integrated yet. Meaning the helm chart and other manifest generation with opentelemetry, open tracing, mod security, others is not built into the helm chart or the manifest yaml generation bash scripts. If you can suggest ho/where to set LD_LIBRARY_PATH with the way things are now, using the initcontainer technique that is working as of a few hours ago, we can make progress. Otherwise I am waiting for advise from @esigo to change the design and deal with the libopentelemetry*.so files sitting in /modules_mount/..... |
/kind bug |
/assign @Tobrek /check-cla If you havent yet @Tobrek can you sign the CNCF CLA https://easycla.lfx.linuxfoundation.org/#/ |
I signed the CNCF CLA several times, but it isn't accepted here. I don't know what I'm doing wrong. |
@strongjz @Tobrek If a user wants to use opentelemetry as well as some other module, for example modsecurity, then are we going to have a ingress-controller pod with one container for ingress-controller code, a sidecar container for opentelemetry, a second sidecar for modsecurity, and potentially more than 3 containers in one single pod. |
@longwuyuan the opentelemetry sidecar is no real sidecar in my opinion. This "sidecar" runs as init container to copy the files to the main container and then stops. |
Thank you @Tobrek . We have data that creating Can we have a screen sharing to see your test or can you provide tips/steps on how I can checkout your fork and enable opentelemetry in a ingress-controller installation, using your fork. Or are there hard dependencies on rebuilding the base nginx image or a new opentelemetry image as per your changes. |
@longwuyuan Sry currently i'm on vacation and online just in the evening (GMT+2). I think next week we can find a day, where i can show you what i did and the results. |
Hello @longwuyuan, sry for the late response, but as written I was on vacation. Now I'm back and have my developing environment up and running again. |
Yes, please ping me on slack. We have 2 PRs on this so hopefully we can gather info to make some progress. |
After discussion with @longwuyuan i rebased my fork with the latest changes and could fix my EasyCLA issue. Reminder (as already mentioned in my initial post): additional required configuration to get the OpenTelemetry sidecar working:
additional lines in the values.yaml file (for exporter configuration above):
Next open steps could / would be adding the Opentelemetry module configuration (nginx.conf, https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/nginx) to the helm chart. |
I had a little chat with @longwuyuan why changing the nginx image. To don't loose the answers or type everything twice, here a copy of the slack conversation:
Daniel Schulze The only way to not change the nginx image would be to copy the module in the init_module.sh script to /modules_mount/etc/nginx/modules/otel_ngx_module.so/otel_ngx_module.so to match the entrypoint.sh expectation. And that looks hilarious. With the idea of more sidecar / init container for other modules in mind, removing the entrypoint stuff is the better idea, because
One more reason to remove the nginx entrypoint stuff: because ingress-nginx extends the nginx image, the ENTRYPOINT definition in rootfs/Dockerfile (and rootfs/Dockerfile.chroot) is overwritting the nginx/Dockerfile ENTRYPOINT, which should copy the files. I also found a way to handle "several entrypoint scripts", but this also requires a change to the nginx image. |
@Tobrek: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
fixes #8437 and #5883
This is a working rudimentary support of OpenTelemetry sidecar. Currently just loading the OpenTelemetry module and the config at http block is supported. All other OpenTelemetry nginx directives (https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/nginx#nginx-directives) are not supported right now.
This PR should be just a possible solution to fix the sidecar and required libraries problem.
Types of changes
Which issue/s this PR fixes
fixes #8437
#5883
How Has This Been Tested?
I used a minikube environment with an installed Opentelemetry collector and connected Grafana.
I added an additional config map for OpenTelemetry config:
After installing ingress-nginx using helm chart 4.1.1 and this values file
i saw incomming traces in Grafana for "nginx-proxy".
Checklist:
I don't know if i changed all necessary documentation.
For what i know, yes.
new test cases - yes
old tests - no. This one is failing locally: