From b95fa75b90226ab4e48731931154a5ca638f194b Mon Sep 17 00:00:00 2001 From: Ishwar Kanse Date: Tue, 12 Mar 2024 14:26:27 +0530 Subject: [PATCH] Fix instrumentation test asserts. (#2702) --- .../01-assert.yaml | 20 ++- .../chainsaw-test.yaml | 5 +- .../01-assert.yaml | 131 ++++++++++-------- .../01-install-app.yaml | 23 ++- .../02-assert.yaml | 116 ++++++++-------- .../02-install-app.yaml | 25 ++-- .../chainsaw-test.yaml | 63 ++++++--- .../01-assert.yaml | 67 +++++++-- .../01-install-app.yaml | 23 ++- .../02-assert.yaml | 66 +++++++-- .../02-install-app.yaml | 23 ++- .../chainsaw-test.yaml | 29 +++- .../01-assert.yaml | 51 ++++--- .../01-install-app.yaml | 11 +- .../chainsaw-test.yaml | 5 +- .../instrumentation-dotnet/01-assert.yaml | 50 ++++--- .../01-install-app.yaml | 11 +- .../instrumentation-dotnet/chainsaw-test.yaml | 5 +- .../instrumentation-go/02-assert.yaml | 92 ++++++------ .../instrumentation-go/02-install-app.yaml | 8 +- .../instrumentation-go/chainsaw-test.yaml | 5 +- .../01-assert.yaml | 57 ++++++-- .../01-install-app.yaml | 10 +- .../02-assert.yaml | 63 +++++++-- .../02-install-app.yaml | 20 ++- .../chainsaw-test.yaml | 29 +++- .../03-assert.yaml | 41 ++++-- .../03-install-app.yaml | 8 +- .../chainsaw-test.yaml | 5 +- .../instrumentation-java/01-assert.yaml | 46 +++--- .../instrumentation-java/01-install-app.yaml | 8 +- .../instrumentation-java/chainsaw-test.yaml | 5 +- .../01-assert.yaml | 45 +++--- .../01-install-app.yaml | 9 +- .../chainsaw-test.yaml | 5 +- .../01-assert.yaml | 44 ++++-- .../01-install-app.yaml | 8 +- .../02-assert.yaml | 66 +++++---- .../02-install-app.yaml | 10 +- .../chainsaw-test.yaml | 8 +- .../instrumentation-nginx/01-assert.yaml | 46 +++--- .../instrumentation-nginx/01-install-app.yaml | 2 +- .../instrumentation-nginx/chainsaw-test.yaml | 5 +- .../01-assert.yaml | 57 ++++++-- .../01-install-app.yaml | 21 ++- .../02-assert.yaml | 63 +++++++-- .../02-install-app.yaml | 23 ++- .../chainsaw-test.yaml | 25 ++++ .../instrumentation-nodejs/01-assert.yaml | 51 ++++--- .../01-install-app.yaml | 11 +- .../instrumentation-nodejs/chainsaw-test.yaml | 5 +- .../01-assert.yaml | 55 ++++++-- .../01-install-app.yaml | 18 ++- .../02-assert.yaml | 59 ++++++-- .../02-install-app.yaml | 20 ++- .../chainsaw-test.yaml | 25 ++++ .../instrumentation-python/01-assert.yaml | 50 ++++--- .../01-install-app.yaml | 8 +- .../instrumentation-python/chainsaw-test.yaml | 5 +- .../instrumentation-sdk/01-assert.yaml | 35 ++++- .../instrumentation-sdk/01-install-app.yaml | 8 +- .../instrumentation-sdk/chainsaw-test.yaml | 5 +- .../01-assert.yaml | 3 +- 63 files changed, 1336 insertions(+), 580 deletions(-) diff --git a/tests/e2e-instrumentation/instrumentation-apache-httpd/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-apache-httpd/01-assert.yaml index 3634f82b55..e390fe7840 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-httpd/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-httpd/01-assert.yaml @@ -41,11 +41,19 @@ spec: - --config=env:OTEL_CONFIG name: otc-container initContainers: - - args: - - cp -r /usr/local/apache2/conf/* /opt/opentelemetry-webserver/source-conf - name: otel-agent-source-container-clone - - args: - - cp -r /opt/opentelemetry/* /opt/opentelemetry-webserver/agent && export agentLogDir=$(echo "/opt/opentelemetry-webserver/agent/logs" | sed 's,/,\\/,g') && cat /opt/opentelemetry-webserver/agent/conf/appdynamics_sdk_log4cxx.xml.template | sed 's/__agent_log_dir__/'${agentLogDir}'/g' > /opt/opentelemetry-webserver/agent/conf/appdynamics_sdk_log4cxx.xml &&echo "$OTEL_APACHE_AGENT_CONF" > /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && sed -i 's/<>/'${APACHE_SERVICE_INSTANCE_ID}'/g' /opt/opentelemetry-webserver/source-conf/opentemetry_agent.conf && echo 'Include /usr/local/apache2/conf/opentemetry_agent.conf' >> /opt/opentelemetry-webserver/source-conf/httpd.conf - name: otel-agent-attach-apache + - name: otel-agent-source-container-clone + - name: otel-agent-attach-apache status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-apache + ready: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml index d9e90d1fa8..93fdcd5025 100755 --- a/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml @@ -22,7 +22,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=3000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -34,3 +34,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-apache diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml index 5bc80bbfe2..0acbcea3fc 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml @@ -1,71 +1,80 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" + instrumentation.opentelemetry.io/container-names: myapp,myrabbit instrumentation.opentelemetry.io/inject-apache-httpd: "true" - instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-apache + app: my-apache-multi spec: containers: - - env: - - name: OTEL_SERVICE_NAME - value: my-apache - - 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_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.25" - - name: OTEL_RESOURCE_ATTRIBUTES - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - mountPath: /opt/opentelemetry-webserver/agent - name: otel-apache-agent - - mountPath: /usr/local/apache2/conf - name: otel-apache-conf-dir - - env: - - name: OTEL_SERVICE_NAME - value: my-apache - - 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_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.25" - - name: OTEL_RESOURCE_ATTRIBUTES - name: myrabbit - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - args: - - --config=env:OTEL_CONFIG - name: otc-container + - env: + - name: OTEL_SERVICE_NAME + value: my-apache-multi + - 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_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp + - env: + - name: OTEL_SERVICE_NAME + value: my-apache-multi + - 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_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myrabbit + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: otel-agent-source-container-clone + - name: otel-agent-attach-apache status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-apache + ready: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml index 32500ce21f..242cef7762 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml @@ -1,27 +1,28 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 apiVersion: apps/v1 kind: Deployment metadata: - name: my-apache + name: my-apache-multi spec: selector: matchLabels: - app: my-apache + app: my-apache-multi replicas: 1 template: metadata: labels: - app: my-apache + app: my-apache-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-apache-httpd: "true" instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp - image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e - # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd - # licensed under Apache 2.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-apache-httpd:main imagePullPolicy: Always ports: - containerPort: 8080 @@ -32,5 +33,13 @@ spec: requests: cpu: 250m memory: 100Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] - name: myrabbit image: rabbitmq + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml index b3c7882d7f..b6b75f981c 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml @@ -1,68 +1,70 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-apache-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-apache-httpd: "true" sidecar.opentelemetry.io/inject: "true" labels: - app: my-apache + app: my-apache-multi spec: containers: - - env: - - name: OTEL_SERVICE_NAME - value: my-apache - - 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_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.25" - - name: OTEL_RESOURCE_ATTRIBUTES - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - mountPath: /opt/opentelemetry-webserver/agent - name: otel-apache-agent - - mountPath: /usr/local/apache2/conf - name: otel-apache-conf-dir - - env: - - name: OTEL_SERVICE_NAME - value: my-apache - - 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_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.25" - - name: OTEL_RESOURCE_ATTRIBUTES - name: myrabbit - - args: - - --config=env:OTEL_CONFIG - name: otc-container + - env: + - name: OTEL_SERVICE_NAME + value: my-apache-multi + - 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_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp + - image: rabbitmq + name: myrabbit + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: otel-agent-source-container-clone + - name: otel-agent-attach-apache status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-apache + ready: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml index 3927a33cce..19fe1a4b57 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml @@ -1,27 +1,28 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 apiVersion: apps/v1 kind: Deployment metadata: - name: my-apache + name: my-apache-multi spec: selector: matchLabels: - app: my-apache + app: my-apache-multi replicas: 1 template: metadata: labels: - app: my-apache + app: my-apache-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-apache-httpd: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp - image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e - # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd - # licensed under Apache 2.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-apache-httpd:main imagePullPolicy: Always ports: - containerPort: 8080 @@ -32,5 +33,13 @@ spec: requests: cpu: 250m memory: 100Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] - name: myrabbit image: rabbitmq + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml index 1167bbc5a6..f0d25348a9 100755 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml @@ -5,24 +5,47 @@ metadata: creationTimestamp: null name: instrumentation-apache-multicontainer spec: - # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 - skip: true steps: - - name: step-00 - try: - - apply: - file: 00-install-collector.yaml - - apply: - file: 00-install-instrumentation.yaml - - name: step-01 - try: - - apply: - file: 01-install-app.yaml - - assert: - file: 01-assert.yaml - - name: step-02 - try: - - apply: - file: 02-install-app.yaml - - assert: - file: 02-assert.yaml + - 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=1000/1000 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite + - name: step-01 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-02 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-apache-multi + - name: step-03 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-apache-multi diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-assert.yaml index c3083f377c..7530bad59a 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-assert.yaml @@ -2,21 +2,22 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/container-names: myapp,myrabbit + instrumentation.opentelemetry.io/container-names: myrabbit,myapp instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-dotnet-multi spec: containers: - - name: myapp - env: + - env: + - name: ASPNETCORE_URLS + value: http://+:8080 - name: OTEL_LOG_LEVEL - value: "debug" + value: debug - name: CORECLR_ENABLE_PROFILING value: "1" - name: CORECLR_PROFILER - value: "{918728DD-259F-4A6A-AC2B-B85E1B658318}" + 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 @@ -40,24 +41,33 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-dotnet-multi - 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,b3multi - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - - name: myrabbit - env: + - env: - name: OTEL_LOG_LEVEL - value: "debug" + value: debug - name: CORECLR_ENABLE_PROFILING value: "1" - name: CORECLR_PROFILER - value: "{918728DD-259F-4A6A-AC2B-B85E1B658318}" + 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 @@ -81,16 +91,43 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-dotnet-multi - 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,b3multi - name: OTEL_RESOURCE_ATTRIBUTES + name: myrabbit volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-dotnet status: - phase: Running \ No newline at end of file + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + 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-instrumentation/instrumentation-dotnet-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-install-app.yaml index b77a2a7443..65681d5bab 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/01-install-app.yaml @@ -1,23 +1,38 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-dotnet-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-dotnet-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-dotnet-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" - instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" + instrumentation.opentelemetry.io/container-names: "myrabbit,myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + env: + - name: ASPNETCORE_URLS + value: "http://+:8080" - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-assert.yaml index 4cd7320900..81f08a3753 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-assert.yaml @@ -1,25 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-dotnet-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/container-names: myrabbit + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-dotnet-multi spec: containers: - - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: myrabbit - env: + - env: + - name: ASPNETCORE_URLS + value: http://+:8080 - name: OTEL_LOG_LEVEL - value: "debug" + value: debug - name: CORECLR_ENABLE_PROFILING value: "1" - name: CORECLR_PROFILER - value: "{918728DD-259F-4A6A-AC2B-B85E1B658318}" + 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 @@ -43,16 +52,47 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-dotnet-multi - 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,b3multi - name: OTEL_RESOURCE_ATTRIBUTES volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - - name: otc-container + - image: rabbitmq:3 + name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-dotnet status: - phase: Running \ No newline at end of file + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + 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-instrumentation/instrumentation-dotnet-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-install-app.yaml index 87930b15f1..d6bea125d2 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/02-install-app.yaml @@ -1,23 +1,38 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-dotnet-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-dotnet-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-dotnet-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + env: + - name: ASPNETCORE_URLS + value: "http://+:8080" - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml index 23d09b619c..13ff6abbbc 100755 --- a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml @@ -7,20 +7,45 @@ metadata: 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=1000/1000 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite + - name: step-01 try: - apply: file: 00-install-collector.yaml - apply: file: 00-install-instrumentation.yaml - - name: step-01 + - name: step-02 try: - apply: file: 01-install-app.yaml - assert: file: 01-assert.yaml - - name: step-02 + catch: + - podLogs: + selector: app=my-dotnet-multi + - name: step-03 try: - apply: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-dotnet-multi diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-assert.yaml index 40fedff849..3799c305ae 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-assert.yaml @@ -2,19 +2,19 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" - instrumentation.opentelemetry.io/otel-dotnet-auto-runtime: "linux-musl-x64" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-dotnet-musl spec: containers: - - name: myapp - env: + - env: + - name: ASPNETCORE_URLS + value: http://+:8080 - name: CORECLR_ENABLE_PROFILING value: "1" - name: CORECLR_PROFILER - value: "{918728DD-259F-4A6A-AC2B-B85E1B658318}" + value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}' - name: CORECLR_PROFILER_PATH value: /otel-auto-instrumentation-dotnet/linux-musl-x64/OpenTelemetry.AutoInstrumentation.Native.so - name: DOTNET_STARTUP_HOOKS @@ -38,29 +38,40 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-dotnet-musl - 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,b3multi - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-dotnet - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - resources: - limits: - cpu: "500m" - memory: "128Mi" - requests: - cpu: "50m" - memory: "128Mi" status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-dotnet + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-install-app.yaml index e8d32f7b41..b69d2fb3a1 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-musl/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-dotnet-musl spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-dotnet-musl replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-dotnet-musl annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" @@ -19,7 +19,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main @@ -27,3 +27,6 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + env: + - name: ASPNETCORE_URLS + value: "http://+:8080" diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml index f7df95de51..5e8df25c64 100755 --- a/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-dotnet-musl diff --git a/tests/e2e-instrumentation/instrumentation-dotnet/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-dotnet/01-assert.yaml index 68178cc2d5..8a2bfb3cfe 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet/01-assert.yaml @@ -2,18 +2,19 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-dotnet spec: containers: - - name: myapp - env: + - env: + - name: ASPNETCORE_URLS + value: http://+:8080 - name: CORECLR_ENABLE_PROFILING value: "1" - name: CORECLR_PROFILER - value: "{918728DD-259F-4A6A-AC2B-B85E1B658318}" + 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 @@ -37,29 +38,40 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-dotnet - 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,b3multi - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-dotnet name: opentelemetry-auto-instrumentation-dotnet - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-dotnet - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - resources: - limits: - cpu: "500m" - memory: "128Mi" - requests: - cpu: "50m" - memory: "128Mi" status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-dotnet + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-dotnet/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-dotnet/01-install-app.yaml index 15e58506fc..4a80480f04 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-dotnet spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-dotnet replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-dotnet annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-dotnet: "true" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main @@ -26,3 +26,6 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + env: + - name: ASPNETCORE_URLS + value: "http://+:8080" diff --git a/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml index 5186e6b54d..bdd2fd9a3c 100755 --- a/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-dotnet diff --git a/tests/e2e-instrumentation/instrumentation-go/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-go/02-assert.yaml index 10ddd5ebab..c8ba363d19 100644 --- a/tests/e2e-instrumentation/instrumentation-go/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-go/02-assert.yaml @@ -2,50 +2,62 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-go: "true" instrumentation.opentelemetry.io/otel-go-auto-target-exe: /usr/src/app/productcatalogservice + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-golang spec: containers: - - name: productcatalogservice - - name: otc-container - - name: opentelemetry-auto-instrumentation - resources: - limits: - cpu: "500m" - memory: "32Mi" - requests: - cpu: "50m" - memory: "32Mi" - image: ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:v0.10.1-alpha - env: - - name: OTEL_GO_AUTO_TARGET_EXE - value: /usr/src/app/productcatalogservice - - 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_SERVICE_NAME - value: my-deployment-with-sidecar - - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME - - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME - - name: OTEL_PROPAGATORS - value: jaeger,b3 - - name: OTEL_RESOURCE_ATTRIBUTES - volumeMounts: - - name: kernel-debug - mountPath: "/sys/kernel/debug" - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - + - name: productcatalogservice + - args: + - --config=env:OTEL_CONFIG + name: otc-container + - env: + - name: OTEL_GO_AUTO_TARGET_EXE + value: /usr/src/app/productcatalogservice + - 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_SERVICE_NAME + value: my-golang + - 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 status: + containerStatuses: + - name: opentelemetry-auto-instrumentation + ready: true + started: true + - name: otc-container + ready: true + started: true + - name: productcatalogservice + ready: true + started: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-go/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-go/02-install-app.yaml index 1a4eb45ceb..af82d845d2 100644 --- a/tests/e2e-instrumentation/instrumentation-go/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-go/02-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-golang spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-golang replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-golang annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-go: "true" @@ -20,7 +20,7 @@ spec: securityContext: runAsUser: 0 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: productcatalogservice image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-golang:main diff --git a/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml index 440dadc9b0..6149ecf36a 100755 --- a/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -41,3 +41,6 @@ spec: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-golang diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-assert.yaml index bb15aa2698..bae190f2d9 100644 --- a/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-assert.yaml @@ -2,15 +2,14 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/container-names: myapp,myrabbit instrumentation.opentelemetry.io/inject-java: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-java-multi spec: containers: - - name: myapp - env: + - env: - name: OTEL_JAVAAGENT_DEBUG value: "true" - name: OTEL_INSTRUMENTATION_JDBC_ENABLED @@ -18,7 +17,7 @@ spec: - name: SPLUNK_PROFILER_ENABLED value: "false" - name: JAVA_TOOL_OPTIONS - value: " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -32,18 +31,27 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-java-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - - name: myrabbit - env: + - env: - name: OTEL_JAVAAGENT_DEBUG value: "true" - name: OTEL_INSTRUMENTATION_JDBC_ENABLED @@ -51,7 +59,7 @@ spec: - name: SPLUNK_PROFILER_ENABLED value: "false" - name: JAVA_TOOL_OPTIONS - value: " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -65,16 +73,43 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-java-multi - 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: myrabbit volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-java status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-java + ready: true phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-install-app.yaml index b3b563780e..d099624dcf 100644 --- a/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/01-install-app.yaml @@ -1,21 +1,25 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-java-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-java-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-java-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-java: "true" instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-assert.yaml index f93b4e752f..6cb2a51d08 100644 --- a/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-assert.yaml @@ -1,19 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-java-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/container-names: myrabbit + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-java: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-java-multi spec: containers: - - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: myrabbit - env: + - env: - name: OTEL_JAVAAGENT_DEBUG value: "true" - name: OTEL_INSTRUMENTATION_JDBC_ENABLED @@ -21,7 +28,7 @@ spec: - name: SPLUNK_PROFILER_ENABLED value: "false" - name: JAVA_TOOL_OPTIONS - value: " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -35,16 +42,48 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-java-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - - name: otc-container + - image: rabbitmq:3 + name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-java status: - phase: Running \ No newline at end of file + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-java + ready: true + phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-install-app.yaml index 4c7a1339c9..7cac56569b 100644 --- a/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/02-install-app.yaml @@ -1,23 +1,35 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-java-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-java-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-java-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-java: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml index b02ba84276..bb72bab45b 100755 --- a/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml @@ -7,20 +7,45 @@ metadata: 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=1000/1000 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite + - name: step-01 try: - apply: file: 00-install-collector.yaml - apply: file: 00-install-instrumentation.yaml - - name: step-01 + - name: step-02 try: - apply: file: 01-install-app.yaml - assert: file: 01-assert.yaml - - name: step-02 + catch: + - podLogs: + selector: app=my-java-multi + - name: step-03 try: - apply: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-java-multi diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/03-assert.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/03-assert.yaml index 99252fdf9c..a116899e80 100644 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/03-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-other-ns/03-assert.yaml @@ -2,14 +2,13 @@ apiVersion: v1 kind: Pod metadata: annotations: + instrumentation.opentelemetry.io/inject-java: my-other-ns/java sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/inject-java: "my-other-ns/java" labels: - app: my-pod-with-sidecar + app: my-java-other-ns spec: containers: - - name: myapp - env: + - env: - name: OTEL_JAVAAGENT_DEBUG value: "true" - name: OTEL_INSTRUMENTATION_JDBC_ENABLED @@ -17,7 +16,7 @@ spec: - name: SPLUNK_PROFILER_ENABLED value: "false" - name: JAVA_TOOL_OPTIONS - value: " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -31,22 +30,40 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-java-other-ns - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-java - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-java + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/03-install-app.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/03-install-app.yaml index 962207dd8c..861a09bf1b 100644 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/03-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-other-ns/03-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-java-other-ns spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-java-other-ns replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-java-other-ns annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-java: "my-other-ns/java" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml index 046669f63e..ab24f89c4d 100755 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - delete: ref: @@ -42,6 +42,9 @@ spec: file: 03-install-app.yaml - assert: file: 03-assert.yaml + catch: + - podLogs: + selector: app=my-java-other-ns - name: step-04 try: - delete: diff --git a/tests/e2e-instrumentation/instrumentation-java/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-java/01-assert.yaml index 5dec65babc..da1b79cab4 100644 --- a/tests/e2e-instrumentation/instrumentation-java/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-java/01-assert.yaml @@ -2,14 +2,13 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-java: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-java spec: containers: - - name: myapp - env: + - env: - name: OTEL_JAVAAGENT_DEBUG value: "true" - name: OTEL_INSTRUMENTATION_JDBC_ENABLED @@ -17,7 +16,7 @@ spec: - name: SPLUNK_PROFILER_ENABLED value: "false" - name: JAVA_TOOL_OPTIONS - value: " -javaagent:/otel-auto-instrumentation-java/javaagent.jar" + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -31,29 +30,40 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-java - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-java name: opentelemetry-auto-instrumentation-java - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-java - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - resources: - limits: - cpu: "500m" - memory: "64Mi" - requests: - cpu: "50m" - memory: "64Mi" status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-java + ready: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-java/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-java/01-install-app.yaml index 17be6d12eb..4655644b5b 100644 --- a/tests/e2e-instrumentation/instrumentation-java/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-java/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-java spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-java replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-java annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-java: "true" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main diff --git a/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml index 5c5c78ee96..bffdefbc75 100755 --- a/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-java \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-assert.yaml index ff21ccd679..f7cc0b663f 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-assert.yaml @@ -2,17 +2,17 @@ apiVersion: v1 kind: Pod metadata: annotations: - instrumentation.opentelemetry.io/inject-nginx: 'true' - sidecar.opentelemetry.io/inject: 'true' + instrumentation.opentelemetry.io/inject-nginx: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-nginx + app: my-nginx-contnr-secctx spec: containers: - env: - name: LD_LIBRARY_PATH value: /opt:/opt/opentelemetry-webserver/agent/sdk_lib/lib - name: OTEL_SERVICE_NAME - value: my-nginx + value: my-nginx-contnr-secctx - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME @@ -30,30 +30,33 @@ spec: - name: OTEL_TRACES_SAMPLER value: parentbased_traceidratio - name: OTEL_TRACES_SAMPLER_ARG - value: '0.25' + value: "0.25" - name: OTEL_RESOURCE_ATTRIBUTES name: myapp - securityContext: - runAsUser: 1000 - runAsGroup: 3000 volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: otel-nginx-agent - mountPath: /opt/opentelemetry-webserver/agent - - name: otel-nginx-conf-dir - mountPath: /etc/nginx + readOnly: true + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-nginx-agent + - mountPath: /etc/nginx + name: otel-nginx-conf-dir - args: - --config=env:OTEL_CONFIG name: otc-container initContainers: - - args: - - cp -r /etc/nginx/* /opt/opentelemetry-webserver/source-conf && export NGINX_VERSION=$( { nginx -v ; } 2>&1 ) && echo ${NGINX_VERSION##*/} > /opt/opentelemetry-webserver/source-conf/version.txt - name: otel-agent-source-container-clone + - name: otel-agent-source-container-clone - name: otel-agent-attach-nginx - securityContext: - runAsUser: 1000 - runAsGroup: 3000 - args: - - echo -e $OTEL_NGINX_I13N_SCRIPT > /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && chmod +x /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && cat /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh "/opt/opentelemetry-webserver/agent" "/opt/opentelemetry-webserver/source-conf" "nginx.conf" "<>" status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-nginx + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-install-app.yaml index 70fcc626a4..eea887ae21 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/01-install-app.yaml @@ -1,27 +1,28 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-nginx + name: my-nginx-contnr-secctx spec: selector: matchLabels: - app: my-nginx + app: my-nginx-contnr-secctx replicas: 1 template: metadata: labels: - app: my-nginx + app: my-nginx-contnr-secctx annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nginx: "true" spec: containers: - name: myapp - image: nginxinc/nginx-unprivileged:1.23.1 + image: nginxinc/nginx-unprivileged:1.25.3 imagePullPolicy: Always securityContext: runAsUser: 1000 runAsGroup: 3000 + fsGroup: 3000 ports: - containerPort: 8765 env: diff --git a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml index 25eec0edef..0975c5ec05 100755 --- a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=3000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-nginx-contnr-secctx diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-assert.yaml index 6d8a744ae3..06534eed2a 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-assert.yaml @@ -1,24 +1,19 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 apiVersion: v1 kind: Pod metadata: - annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/inject-nginx: "true" - instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" - labels: - app: my-nginx + annotations: + instrumentation.opentelemetry.io/container-names: myapp,myrabbit + instrumentation.opentelemetry.io/inject-nginx: "true" + sidecar.opentelemetry.io/inject: "true" + labels: + app: my-nginx-multi spec: - securityContext: - runAsUser: 1000 - runAsGroup: 3000 - fsGroup: 3000 containers: - env: - name: LD_LIBRARY_PATH value: /opt:/opt/opentelemetry-webserver/agent/sdk_lib/lib - name: OTEL_SERVICE_NAME - value: my-nginx + value: my-nginx-multi - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME @@ -41,13 +36,14 @@ spec: name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /opt/opentelemetry-webserver/agent name: otel-nginx-agent - mountPath: /etc/nginx name: otel-nginx-conf-dir - env: - name: OTEL_SERVICE_NAME - value: my-nginx + value: my-nginx-multi - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME @@ -67,11 +63,31 @@ spec: - name: OTEL_TRACES_SAMPLER_ARG value: "0.25" - name: OTEL_RESOURCE_ATTRIBUTES + image: rabbitmq name: myrabbit volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - args: - --config=env:OTEL_CONFIG name: otc-container + initContainers: + - name: otel-agent-source-container-clone + - name: otel-agent-attach-nginx status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-nginx + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-install-app.yaml index 198cf20e1a..16702d30b2 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/01-install-app.yaml @@ -2,16 +2,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-nginx + name: my-nginx-multi spec: selector: matchLabels: - app: my-nginx + app: my-nginx-multi replicas: 1 template: metadata: labels: - app: my-nginx + app: my-nginx-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nginx: "true" @@ -23,7 +23,7 @@ spec: fsGroup: 3000 containers: - name: myapp - image: nginxinc/nginx-unprivileged:1.23.1 + image: nginxinc/nginx-unprivileged:1.25.3 imagePullPolicy: Always securityContext: runAsUser: 1000 diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-assert.yaml index 1e13e4de4f..81a43e7aa7 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-assert.yaml @@ -1,23 +1,30 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-nginx-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-nginx: "true" sidecar.opentelemetry.io/inject: "true" labels: - app: my-nginx + app: my-nginx-multi spec: - securityContext: - runAsUser: 1000 - runAsGroup: 3000 - fsGroup: 3000 containers: - env: - name: LD_LIBRARY_PATH value: /opt:/opt/opentelemetry-webserver/agent/sdk_lib/lib - name: OTEL_SERVICE_NAME - value: my-nginx + value: my-nginx-multi - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME @@ -40,35 +47,36 @@ spec: name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /opt/opentelemetry-webserver/agent name: otel-nginx-agent - mountPath: /etc/nginx name: otel-nginx-conf-dir - - env: - - name: OTEL_SERVICE_NAME - value: my-nginx - - 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_TRACES_SAMPLER - value: parentbased_traceidratio - - name: OTEL_TRACES_SAMPLER_ARG - value: "0.25" - - name: OTEL_RESOURCE_ATTRIBUTES + - image: rabbitmq name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - args: - --config=env:OTEL_CONFIG name: otc-container + initContainers: + - name: otel-agent-source-container-clone + - name: otel-agent-attach-nginx status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-nginx + ready: true phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-install-app.yaml index bc4ff47531..ab80a2db5a 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/02-install-app.yaml @@ -2,20 +2,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-nginx + name: my-nginx-multi spec: selector: matchLabels: - app: my-nginx + app: my-nginx-multi replicas: 1 template: metadata: labels: - app: my-nginx + app: my-nginx-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nginx: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: securityContext: runAsUser: 1000 @@ -23,7 +23,7 @@ spec: fsGroup: 3000 containers: - name: myapp - image: nginxinc/nginx-unprivileged:1.23.1 + image: nginxinc/nginx-unprivileged:1.25.3 imagePullPolicy: Always securityContext: runAsUser: 1000 diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml index 6e36075425..14e2221d6f 100755 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=3000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,9 +35,15 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-nginx-multi - name: step-02 try: - apply: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-nginx-multi \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nginx/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nginx/01-assert.yaml index ff3846d228..eb615846e5 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx/01-assert.yaml @@ -2,15 +2,11 @@ apiVersion: v1 kind: Pod metadata: annotations: - instrumentation.opentelemetry.io/inject-nginx: 'true' - sidecar.opentelemetry.io/inject: 'true' + instrumentation.opentelemetry.io/inject-nginx: "true" + sidecar.opentelemetry.io/inject: "true" labels: app: my-nginx spec: - securityContext: - runAsUser: 1000 - runAsGroup: 3000 - fsGroup: 3000 containers: - env: - name: LD_LIBRARY_PATH @@ -34,24 +30,40 @@ spec: - name: OTEL_TRACES_SAMPLER value: parentbased_traceidratio - name: OTEL_TRACES_SAMPLER_ARG - value: '0.25' + value: "0.25" - name: OTEL_RESOURCE_ATTRIBUTES + lifecycle: + postStart: + exec: + command: + - /bin/sh + - -c + - echo Hello from the postStart handler name: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: otel-nginx-agent - mountPath: /opt/opentelemetry-webserver/agent - - name: otel-nginx-conf-dir - mountPath: /etc/nginx + readOnly: true + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-nginx-agent + - mountPath: /etc/nginx + name: otel-nginx-conf-dir - args: - --config=env:OTEL_CONFIG name: otc-container initContainers: - - args: - - cp -r /etc/nginx/* /opt/opentelemetry-webserver/source-conf && export NGINX_VERSION=$( { nginx -v ; } 2>&1 ) && echo ${NGINX_VERSION##*/} > /opt/opentelemetry-webserver/source-conf/version.txt - name: otel-agent-source-container-clone + - name: otel-agent-source-container-clone - name: otel-agent-attach-nginx - args: - - echo -e $OTEL_NGINX_I13N_SCRIPT > /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && chmod +x /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && cat /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh "/opt/opentelemetry-webserver/agent" "/opt/opentelemetry-webserver/source-conf" "nginx.conf" "<>" status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: otel-agent-source-container-clone + ready: true + - name: otel-agent-attach-nginx + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml index a7d86790ee..13304afb75 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml @@ -21,7 +21,7 @@ spec: fsGroup: 3000 containers: - name: myapp - image: nginxinc/nginx-unprivileged:1.23.1 + image: nginxinc/nginx-unprivileged:1.25.3 imagePullPolicy: Always securityContext: allowPrivilegeEscalation: false diff --git a/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml index 0ef0f768c7..740955378d 100755 --- a/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=3000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-nginx diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-assert.yaml index ff68ac36c8..9e691c3e29 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-assert.yaml @@ -2,15 +2,16 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/container-names: myapp,myrabbit instrumentation.opentelemetry.io/inject-nodejs: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-nodejs-multi spec: containers: - - name: myapp - env: + - env: + - name: NODE_PATH + value: /usr/local/lib/node_modules - name: NODE_OPTIONS value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js' - name: OTEL_TRACES_EXPORTER @@ -26,18 +27,27 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-nodejs-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-nodejs name: opentelemetry-auto-instrumentation-nodejs - - name: myrabbit - env: + - env: - name: NODE_OPTIONS value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js' - name: OTEL_TRACES_EXPORTER @@ -53,16 +63,43 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-nodejs-multi - 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: myrabbit volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-nodejs name: opentelemetry-auto-instrumentation-nodejs - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-nodejs status: - phase: Running \ No newline at end of file + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-nodejs + ready: true + phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-install-app.yaml index a850a3cfcf..ff12f3ec51 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-install-app.yaml @@ -1,23 +1,38 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-nodejs-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-nodejs-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-nodejs-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-nodejs:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + env: + - name: NODE_PATH + value: /usr/local/lib/node_modules - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-assert.yaml index 5b60ac8f18..41c1efb269 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-assert.yaml @@ -1,19 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-nodejs-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/container-names: myrabbit + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-nodejs: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-nodejs-multi spec: containers: - - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: myrabbit - env: + - env: + - name: NODE_PATH + value: /usr/local/lib/node_modules - name: NODE_OPTIONS value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js' - name: OTEL_TRACES_EXPORTER @@ -29,16 +38,48 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-nodejs-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-nodejs name: opentelemetry-auto-instrumentation-nodejs - - name: otc-container + - image: rabbitmq:3 + name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-nodejs status: - phase: Running \ No newline at end of file + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-nodejs + ready: true + phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-install-app.yaml index 7de601d685..6438498491 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-install-app.yaml @@ -1,23 +1,38 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-nodejs-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-nodejs-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-nodejs-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-nodejs:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + env: + - name: NODE_PATH + value: /usr/local/lib/node_modules - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml index d4a34896b2..6fa16cf1bd 100755 --- a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml @@ -6,6 +6,25 @@ metadata: name: instrumentation-nodejs-multicontainer 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=1000/1000 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite - name: step-00 try: - apply: @@ -18,9 +37,15 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-nodejs-multi - name: step-02 try: - apply: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-nodejs-multi diff --git a/tests/e2e-instrumentation/instrumentation-nodejs/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nodejs/01-assert.yaml index fa71d4a6e8..5c8da8b9e1 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs/01-assert.yaml @@ -2,18 +2,19 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-nodejs spec: containers: - - name: myapp - env: + - env: + - name: NODE_PATH + value: /usr/local/lib/node_modules - name: OTEL_NODEJS_DEBUG value: "true" - name: NODE_OPTIONS - value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js" + value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js' - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT @@ -29,30 +30,40 @@ spec: - name: OTEL_METRICS_EXPORTER value: prometheus - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-nodejs - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-nodejs name: opentelemetry-auto-instrumentation-nodejs - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-nodejs - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - resources: - limits: - cpu: "500m" - memory: "128Mi" - requests: - cpu: "50m" - memory: "128Mi" - status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-nodejs + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-nodejs/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nodejs/01-install-app.yaml index 5e5e749448..45de0d5f01 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-nodejs spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-nodejs replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-nodejs annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-nodejs: "true" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-nodejs:main @@ -26,3 +26,6 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] + env: + - name: NODE_PATH + value: /usr/local/lib/node_modules diff --git a/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml index caccbb06d8..1ea4176285 100755 --- a/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-nodejs diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml index 99ccda9a6c..382b682fbb 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml @@ -2,15 +2,14 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/container-names: myapp,myrabbit instrumentation.opentelemetry.io/inject-python: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-python-multi spec: containers: - - name: myapp - env: + - env: - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python - name: OTEL_TRACES_EXPORTER @@ -32,18 +31,27 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-python-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - - name: myrabbit - env: + - env: - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python - name: OTEL_TRACES_EXPORTER @@ -65,16 +73,43 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-python-multi - 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: myrabbit volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-python status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-python + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-install-app.yaml index cb6d4f5ccc..02979df339 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-install-app.yaml @@ -1,23 +1,35 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-python-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-python-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-python-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-python: "true" instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml index f5c3191074..49a0db44b1 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml @@ -1,19 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-python-multi +status: + availableReplicas: 1 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 + +--- apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" - instrumentation.opentelemetry.io/container-names: myrabbit + instrumentation.opentelemetry.io/container-names: myapp instrumentation.opentelemetry.io/inject-python: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-python-multi spec: containers: - - name: myapp - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - - name: myrabbit - env: + - env: - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python - name: OTEL_TRACES_EXPORTER @@ -35,16 +42,48 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-python-multi - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - - name: otc-container + - image: rabbitmq:3 + name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - args: + - --config=env:OTEL_CONFIG + name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-python status: + containerStatuses: + - name: myapp + ready: true + started: true + - name: myrabbit + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-python + ready: true phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-install-app.yaml index 7e4a4595e6..b8f58b7e3b 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-install-app.yaml @@ -1,23 +1,35 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-python-multi spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-python-multi replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-python-multi annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-python: "true" - instrumentation.opentelemetry.io/container-names: "myrabbit" + instrumentation.opentelemetry.io/container-names: "myapp" spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] - name: myrabbit image: rabbitmq:3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml index c39ad549b7..830f8e827b 100755 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml @@ -6,6 +6,25 @@ metadata: name: instrumentation-python-multicontainer 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=1000/1000 + - --overwrite + - command: + entrypoint: kubectl + args: + - annotate + - namespace + - ${NAMESPACE} + - openshift.io/sa.scc.supplemental-groups=3000/3000 + - --overwrite - name: step-00 try: - apply: @@ -18,9 +37,15 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-python-multi - name: step-02 try: - apply: file: 02-install-app.yaml - assert: file: 02-assert.yaml + catch: + - podLogs: + selector: app=my-python-multi diff --git a/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml index b2d8d02aaa..efcb840f91 100644 --- a/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml @@ -2,22 +2,21 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-python: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-python spec: containers: - - name: myapp - env: + - env: - name: OTEL_LOG_LEVEL - value: "debug" + value: debug - name: OTEL_TRACES_EXPORTER value: otlp - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4318 - name: PYTHONPATH - value: "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python" + value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL value: http/protobuf - name: OTEL_METRICS_EXPORTER @@ -33,29 +32,40 @@ spec: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME - value: my-deployment-with-sidecar + value: my-python - 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: myapp volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - - name: otc-container + - args: + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - name: opentelemetry-auto-instrumentation-python - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - resources: - limits: - cpu: "500m" - memory: "32Mi" - requests: - cpu: "50m" - memory: "32Mi" status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-python + ready: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-python/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-python/01-install-app.yaml index 982b439460..8d18152ca1 100644 --- a/tests/e2e-instrumentation/instrumentation-python/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-python/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-python spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-python replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-python annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-python: "true" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main diff --git a/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml index a47d3d949c..0aa00edd4f 100755 --- a/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-python diff --git a/tests/e2e-instrumentation/instrumentation-sdk/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-sdk/01-assert.yaml index 931beb4608..653929005a 100644 --- a/tests/e2e-instrumentation/instrumentation-sdk/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-sdk/01-assert.yaml @@ -2,26 +2,49 @@ apiVersion: v1 kind: Pod metadata: annotations: - sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-sdk: "true" + sidecar.opentelemetry.io/inject: "true" labels: - app: my-pod-with-sidecar + app: my-sdk spec: containers: - - name: myapp - env: + - env: - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: "true" - name: OTEL_SERVICE_NAME + value: my-sdk - 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_TRACES_SAMPLER + value: parentbased_traceidratio - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" - name: OTEL_RESOURCE_ATTRIBUTES - - name: otc-container + name: myapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - args: + - --config=env:OTEL_CONFIG + name: otc-container status: - phase: Running + containerStatuses: + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true + phase: Running \ No newline at end of file diff --git a/tests/e2e-instrumentation/instrumentation-sdk/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-sdk/01-install-app.yaml index 3ce4568bbb..e4e432aaa2 100644 --- a/tests/e2e-instrumentation/instrumentation-sdk/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-sdk/01-install-app.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: my-deployment-with-sidecar + name: my-sdk spec: selector: matchLabels: - app: my-pod-with-sidecar + app: my-sdk replicas: 1 template: metadata: labels: - app: my-pod-with-sidecar + app: my-sdk annotations: sidecar.opentelemetry.io/inject: "true" instrumentation.opentelemetry.io/inject-sdk: "true" @@ -18,7 +18,7 @@ spec: securityContext: runAsUser: 1000 runAsGroup: 3000 - fsGroup: 2000 + fsGroup: 3000 containers: - name: myapp image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-python:main diff --git a/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml index 53fd6a8f3d..fe3ba39813 100755 --- a/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml +++ b/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml @@ -23,7 +23,7 @@ spec: - annotate - namespace - ${NAMESPACE} - - openshift.io/sa.scc.supplemental-groups=2000/1000 + - openshift.io/sa.scc.supplemental-groups=3000/3000 - --overwrite - apply: file: 00-install-collector.yaml @@ -35,3 +35,6 @@ spec: file: 01-install-app.yaml - assert: file: 01-assert.yaml + catch: + - podLogs: + selector: app=my-sdk 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 bced4be0f5..b5358f78d1 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml @@ -229,5 +229,4 @@ status: ready: true - name: opentelemetry-auto-instrumentation-dotnet ready: true - started: false - phase: Running \ No newline at end of file + phase: Running