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

Nginx / Apache autoinstrumentation removes too many volumes #2846

Open
Azzore opened this issue Apr 12, 2024 · 0 comments
Open

Nginx / Apache autoinstrumentation removes too many volumes #2846

Azzore opened this issue Apr 12, 2024 · 0 comments

Comments

@Azzore
Copy link

Azzore commented Apr 12, 2024

Component(s)

auto-instrumentation

What happened?

Description

If we mount a volume into the main container of our Apache/Nginx pod that contains the substring of Apache/Nginx config path, the it gets removed from the container.

Our case was where we got Nginx configuration in /etc/nginx/nginx.conf, and the file contains an include of configuration files located in /opt/app-root/etc/nginx/conf.d/*.conf. We mount additional configuration files as configMap here, for permissions issues (we are using RH S2I images). Our config maps volumes got removed from the container.

The first step of the injection of apache/nginx library are to copy volume from main container into the 'clone' initContainer. Then, it removes the volumeMounts that contains the Nginx/apache config path, in case the configuration directory was provided by a volume, since the directory will be remounted by the operator. But, after looking at the operator's code, the check on volumeMounts is based on a strings.Contains, I guess one should use something like startsWith.

https://github.com/open-telemetry/opentelemetry-operator/blob/main/pkg/instrumentation/nginx.go#L132
https://github.com/open-telemetry/opentelemetry-operator/blob/main/pkg/instrumentation/apachehttpd.go#L111

Steps to Reproduce

  • Create a pod with an Nginx image, (docker image should fit, the config file is located under /etc/nginx/nginx.conf)
  • Add a volumeMount to the container to a directory that contains the substring of nginx config path (i.e. /dummy/etc/nginx/whatever.conf)
  • Add annotation to inject Nginx instrumentation libraries into the pod
  • Observe that the additional volumeMount is removed from the pod

Expected Result

VolumesMounts with mount points not located under nginx config path should remain present in the manifest.

Actual Result

Additional volumeMounts got removed

Kubernetes Version

1.27

Operator version

0.93.0

Collector version

opentelemetry-collector-contrib:0.93.0

Environment information

Environment

Openshift 4.14

Log output

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants