diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-collector.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-collector.yaml new file mode 100644 index 0000000000..5db3bc0afb --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-collector.yaml @@ -0,0 +1,22 @@ +apiVersion: opentelemetry.io/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: sidecar +spec: + mode: sidecar + config: | + receivers: + otlp: + protocols: + grpc: + http: + processors: + + exporters: + debug: + + service: + pipelines: + traces: + receivers: [otlp] + exporters: [debug] diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-instrumentation.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-instrumentation.yaml new file mode 100644 index 0000000000..a6860a5d27 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/00-install-instrumentation.yaml @@ -0,0 +1,37 @@ +apiVersion: opentelemetry.io/v1alpha1 +kind: Instrumentation +metadata: + name: go +spec: + env: + - name: OTEL_TRACES_EXPORTER + value: otlp + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_EXPORTER_OTLP_TIMEOUT + value: "20" + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED + value: "true" + exporter: + endpoint: http://localhost:4317 + propagators: + - jaeger + - b3 + sampler: + type: parentbased_traceidratio + argument: "0.25" + python: + env: + - name: OTEL_SERVICE_NAME + value: "pythonapp" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4318 + go: + env: + - name: OTEL_SERVICE_NAME + value: "goapp" + diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/01-add-scc.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/01-add-scc.yaml new file mode 100644 index 0000000000..db4b5b8553 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/01-add-scc.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: otel-instrumentation-go diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-assert.yaml new file mode 100644 index 0000000000..a29e431199 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-assert.yaml @@ -0,0 +1,196 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + instrumentation.opentelemetry.io/go-container-names: goapp + instrumentation.opentelemetry.io/inject-go: "true" + instrumentation.opentelemetry.io/inject-python: "true" + instrumentation.opentelemetry.io/otel-go-auto-target-exe: /usr/src/app/productcatalogservice + instrumentation.opentelemetry.io/python-container-names: pythonapp + labels: + app: my-golang-multiinst +spec: + containers: + - name: goapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - command: + - flask + - run + - -p + - "8087" + env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: OTEL_SERVICE_NAME + value: pythonapp + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4318 + - name: PYTHONPATH + value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: http/protobuf + - name: OTEL_TRACES_EXPORTER + value: otlp + - name: OTEL_METRICS_EXPORTER + value: otlp + - name: OTEL_EXPORTER_OTLP_TIMEOUT + value: "20" + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED + value: "true" + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: pythonapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - mountPath: /otel-auto-instrumentation-python + name: opentelemetry-auto-instrumentation-python + - args: + - --feature-gates=-component.UseLocalHostAsDefaultHost + - --config=env:OTEL_CONFIG + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_CONFIG + value: | + receivers: + otlp: + protocols: + grpc: null + http: null + exporters: + debug: null + service: + pipelines: + traces: + exporters: + - debug + receivers: + - otlp + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_POD_UID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.uid + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_RESOURCE_ATTRIBUTES + name: otc-container + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: OTEL_GO_AUTO_TARGET_EXE + value: /usr/src/app/productcatalogservice + - name: OTEL_SERVICE_NAME + value: goapp + - name: OTEL_TRACES_EXPORTER + value: otlp + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_EXPORTER_OTLP_TIMEOUT + value: "20" + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED + value: "true" + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: opentelemetry-auto-instrumentation + volumeMounts: + - mountPath: /sys/kernel/debug + name: kernel-debug + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + initContainers: + - command: + - cp + - -r + - /autoinstrumentation/. + - /otel-auto-instrumentation-python + name: opentelemetry-auto-instrumentation-python + volumeMounts: + - mountPath: /otel-auto-instrumentation-python + name: opentelemetry-auto-instrumentation-python + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true +status: + containerStatuses: + - name: goapp + ready: true + started: true + - name: opentelemetry-auto-instrumentation + ready: true + started: true + - name: otc-container + ready: true + started: true + - name: pythonapp + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-python + ready: true + state: + terminated: + reason: Completed + phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-install-app.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-install-app.yaml new file mode 100644 index 0000000000..b4ff36675e --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/02-install-app.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-golang-multiinst +spec: + selector: + matchLabels: + app: my-golang-multiinst + replicas: 1 + template: + metadata: + labels: + app: my-golang-multiinst + annotations: + sidecar.opentelemetry.io/inject: "true" + instrumentation.opentelemetry.io/inject-go: "true" + instrumentation.opentelemetry.io/otel-go-auto-target-exe: /usr/src/app/productcatalogservice + instrumentation.opentelemetry.io/inject-python: "true" + instrumentation.opentelemetry.io/python-container-names: "pythonapp" + instrumentation.opentelemetry.io/go-container-names: "goapp" + spec: + serviceAccountName: otel-instrumentation-go + securityContext: + runAsUser: 0 + runAsGroup: 3000 + fsGroup: 3000 + containers: + - name: goapp + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-golang:main + - name: pythonapp + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main + command: ["flask", "run", "-p", "8087"] + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/add-scc.sh b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/add-scc.sh new file mode 100755 index 0000000000..d5bb738b36 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/add-scc.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if [[ "$(kubectl api-resources --api-group=operator.openshift.io -o name)" ]]; then + kubectl apply -f scc.yaml + oc adm policy add-scc-to-user otel-go-instrumentation -z otel-instrumentation-go -n $NAMESPACE +fi diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/chainsaw-test.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/chainsaw-test.yaml new file mode 100755 index 0000000000..fd06b18c46 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/chainsaw-test.yaml @@ -0,0 +1,46 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-multi-multicontainer-go +spec: + steps: + - name: step-00 + try: + # In OpenShift, when a namespace is created, all necessary SCC annotations are automatically added. However, if a namespace is created using a resource file with only selected SCCs, the other auto-added SCCs are not included. Therefore, the UID-range and supplemental groups SCC annotations must be set after the namespace is created. + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.uid-range=0/0 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - script: + content: ./add-scc.sh + - apply: + file: 01-add-scc.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-golang diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/scc.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/scc.yaml new file mode 100644 index 0000000000..b32985664a --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer-go/scc.yaml @@ -0,0 +1,17 @@ +apiVersion: security.openshift.io/v1 +kind: SecurityContextConstraints +metadata: + name: otel-go-instrumentation +allowHostDirVolumePlugin: true +allowPrivilegeEscalation: true +allowPrivilegedContainer: true +fsGroup: + type: RunAsAny +runAsUser: + type: RunAsAny +seLinuxContext: + type: RunAsAny +seccompProfiles: +- '*' +supplementalGroups: + type: RunAsAny diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/00-install-instrumentation.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/00-install-instrumentation.yaml index 3bf65bfff0..632e57eba3 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/00-install-instrumentation.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/00-install-instrumentation.yaml @@ -38,3 +38,18 @@ spec: env: - name: OTEL_SERVICE_NAME value: "goapp" + nginx: + configFile: /etc/nginx/conf.d/default.conf + env: + - name: OTEL_SERVICE_NAME + value: "nginxapp" + attrs: + - name: NginxModuleOtelMaxQueueSize + value: "4096" + apacheHttpd: + env: + - name: OTEL_SERVICE_NAME + value: "apache-httpd-app" + attrs: + - name: ApacheModuleOtelMaxQueueSize + value: "4096" diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml index ce304aa78a..8edeeb6306 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml @@ -2,14 +2,18 @@ apiVersion: v1 kind: Pod metadata: annotations: + instrumentation.opentelemetry.io/apache-httpd-container-names: apache-httpd-app instrumentation.opentelemetry.io/dotnet-container-names: dotnetapp + instrumentation.opentelemetry.io/inject-apache-httpd: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" instrumentation.opentelemetry.io/inject-java: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" instrumentation.opentelemetry.io/inject-python: "true" + instrumentation.opentelemetry.io/inject-sdk: "true" instrumentation.opentelemetry.io/java-container-names: javaapp instrumentation.opentelemetry.io/nodejs-container-names: nodejsapp instrumentation.opentelemetry.io/python-container-names: pythonapp + instrumentation.opentelemetry.io/sdk-container-names: sdkapp sidecar.opentelemetry.io/inject: "true" labels: app: pod-with-multi-instrumentation @@ -19,10 +23,12 @@ spec: - name: OTEL_NODE_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.hostIP - name: OTEL_POD_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.podIP - name: ASPNETCORE_URLS value: http://+:8083 @@ -71,11 +77,15 @@ spec: - name: OTEL_NODE_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.hostIP - name: OTEL_POD_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.podIP + - name: SERVER_PORT + value: "8086" - name: OTEL_SERVICE_NAME value: javaapp - name: JAVA_TOOL_OPTIONS @@ -109,10 +119,12 @@ spec: - name: OTEL_NODE_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.hostIP - name: OTEL_POD_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.podIP - name: NODE_PATH value: /usr/local/lib/node_modules @@ -154,10 +166,12 @@ spec: - name: OTEL_NODE_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.hostIP - name: OTEL_POD_IP valueFrom: fieldRef: + apiVersion: v1 fieldPath: status.podIP - name: OTEL_SERVICE_NAME value: pythonapp @@ -194,43 +208,242 @@ spec: readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python + - command: + - flask + - run + - -p + - "8088" + env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: OTEL_SERVICE_NAME + value: deployment-with-multi-instrumentation + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: sdkapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: OTEL_SERVICE_NAME + value: apache-httpd-app + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: apache-httpd-app + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-apache-agent + - mountPath: /usr/local/apache2/conf + name: otel-apache-conf-dir + - env: + - name: LD_LIBRARY_PATH + value: /opt + - name: NGINX_PORT + value: "8765" + lifecycle: + postStart: + exec: + command: + - /bin/sh + - -c + - echo Hello from the postStart handler + name: nginxapp + volumeMounts: + - mountPath: /etc/nginx/conf.d + name: nginx-conf + readOnly: true + subPath: default.conf + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - args: - --feature-gates=-component.UseLocalHostAsDefaultHost - --config=env:OTEL_CONFIG + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_CONFIG + value: | + receivers: + otlp: + protocols: + grpc: null + http: null + exporters: + debug: null + service: + pipelines: + traces: + exporters: + - debug + receivers: + - otlp + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_POD_UID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.uid + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_RESOURCE_ATTRIBUTES name: otc-container + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true initContainers: - - name: opentelemetry-auto-instrumentation-java + - command: + - cp + - /javaagent.jar + - /otel-auto-instrumentation-java/javaagent.jar + name: opentelemetry-auto-instrumentation-java volumeMounts: - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - mountPath: /var/run/secrets/kubernetes.io/serviceaccount readOnly: true - - name: opentelemetry-auto-instrumentation-nodejs + - command: + - cp + - -r + - /autoinstrumentation/. + - /otel-auto-instrumentation-nodejs + name: opentelemetry-auto-instrumentation-nodejs volumeMounts: - mountPath: /otel-auto-instrumentation-nodejs name: opentelemetry-auto-instrumentation-nodejs - mountPath: /var/run/secrets/kubernetes.io/serviceaccount readOnly: true - - name: opentelemetry-auto-instrumentation-python + - command: + - cp + - -r + - /autoinstrumentation/. + - /otel-auto-instrumentation-python + name: opentelemetry-auto-instrumentation-python volumeMounts: - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - mountPath: /var/run/secrets/kubernetes.io/serviceaccount readOnly: true - - name: opentelemetry-auto-instrumentation-dotnet + - command: + - cp + - -r + - /autoinstrumentation/. + - /otel-auto-instrumentation-dotnet + name: opentelemetry-auto-instrumentation-dotnet volumeMounts: - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - mountPath: /var/run/secrets/kubernetes.io/serviceaccount readOnly: true + - args: + - cp -r /usr/local/apache2/conf/* /opt/opentelemetry-webserver/source-conf + command: + - /bin/sh + - -c + env: + - name: OTEL_SERVICE_NAME + value: apache-httpd-app + name: otel-agent-source-container-clone + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - mountPath: /opt/opentelemetry-webserver/source-conf + name: otel-apache-conf-dir + - command: + - /bin/sh + - -c + env: + - name: OTEL_APACHE_AGENT_CONF + - name: APACHE_SERVICE_INSTANCE_ID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + name: otel-agent-attach-apache + volumeMounts: + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-apache-agent + - mountPath: /opt/opentelemetry-webserver/source-conf + name: otel-apache-conf-dir + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true status: containerStatuses: + - name: apache-httpd-app + ready: true + started: true - name: dotnetapp ready: true started: true - name: javaapp ready: true started: true + - name: nginxapp + ready: true + started: true - name: nodejsapp ready: true started: true @@ -240,13 +453,38 @@ status: - name: pythonapp ready: true started: true + - name: sdkapp + ready: true + started: true initContainerStatuses: - name: opentelemetry-auto-instrumentation-java ready: true + state: + terminated: + reason: Completed - name: opentelemetry-auto-instrumentation-nodejs ready: true + state: + terminated: + reason: Completed - name: opentelemetry-auto-instrumentation-python ready: true + state: + terminated: + reason: Completed - name: opentelemetry-auto-instrumentation-dotnet ready: true + state: + terminated: + reason: Completed + - name: otel-agent-source-container-clone + ready: true + state: + terminated: + reason: Completed + - name: otel-agent-attach-apache + ready: true + state: + terminated: + reason: Completed phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml index 88d8f7a564..10d25c0246 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml @@ -1,3 +1,45 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-conf +data: + nginx.conf: | + # user nginx; + worker_processes 1; + pid /tmp/nginx.pid; + events { + worker_connections 10240; + } + http { + include /etc/nginx/conf.d/*.conf; + client_body_temp_path /tmp/client_temp; + proxy_temp_path /tmp/proxy_temp_path; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + server { + listen 8765 default_server; + server_name localhost; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + location /api/customer/ { + proxy_pass http://localhost:8282/api/customer/; + } + location /api/vendor/ { + proxy_pass http://localhost:8383/api/vendor/; + } + + location /seznam { + proxy_pass http://www.seznam.cz/; + } + } + + } + +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -12,20 +54,31 @@ spec: labels: app: pod-with-multi-instrumentation annotations: - instrumentation.opentelemetry.io/dotnet-container-names: "dotnetapp" instrumentation.opentelemetry.io/inject-dotnet: "true" instrumentation.opentelemetry.io/inject-java: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" instrumentation.opentelemetry.io/inject-python: "true" + instrumentation.opentelemetry.io/inject-sdk: "true" + instrumentation.opentelemetry.io/inject-apache-httpd: "true" instrumentation.opentelemetry.io/java-container-names: "javaapp" instrumentation.opentelemetry.io/nodejs-container-names: "nodejsapp" instrumentation.opentelemetry.io/python-container-names: "pythonapp" + instrumentation.opentelemetry.io/sdk-container-names: "sdkapp" + instrumentation.opentelemetry.io/apache-httpd-container-names: "apache-httpd-app" + instrumentation.opentelemetry.io/dotnet-container-names: "dotnetapp" sidecar.opentelemetry.io/inject: "true" spec: securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 3000 + volumes: + - name: nginx-conf + configMap: + name: nginx-conf + items: + - key: nginx.conf + path: nginx.conf containers: - name: dotnetapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main @@ -33,21 +86,32 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + seccompProfile: + type: RuntimeDefault env: - name: ASPNETCORE_URLS value: "http://+:8083" - name: javaapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main + env: + - name: SERVER_PORT + value: "8086" + ports: + - containerPort: 8086 securityContext: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + seccompProfile: + type: RuntimeDefault - name: nodejsapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-nodejs:main securityContext: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + seccompProfile: + type: RuntimeDefault env: - name: NODE_PATH value: /usr/local/lib/node_modules @@ -58,4 +122,49 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] - + seccompProfile: + type: RuntimeDefault + - name: sdkapp + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main + command: ["flask", "run", "-p", "8088"] + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + - name: apache-httpd-app + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-apache-httpd:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + ports: + - containerPort: 8080 + - name: nginxapp + image: nginxinc/nginx-unprivileged:1.26.2 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + # following to test lifecycle removal in cloned init container + lifecycle: + postStart: + exec: + command: ["/bin/sh", "-c", "echo Hello from the postStart handler"] + ports: + - containerPort: 8765 + env: + - name: LD_LIBRARY_PATH + value: /opt + - name: NGINX_PORT + value: "8765" + volumeMounts: + - name: nginx-conf + mountPath: /etc/nginx/conf.d + subPath: default.conf + readOnly: true \ No newline at end of file diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml deleted file mode 100644 index 5c9ccd6f37..0000000000 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml +++ /dev/null @@ -1,82 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - annotations: - instrumentation.opentelemetry.io/container-names: "dotnetapp" - instrumentation.opentelemetry.io/inject-dotnet: "true" - sidecar.opentelemetry.io/inject: "true" - labels: - app: pod-with-multi-instrumentation2 -spec: - containers: - - env: - - name: OTEL_NODE_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: OTEL_POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: ASPNETCORE_URLS - value: http://+:8083 - - name: OTEL_SERVICE_NAME - value: dotnetapp - - name: CORECLR_ENABLE_PROFILING - value: "1" - - name: CORECLR_PROFILER - value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}' - - name: CORECLR_PROFILER_PATH - value: /otel-auto-instrumentation-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so - - name: DOTNET_STARTUP_HOOKS - value: /otel-auto-instrumentation-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll - - name: DOTNET_ADDITIONAL_DEPS - value: /otel-auto-instrumentation-dotnet/AdditionalDeps - - name: OTEL_DOTNET_AUTO_HOME - value: /otel-auto-instrumentation-dotnet - - name: DOTNET_SHARED_STORE - value: /otel-auto-instrumentation-dotnet/store - - name: OTEL_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.85" - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://localhost:4317 - - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: spec.nodeName - - name: OTEL_PROPAGATORS - value: jaeger,b3 - - name: OTEL_RESOURCE_ATTRIBUTES - name: dotnetapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - readOnly: true - - mountPath: /otel-auto-instrumentation-dotnet - name: opentelemetry-auto-instrumentation-dotnet - - name: javaapp - - name: otc-container - initContainers: - - name: opentelemetry-auto-instrumentation-dotnet -status: - containerStatuses: - - name: dotnetapp - ready: true - started: true - - name: javaapp - ready: true - started: true - - name: otc-container - ready: true - started: true - initContainerStatuses: - - name: opentelemetry-auto-instrumentation-dotnet - ready: true - phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml deleted file mode 100644 index 9be0c047f1..0000000000 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml +++ /dev/null @@ -1,114 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - annotations: - instrumentation.opentelemetry.io/container-names: "dotnetapp" - instrumentation.opentelemetry.io/inject-dotnet: "true" - sidecar.opentelemetry.io/inject: "true" - labels: - app: pod-with-multi-instrumentation2 -spec: - containers: - - env: - - name: OTEL_NODE_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: OTEL_POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: ASPNETCORE_URLS - value: http://+:8083 - - name: OTEL_SERVICE_NAME - value: dotnetapp - - name: CORECLR_ENABLE_PROFILING - value: "1" - - name: CORECLR_PROFILER - value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}' - - name: CORECLR_PROFILER_PATH - value: /otel-auto-instrumentation-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so - - name: DOTNET_STARTUP_HOOKS - value: /otel-auto-instrumentation-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll - - name: DOTNET_ADDITIONAL_DEPS - value: /otel-auto-instrumentation-dotnet/AdditionalDeps - - name: OTEL_DOTNET_AUTO_HOME - value: /otel-auto-instrumentation-dotnet - - name: DOTNET_SHARED_STORE - value: /otel-auto-instrumentation-dotnet/store - - name: OTEL_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.85" - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://localhost:4317 - - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: spec.nodeName - - name: OTEL_PROPAGATORS - value: jaeger,b3 - - name: OTEL_RESOURCE_ATTRIBUTES - name: dotnetapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - readOnly: true - - mountPath: /otel-auto-instrumentation-dotnet - name: opentelemetry-auto-instrumentation-dotnet - - env: - - name: OTEL_NODE_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: OTEL_POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: OTEL_SERVICE_NAME - value: javaapp - - name: JAVA_TOOL_OPTIONS - value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - - name: OTEL_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.85" - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://localhost:4317 - - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: spec.nodeName - - name: OTEL_PROPAGATORS - value: jaeger,b3 - - name: OTEL_RESOURCE_ATTRIBUTES - name: javaapp - - name: otc-container - initContainers: - - name: opentelemetry-auto-instrumentation-dotnet -status: - containerStatuses: - - name: dotnetapp - ready: true - started: true - - name: javaapp - ready: true - started: true - - name: otc-container - ready: true - started: true - initContainerStatuses: - - name: opentelemetry-auto-instrumentation-dotnet - ready: true - phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml deleted file mode 100644 index f203cf0b8e..0000000000 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: deployment-with-multi-instrumentation2 -spec: - selector: - matchLabels: - app: pod-with-multi-instrumentation2 - replicas: 1 - template: - metadata: - labels: - app: pod-with-multi-instrumentation2 - annotations: - instrumentation.opentelemetry.io/container-names: "dotnetapp" - instrumentation.opentelemetry.io/inject-dotnet: "true" - sidecar.opentelemetry.io/inject: "true" - spec: - securityContext: - runAsUser: 1000 - runAsGroup: 3000 - fsGroup: 3000 - containers: - - name: dotnetapp - image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - env: - - name: ASPNETCORE_URLS - value: "http://+:8083" - - name: javaapp - image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"]