diff --git a/apis/v1alpha1/instrumentation_webhook_test.go b/apis/v1alpha1/instrumentation_webhook_test.go index 646ce46d05..84ae6132ce 100644 --- a/apis/v1alpha1/instrumentation_webhook_test.go +++ b/apis/v1alpha1/instrumentation_webhook_test.go @@ -119,12 +119,14 @@ func TestInstrumentationValidatingWebhook(t *testing.T) { }, { name: "with volume and volumeSizeLimit", - err: "spec.nodejs.volume and spec.nodejs.volumeSizeLimit cannot both be defined", + err: "spec.nodejs.volumeClaimTemplate and spec.nodejs.volumeSizeLimit cannot both be defined", inst: Instrumentation{ Spec: InstrumentationSpec{ NodeJS: NodeJS{ - Volume: corev1.Volume{ - Name: "vol1", + VolumeClaimTemplate: corev1.PersistentVolumeClaimTemplate{ + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, + }, }, VolumeSizeLimit: &defaultVolumeSize, }, diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-volume/00-install-instrumentation.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-volume/00-install-instrumentation.yaml index d470f91f60..6314c8cf10 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-volume/00-install-instrumentation.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-volume/00-install-instrumentation.yaml @@ -30,15 +30,12 @@ spec: env: - name: OTEL_NODEJS_DEBUG value: "true" - volume: - name: ephemeral-volume - ephemeral: - volumeClaimTemplate: - metadata: - labels: - type: my-test-volume - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 1Gi + volumeClaimTemplate: + metadata: + labels: + type: my-test-volume + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Gi diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml index e403c79d8f..e568794711 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml @@ -8,93 +8,81 @@ metadata: app: my-nodejs spec: containers: - - env: - - name: OTEL_NODE_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: OTEL_POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - 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' - - 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_METRICS_EXPORTER - value: prometheus - - name: OTEL_SERVICE_NAME - 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: ephemeral-volume - - args: - - --feature-gates=-component.UseLocalHostAsDefaultHost - - --config=env:OTEL_CONFIG - name: otc-container + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - 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" + - 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_METRICS_EXPORTER + value: prometheus + - name: OTEL_SERVICE_NAME + 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: ephemeral-volume + - args: + - --feature-gates=-component.UseLocalHostAsDefaultHost + - --config=env:OTEL_CONFIG + name: otc-container initContainers: - - name: opentelemetry-auto-instrumentation-nodejs + - name: opentelemetry-auto-instrumentation-nodejs volumes: - - projected: - defaultMode: 420 - sources: - - configMap: - items: - - key: ca.crt - path: ca.crt - name: kube-root-ca.crt - - ephemeral: - volumeClaimTemplate: - metadata: - creationTimestamp: null - labels: - type: my-test-volume - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - volumeMode: Filesystem + - ephemeral: + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + volumeMode: Filesystem status: containerStatuses: - - name: myapp - ready: true - started: true - - name: otc-container - ready: true - started: true + - name: myapp + ready: true + started: true + - name: otc-container + ready: true + started: true initContainerStatuses: - - name: opentelemetry-auto-instrumentation-nodejs - ready: true + - name: opentelemetry-auto-instrumentation-nodejs + ready: true phase: Running