Repository: open-telemetry/opentelemetry-operator

Issue:
Inferred environment variables are duplicated if the user provided their own
### Component(s)

collector

### What happened?

## Description
Some components (currently only `kubeletstats` receiver) provide some environment variables to set (`K8S_NODE_NAME` for instance). If a user provides the same variables, both are added to the containers.

This is not producing any error (at least I didn't see any error) but will produce some warnings in the OpenTelemetry Operator logs.

### Kubernetes Version

.

### Operator version

.

### Collector version

.

### Environment information

## Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")


### Log output

```shell

```

### Additional context

_No response_

Hints from issue comments:

Solution patch:
diff --git a/.chloggen/3963.yaml b/.chloggen/3963.yaml
new file mode 100755
index 00000000..92dc2ef4
--- /dev/null
+++ b/.chloggen/3963.yaml
@@ -0,0 +1,19 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: bug_fix
+
+# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
+component: collector
+
+# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: "Prevent the operator from overriding the env vars defined by the user in the OpenTelemetryCollector spec."
+
+# One or more tracking issues related to the change
+issues: [3963]
+
+# (Optional) One or more lines of additional information to render under the primary note.
+# These lines will be padded with 2 spaces and then inserted directly into the document.
+# Use pipe (|) for multiline entries.
+subtext: |
+  This change ensures that the operator does not override the environment variables defined by the user in the OpenTelemetryCollector spec.
+  It combines user-defined environment variables with automatically inferred ones, giving precedence to user-defined ones.
+
diff --git a/autoinstrumentation/nodejs/package.json b/autoinstrumentation/nodejs/package.json
index c0547b17..fa1ea48c 100644
--- a/autoinstrumentation/nodejs/package.json
+++ b/autoinstrumentation/nodejs/package.json
@@ -13,6 +13,6 @@
     },
     "dependencies": {
         "@opentelemetry/api": "1.9.0",
-        "@opentelemetry/auto-instrumentations-node": "0.58.0"
+        "@opentelemetry/auto-instrumentations-node": "0.58.1"
     }
 }
diff --git a/controllers/common.go b/internal/controllers/common.go
similarity index 100%
rename from controllers/common.go
rename to internal/controllers/common.go
diff --git a/controllers/opampbridge_controller.go b/internal/controllers/opampbridge_controller.go
similarity index 100%
rename from controllers/opampbridge_controller.go
rename to internal/controllers/opampbridge_controller.go
diff --git a/controllers/opentelemetrycollector_controller.go b/internal/controllers/opentelemetrycollector_controller.go
similarity index 100%
rename from controllers/opentelemetrycollector_controller.go
rename to internal/controllers/opentelemetrycollector_controller.go
diff --git a/controllers/targetallocator_controller.go b/internal/controllers/targetallocator_controller.go
similarity index 100%
rename from controllers/targetallocator_controller.go
rename to internal/controllers/targetallocator_controller.go
diff --git a/internal/manifests/collector/container.go b/internal/manifests/collector/container.go
index fb0c5769..feb4f2b3 100644
--- a/internal/manifests/collector/container.go
+++ b/internal/manifests/collector/container.go
@@ -96,20 +96,6 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTeleme
 		volumeMounts = append(volumeMounts, otelcol.Spec.VolumeMounts...)
 	}
 
-	var envVars = otelcol.Spec.Env
-	if otelcol.Spec.Env == nil {
-		envVars = []corev1.EnvVar{}
-	}
-
-	envVars = append(envVars, corev1.EnvVar{
-		Name: "POD_NAME",
-		ValueFrom: &corev1.EnvVarSource{
-			FieldRef: &corev1.ObjectFieldSelector{
-				FieldPath: "metadata.name",
-			},
-		},
-	})
-
 	if len(otelcol.Spec.ConfigMaps) > 0 {
 		for keyCfgMap := range otelcol.Spec.ConfigMaps {
 			volumeMounts = append(volumeMounts, corev1.VolumeMount{
@@ -119,18 +105,6 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTeleme
 		}
 	}
 
-	if otelcol.Spec.TargetAllocator.Enabled {
-		// We need to add a SHARD here so the collector is able to keep targets after the hashmod operation which is
-		// added by default by the Prometheus operator's config generator.
-		// All collector instances use SHARD == 0 as they only receive targets
-		// allocated to them and should not use the Prometheus hashmod-based
-		// allocation.
-		envVars = append(envVars, corev1.EnvVar{
-			Name:  "SHARD",
-			Value: "0",
-		})
-	}
-
 	livenessProbe, livenessProbeErr := otelcol.Spec.Config.GetLivenessProbe(logger)
 	if livenessProbeErr != nil {
 		logger.Error(livenessProbeErr, "cannot create liveness probe.")
@@ -144,35 +118,6 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTeleme
 		defaultProbeSettings(readinessProbe, otelcol.Spec.ReadinessProbe)
 	}
 
-	if featuregate.SetGolangFlags.IsEnabled() {
-		envVars = append(envVars, corev1.EnvVar{
-			Name: "GOMEMLIMIT",
-			ValueFrom: &corev1.EnvVarSource{
-				ResourceFieldRef: &corev1.ResourceFieldSelector{
-					Resource:      "limits.memory",
-					ContainerName: naming.Container(),
-				},
-			},
-		},
-			corev1.EnvVar{
-				Name: "GOMAXPROCS",
-				ValueFrom: &corev1.EnvVarSource{
-					ResourceFieldRef: &corev1.ResourceFieldSelector{
-						Resource:      "limits.cpu",
-						ContainerName: naming.Container(),
-					},
-				},
-			},
-		)
-	}
-
-	if configEnvVars, err := otelcol.Spec.Config.GetEnvironmentVariables(logger); err != nil {
-		logger.Error(err, "could not get the environment variables from the config")
-	} else {
-		envVars = append(envVars, configEnvVars...)
-	}
-
-	envVars = append(envVars, proxy.ReadProxyVarsFromEnv()...)
 	return corev1.Container{
 		Name:            naming.Container(),
 		Image:           image,
@@ -180,7 +125,7 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTeleme
 		Ports:           portMapToList(ports),
 		VolumeMounts:    volumeMounts,
 		Args:            args,
-		Env:             envVars,
+		Env:             getContainerEnvVars(otelcol, logger),
 		EnvFrom:         otelcol.Spec.EnvFrom,
 		Resources:       otelcol.Spec.Resources,
 		SecurityContext: otelcol.Spec.SecurityContext,
@@ -264,3 +209,85 @@ func defaultProbeSettings(probe *corev1.Probe, probeConfig *v1beta1.Probe) {
 		probe.TerminationGracePeriodSeconds = probeConfig.TerminationGracePeriodSeconds
 	}
 }
+
+// getContainerEnvVars returns the environment variables for the collector container.
+// It combines user-defined environment variables from the OpenTelemetryCollector spec
+// with automatically inferred environment variables, giving precedence to user-defined ones.
+func getContainerEnvVars(otelcol v1beta1.OpenTelemetryCollector, logger logr.Logger) []corev1.EnvVar {
+	inferredEnvVars := getInferredContainerEnvVars(otelcol, logger)
+
+	envVars := []corev1.EnvVar{}
+	envVars = append(envVars, otelcol.Spec.Env...)
+
+	userDefinedEnvVars := make(map[string]bool, len(otelcol.Spec.Env))
+	for _, env := range otelcol.Spec.Env {
+		userDefinedEnvVars[env.Name] = true
+	}
+
+	// We only append the inferred env vars that are not defined by the user.
+	for _, env := range inferredEnvVars {
+		if _, ok := userDefinedEnvVars[env.Name]; !ok {
+			envVars = append(envVars, env)
+		}
+	}
+
+	return envVars
+}
+
+// getInferredContainerEnvVars returns environment variables that are automatically added to the collector container.
+// Those include parsing the collector config and adding the env vars derived from it.
+func getInferredContainerEnvVars(otelcol v1beta1.OpenTelemetryCollector, logger logr.Logger) []corev1.EnvVar {
+	envVars := []corev1.EnvVar{}
+
+	envVars = append(envVars, corev1.EnvVar{
+		Name: "POD_NAME",
+		ValueFrom: &corev1.EnvVarSource{
+			FieldRef: &corev1.ObjectFieldSelector{
+				FieldPath: "metadata.name",
+			},
+		},
+	})
+
+	if otelcol.Spec.TargetAllocator.Enabled {
+		// We need to add a SHARD here so the collector is able to keep targets after the hashmod operation which is
+		// added by default by the Prometheus operator's config generator.
+		// All collector instances use SHARD == 0 as they only receive targets
+		// allocated to them and should not use the Prometheus hashmod-based
+		// allocation.
+		envVars = append(envVars, corev1.EnvVar{
+			Name:  "SHARD",
+			Value: "0",
+		})
+	}
+
+	if featuregate.SetGolangFlags.IsEnabled() {
+		envVars = append(envVars,
+			corev1.EnvVar{
+				Name: "GOMEMLIMIT",
+				ValueFrom: &corev1.EnvVarSource{
+					ResourceFieldRef: &corev1.ResourceFieldSelector{
+						Resource:      "limits.memory",
+						ContainerName: naming.Container(),
+					},
+				},
+			},
+			corev1.EnvVar{
+				Name: "GOMAXPROCS",
+				ValueFrom: &corev1.EnvVarSource{
+					ResourceFieldRef: &corev1.ResourceFieldSelector{
+						Resource:      "limits.cpu",
+						ContainerName: naming.Container(),
+					},
+				},
+			},
+		)
+	}
+
+	if configEnvVars, err := otelcol.Spec.Config.GetEnvironmentVariables(logger); err != nil {
+		logger.Error(err, "could not get the environment variables from the config")
+	} else {
+		envVars = append(envVars, configEnvVars...)
+	}
+
+	return append(envVars, proxy.ReadProxyVarsFromEnv()...)
+}
diff --git a/main.go b/main.go
index abd92128..87befab1 100644
--- a/main.go
+++ b/main.go
@@ -37,13 +37,13 @@ import (
 
 	otelv1alpha1 "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
 	otelv1beta1 "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
-	"github.com/open-telemetry/opentelemetry-operator/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/certmanager"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/prometheus"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/targetallocator"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
+	"github.com/open-telemetry/opentelemetry-operator/internal/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/fips"
 	collectorManifests "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 	openshiftDashboards "github.com/open-telemetry/opentelemetry-operator/internal/openshift/dashboards"



Test patch:
diff --git a/controllers/builder_test.go b/internal/controllers/builder_test.go
similarity index 100%
rename from controllers/builder_test.go
rename to internal/controllers/builder_test.go
diff --git a/controllers/opampbridge_controller_test.go b/internal/controllers/opampbridge_controller_test.go
similarity index 98%
rename from controllers/opampbridge_controller_test.go
rename to internal/controllers/opampbridge_controller_test.go
index 61874685..0d2e1b2d 100644
--- a/controllers/opampbridge_controller_test.go
+++ b/internal/controllers/opampbridge_controller_test.go
@@ -23,11 +23,11 @@ import (
 	k8sreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile"
 
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
-	"github.com/open-telemetry/opentelemetry-operator/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/prometheus"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/rbac"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
+	"github.com/open-telemetry/opentelemetry-operator/internal/controllers"
 )
 
 var opampBridgeLogger = logf.Log.WithName("opamp-bridge-controller-unit-tests")
diff --git a/controllers/opentelemetrycollector_reconciler_test.go b/internal/controllers/opentelemetrycollector_reconciler_test.go
similarity index 100%
rename from controllers/opentelemetrycollector_reconciler_test.go
rename to internal/controllers/opentelemetrycollector_reconciler_test.go
diff --git a/controllers/reconcile_test.go b/internal/controllers/reconcile_test.go
similarity index 99%
rename from controllers/reconcile_test.go
rename to internal/controllers/reconcile_test.go
index 39167131..7251b9a6 100644
--- a/controllers/reconcile_test.go
+++ b/internal/controllers/reconcile_test.go
@@ -38,11 +38,11 @@ import (
 
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
-	"github.com/open-telemetry/opentelemetry-operator/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/prometheus"
 	autoRBAC "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/rbac"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
+	"github.com/open-telemetry/opentelemetry-operator/internal/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
 	"github.com/open-telemetry/opentelemetry-operator/internal/naming"
 	"github.com/open-telemetry/opentelemetry-operator/internal/version"
diff --git a/controllers/suite_test.go b/internal/controllers/suite_test.go
similarity index 99%
rename from controllers/suite_test.go
rename to internal/controllers/suite_test.go
index 65e06add..6c4dade2 100644
--- a/controllers/suite_test.go
+++ b/internal/controllers/suite_test.go
@@ -149,10 +149,10 @@ func TestMain(m *testing.M) {
 	utilruntime.Must(v1beta1.AddToScheme(testScheme))
 
 	testEnv = &envtest.Environment{
-		CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
+		CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
 		CRDs:              []*apiextensionsv1.CustomResourceDefinition{testdata.OpenShiftRouteCRD, testdata.ServiceMonitorCRD, testdata.PodMonitorCRD},
 		WebhookInstallOptions: envtest.WebhookInstallOptions{
-			Paths: []string{filepath.Join("..", "config", "webhook")},
+			Paths: []string{filepath.Join("..", "..", "config", "webhook")},
 		},
 	}
 	restCfg, err = testEnv.Start()
diff --git a/controllers/targetallocator_controller_test.go b/internal/controllers/targetallocator_controller_test.go
similarity index 98%
rename from controllers/targetallocator_controller_test.go
rename to internal/controllers/targetallocator_controller_test.go
index cf8f7ac1..dd3229c6 100644
--- a/controllers/targetallocator_controller_test.go
+++ b/internal/controllers/targetallocator_controller_test.go
@@ -21,8 +21,8 @@ import (
 
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
-	"github.com/open-telemetry/opentelemetry-operator/controllers"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
+	"github.com/open-telemetry/opentelemetry-operator/internal/controllers"
 )
 
 var testLogger = logf.Log.WithName("opamp-bridge-controller-unit-tests")
diff --git a/controllers/targetallocator_reconciler_test.go b/internal/controllers/targetallocator_reconciler_test.go
similarity index 100%
rename from controllers/targetallocator_reconciler_test.go
rename to internal/controllers/targetallocator_reconciler_test.go
diff --git a/controllers/testdata/ingress_testdata.yaml b/internal/controllers/testdata/ingress_testdata.yaml
similarity index 100%
rename from controllers/testdata/ingress_testdata.yaml
rename to internal/controllers/testdata/ingress_testdata.yaml
diff --git a/controllers/testdata/otlp_test.yaml b/internal/controllers/testdata/otlp_test.yaml
similarity index 100%
rename from controllers/testdata/otlp_test.yaml
rename to internal/controllers/testdata/otlp_test.yaml
diff --git a/controllers/testdata/test.yaml b/internal/controllers/testdata/test.yaml
similarity index 100%
rename from controllers/testdata/test.yaml
rename to internal/controllers/testdata/test.yaml
diff --git a/controllers/testdata/test_ta_update.yaml b/internal/controllers/testdata/test_ta_update.yaml
similarity index 100%
rename from controllers/testdata/test_ta_update.yaml
rename to internal/controllers/testdata/test_ta_update.yaml
diff --git a/internal/manifests/collector/container_test.go b/internal/manifests/collector/container_test.go
index 7b8ad8cb..d67ee3be 100644
--- a/internal/manifests/collector/container_test.go
+++ b/internal/manifests/collector/container_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"os"
@@ -13,19 +13,15 @@ import (
 	"gopkg.in/yaml.v3"
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/api/resource"
-	logf "sigs.k8s.io/controller-runtime/pkg/log"
 
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/certmanager"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 	"github.com/open-telemetry/opentelemetry-operator/internal/naming"
 	"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
 	"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
 )
 
-var logger = logf.Log.WithName("unit-tests")
-
 var metricContainerPort = corev1.ContainerPort{
 	Name:          "metrics",
 	ContainerPort: 8888,
@@ -65,7 +61,7 @@ func TestContainerNewDefault(t *testing.T) {
 	cfg := config.New(config.WithCollectorImage("default-image"))
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Equal(t, "default-image", c.Image)
@@ -84,7 +80,7 @@ func TestContainerWithImageOverridden(t *testing.T) {
 	cfg := config.New(config.WithCollectorImage("default-image"))
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Equal(t, "overridden-image", c.Image)
@@ -389,7 +385,7 @@ service:
 			cfg := config.New(config.WithCollectorImage("default-image"))
 
 			// test
-			c := Container(cfg, logger, otelcol, true)
+			c := Container(cfg, testLogger, otelcol, true)
 			// verify
 			assert.ElementsMatch(t, testCase.expectedPorts, c.Ports, testCase.description)
 		})
@@ -411,7 +407,7 @@ func TestContainerConfigFlagIsIgnored(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Len(t, c.Args, 2)
@@ -433,7 +429,7 @@ func TestContainerCustomVolumes(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Len(t, c.VolumeMounts, 2)
@@ -456,7 +452,7 @@ func TestContainerCustomConfigMapsVolumes(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Len(t, c.VolumeMounts, 3)
@@ -468,7 +464,7 @@ func TestContainerCustomConfigMapsVolumes(t *testing.T) {
 
 func TestContainerCustomSecurityContext(t *testing.T) {
 	// default config without security context
-	c1 := Container(config.New(), logger, v1beta1.OpenTelemetryCollector{Spec: v1beta1.OpenTelemetryCollectorSpec{}}, true)
+	c1 := Container(config.New(), testLogger, v1beta1.OpenTelemetryCollector{Spec: v1beta1.OpenTelemetryCollectorSpec{}}, true)
 
 	// verify
 	assert.Nil(t, c1.SecurityContext)
@@ -478,7 +474,7 @@ func TestContainerCustomSecurityContext(t *testing.T) {
 	uid := int64(1234)
 
 	// test
-	c2 := Container(config.New(), logger, v1beta1.OpenTelemetryCollector{
+	c2 := Container(config.New(), testLogger, v1beta1.OpenTelemetryCollector{
 		Spec: v1beta1.OpenTelemetryCollectorSpec{
 			OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
 
@@ -513,7 +509,7 @@ func TestContainerEnvVarsOverridden(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Len(t, c.Env, 2)
@@ -529,7 +525,7 @@ func TestContainerDefaultEnvVars(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Len(t, c.Env, 1)
@@ -547,7 +543,7 @@ func TestContainerProxyEnvVars(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	require.Len(t, c.Env, 3)
@@ -577,7 +573,7 @@ func TestContainerResourceRequirements(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Equal(t, resource.MustParse("100m"), *c.Resources.Limits.Cpu())
@@ -594,7 +590,7 @@ func TestContainerDefaultResourceRequirements(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Empty(t, c.Resources)
@@ -615,7 +611,7 @@ func TestContainerArgs(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Contains(t, c.Args, "--metrics-level=detailed")
@@ -637,7 +633,7 @@ func TestContainerOrderedArgs(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify that the first args is (always) the config, and the remaining args are ordered alphabetically
 	// by the key
@@ -658,7 +654,7 @@ func TestContainerImagePullPolicy(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Equal(t, c.ImagePullPolicy, corev1.PullIfNotPresent)
@@ -693,7 +689,7 @@ func TestContainerEnvFrom(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Contains(t, c.EnvFrom, envFrom1)
@@ -735,7 +731,7 @@ service:
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	// liveness
@@ -779,7 +775,7 @@ service:
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	// liveness
@@ -805,7 +801,7 @@ service:
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Equal(t, "/", c.LivenessProbe.HTTPGet.Path)
@@ -832,7 +828,7 @@ func TestContainerLifecycle(t *testing.T) {
 	cfg := config.New()
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	expectedLifecycleHooks := corev1.Lifecycle{
 		PostStart: &corev1.LifecycleHandler{
@@ -867,7 +863,7 @@ func TestContainerWithCertManagerAvailable(t *testing.T) {
 	require.NoError(t, err)
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.Contains(t, c.VolumeMounts, corev1.VolumeMount{
@@ -887,7 +883,7 @@ func TestContainerWithFeaturegateEnabledButTADisabled(t *testing.T) {
 	require.NoError(t, err)
 
 	// test
-	c := Container(cfg, logger, otelcol, true)
+	c := Container(cfg, testLogger, otelcol, true)
 
 	// verify
 	assert.NotContains(t, c.VolumeMounts, corev1.VolumeMount{
@@ -895,3 +891,265 @@ func TestContainerWithFeaturegateEnabledButTADisabled(t *testing.T) {
 		MountPath: constants.TACollectorTLSDirPath,
 	})
 }
+
+func TestGetEnvironmentVariables(t *testing.T) {
+	tests := []struct {
+		name                 string
+		otelcol              v1beta1.OpenTelemetryCollector
+		enableSetGolangFlags bool
+		expectedEnvVars      []corev1.EnvVar
+		cleanup              func()
+		before               func()
+	}{
+		{
+			name: "default environment variables",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{},
+			},
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+			},
+		},
+		{
+			name: "with target allocator enabled",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{
+					TargetAllocator: v1beta1.TargetAllocatorEmbedded{
+						Enabled: true,
+					},
+				},
+			},
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+				{
+					Name:  "SHARD",
+					Value: "0",
+				},
+			},
+		},
+		{
+			name: "with golang flags feature gate enabled",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{},
+			},
+			enableSetGolangFlags: true,
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+				{
+					Name: "GOMEMLIMIT",
+					ValueFrom: &corev1.EnvVarSource{
+						ResourceFieldRef: &corev1.ResourceFieldSelector{
+							Resource:      "limits.memory",
+							ContainerName: naming.Container(),
+						},
+					},
+				},
+				{
+					Name: "GOMAXPROCS",
+					ValueFrom: &corev1.EnvVarSource{
+						ResourceFieldRef: &corev1.ResourceFieldSelector{
+							Resource:      "limits.cpu",
+							ContainerName: naming.Container(),
+						},
+					},
+				},
+			},
+		},
+		{
+			name: "with user defined environment variables",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{
+					OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
+						Env: []corev1.EnvVar{
+							{
+								Name:  "POD_NAME",
+								Value: "custom-pod-name",
+							},
+							{
+								Name:  "GOMEMLIMIT",
+								Value: "1Gi",
+							},
+						},
+					},
+				},
+			},
+			enableSetGolangFlags: true,
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name:  "POD_NAME",
+					Value: "custom-pod-name",
+				},
+				{
+					Name:  "GOMEMLIMIT",
+					Value: "1Gi",
+				},
+				{
+					Name: "GOMAXPROCS",
+					ValueFrom: &corev1.EnvVarSource{
+						ResourceFieldRef: &corev1.ResourceFieldSelector{
+							Resource:      "limits.cpu",
+							ContainerName: naming.Container(),
+						},
+					},
+				},
+			},
+		},
+		{
+			name: "proxy environment variables",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{},
+			},
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+				{Name: "HTTP_PROXY", Value: "http://proxy.example.com"},
+				{Name: "http_proxy", Value: "http://proxy.example.com"},
+				{Name: "NO_PROXY", Value: "localhost"},
+				{Name: "no_proxy", Value: "localhost"},
+			},
+			before: func() {
+				require.NoError(t, os.Setenv("HTTP_PROXY", "http://proxy.example.com"))
+				require.NoError(t, os.Setenv("NO_PROXY", "localhost"))
+			},
+			cleanup: func() {
+				require.NoError(t, os.Unsetenv("HTTP_PROXY"))
+				require.NoError(t, os.Unsetenv("NO_PROXY"))
+			},
+		},
+		{
+			name: "with env vars from config",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{
+					Config: mustUnmarshalToConfig(t, `receivers:
+  kubeletstats:
+    collection_interval: 20s
+    initial_delay: 1s
+    auth_type: "tls"
+    ca_file: "/path/to/ca.crt"
+    key_file: "/path/to/apiserver.key"
+    cert_file: "/path/to/apiserver.crt"
+    endpoint: "https://192.168.64.1:10250"
+    insecure_skip_verify: true
+service:
+    pipelines:
+        metrics:
+            receivers: [kubeletstats]
+`)},
+			},
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+				{
+					Name: "K8S_NODE_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "spec.nodeName",
+						},
+					},
+				},
+			},
+		},
+		{
+			name: "with env vars from config and defined from user",
+			otelcol: v1beta1.OpenTelemetryCollector{
+				Spec: v1beta1.OpenTelemetryCollectorSpec{
+					Config: mustUnmarshalToConfig(t, `receivers:
+  kubeletstats:
+    collection_interval: 20s
+    initial_delay: 1s
+    auth_type: "tls"
+    ca_file: "/path/to/ca.crt"
+    key_file: "/path/to/apiserver.key"
+    cert_file: "/path/to/apiserver.crt"
+    endpoint: "https://192.168.64.1:10250"
+    insecure_skip_verify: true
+service:
+    pipelines:
+        metrics:
+            receivers: [kubeletstats]
+`),
+					OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
+						Env: []corev1.EnvVar{
+							{
+								Name:  "K8S_NODE_NAME",
+								Value: "custom-node-name",
+							},
+						},
+					},
+				},
+			},
+			expectedEnvVars: []corev1.EnvVar{
+				{
+					Name: "POD_NAME",
+					ValueFrom: &corev1.EnvVarSource{
+						FieldRef: &corev1.ObjectFieldSelector{
+							FieldPath: "metadata.name",
+						},
+					},
+				},
+				// We expect the inferred var to be ignored
+				// and use the one provided by the user
+				{
+					Name:  "K8S_NODE_NAME",
+					Value: "custom-node-name",
+				},
+			},
+		},
+	}
+	for _, test := range tests {
+		t.Run(test.name, func(t *testing.T) {
+			registry := colfg.GlobalRegistry()
+			if test.enableSetGolangFlags {
+				originalVal := featuregate.SetGolangFlags.IsEnabled()
+				require.NoError(t, registry.Set(featuregate.SetGolangFlags.ID(), true))
+				t.Cleanup(func() {
+					require.NoError(t, registry.Set(featuregate.SetGolangFlags.ID(), originalVal))
+				})
+			}
+
+			if test.before != nil {
+				test.before()
+			}
+
+			envVars := getContainerEnvVars(test.otelcol, testLogger)
+			assert.ElementsMatch(t, test.expectedEnvVars, envVars)
+
+			if test.cleanup != nil {
+				t.Cleanup(test.cleanup)
+			}
+		})
+	}
+}
diff --git a/internal/manifests/collector/daemonset_test.go b/internal/manifests/collector/daemonset_test.go
index a760da9f..da3f8528 100644
--- a/internal/manifests/collector/daemonset_test.go
+++ b/internal/manifests/collector/daemonset_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"testing"
@@ -16,7 +16,6 @@ import (
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 )
 
 func TestDaemonSetNewDefault(t *testing.T) {
@@ -34,7 +33,7 @@ func TestDaemonSetNewDefault(t *testing.T) {
 				},
 			},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 
 	// test
@@ -91,7 +90,7 @@ func TestDaemonsetHostNetwork(t *testing.T) {
 			},
 			Spec: v1beta1.OpenTelemetryCollectorSpec{},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 	// test
 	d1, err := DaemonSet(params1)
@@ -113,7 +112,7 @@ func TestDaemonsetHostNetwork(t *testing.T) {
 				},
 			},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 	d2, err := DaemonSet(params2)
 	require.NoError(t, err)
@@ -139,7 +138,7 @@ func TestDaemonsetPodAnnotations(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -188,7 +187,7 @@ func TestDaemonstPodSecurityContext(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := DaemonSet(params)
@@ -218,7 +217,7 @@ func TestDaemonsetFilterLabels(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := DaemonSet(params)
@@ -249,7 +248,7 @@ func TestDaemonsetFilterAnnotations(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := DaemonSet(params)
@@ -274,7 +273,7 @@ func TestDaemonSetNodeSelector(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := DaemonSet(params1)
@@ -302,7 +301,7 @@ func TestDaemonSetNodeSelector(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := DaemonSet(params2)
@@ -322,7 +321,7 @@ func TestDaemonSetPriorityClassName(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := DaemonSet(params1)
@@ -347,7 +346,7 @@ func TestDaemonSetPriorityClassName(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := DaemonSet(params2)
@@ -367,7 +366,7 @@ func TestDaemonSetAffinity(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := DaemonSet(params1)
@@ -390,7 +389,7 @@ func TestDaemonSetAffinity(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := DaemonSet(params2)
@@ -421,7 +420,7 @@ func TestDaemonSetInitContainer(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -457,7 +456,7 @@ func TestDaemonSetAdditionalContainer(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -494,7 +493,7 @@ func TestDaemonSetDefaultUpdateStrategy(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -529,7 +528,7 @@ func TestDaemonSetOnDeleteUpdateStrategy(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -551,7 +550,7 @@ func TestDaemonsetShareProcessNamespace(t *testing.T) {
 			},
 			Spec: v1beta1.OpenTelemetryCollectorSpec{},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 	// test
 	d1, err := DaemonSet(params1)
@@ -571,7 +570,7 @@ func TestDaemonsetShareProcessNamespace(t *testing.T) {
 				},
 			},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 	d2, err := DaemonSet(params2)
 	require.NoError(t, err)
@@ -599,7 +598,7 @@ func TestDaemonSetDNSConfig(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
diff --git a/internal/manifests/collector/deployment_test.go b/internal/manifests/collector/deployment_test.go
index 5e6fdd8e..95adbfcb 100644
--- a/internal/manifests/collector/deployment_test.go
+++ b/internal/manifests/collector/deployment_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"testing"
@@ -16,7 +16,6 @@ import (
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 )
 
 var testTolerationValues = []v1.Toleration{
@@ -76,7 +75,7 @@ func TestDeploymentNewDefault(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -141,7 +140,7 @@ func TestDeploymentPodAnnotations(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -190,7 +189,7 @@ func TestDeploymenttPodSecurityContext(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := Deployment(params)
@@ -222,7 +221,7 @@ func TestDeploymentUpdateStrategy(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := Deployment(params)
@@ -246,7 +245,7 @@ func TestDeploymentHostNetwork(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -272,7 +271,7 @@ func TestDeploymentHostNetwork(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -300,7 +299,7 @@ func TestDeploymentFilterLabels(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := Deployment(params)
@@ -331,7 +330,7 @@ func TestDeploymentFilterAnnotations(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := Deployment(params)
@@ -356,7 +355,7 @@ func TestDeploymentNodeSelector(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -384,7 +383,7 @@ func TestDeploymentNodeSelector(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -404,7 +403,7 @@ func TestDeploymentPriorityClassName(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -429,7 +428,7 @@ func TestDeploymentPriorityClassName(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -449,7 +448,7 @@ func TestDeploymentAffinity(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -472,7 +471,7 @@ func TestDeploymentAffinity(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -493,7 +492,7 @@ func TestDeploymentTerminationGracePeriodSeconds(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -518,7 +517,7 @@ func TestDeploymentTerminationGracePeriodSeconds(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -549,7 +548,7 @@ func TestDeploymentSetInitContainer(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -576,7 +575,7 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 	d1, err := Deployment(params1)
 	require.NoError(t, err)
@@ -600,7 +599,7 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 	d2, err := Deployment(params2)
 	require.NoError(t, err)
@@ -632,7 +631,7 @@ func TestDeploymentAdditionalContainers(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -660,7 +659,7 @@ func TestDeploymentShareProcessNamespace(t *testing.T) {
 	params1 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol1,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := Deployment(params1)
@@ -684,7 +683,7 @@ func TestDeploymentShareProcessNamespace(t *testing.T) {
 	params2 := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol2,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := Deployment(params2)
@@ -713,7 +712,7 @@ func TestDeploymentDNSConfig(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
diff --git a/internal/manifests/collector/horizontalpodautoscaler_test.go b/internal/manifests/collector/horizontalpodautoscaler_test.go
index 1b21429e..f8decde6 100644
--- a/internal/manifests/collector/horizontalpodautoscaler_test.go
+++ b/internal/manifests/collector/horizontalpodautoscaler_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"testing"
@@ -14,7 +14,6 @@ import (
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 )
 
 func TestHPA(t *testing.T) {
@@ -75,7 +74,7 @@ func TestHPA(t *testing.T) {
 							},
 						},
 					},
-					Log: logger,
+					Log: testLogger,
 				}
 				hpa, err := HorizontalPodAutoscaler(params)
 				require.NoError(t, err)
diff --git a/internal/manifests/collector/ingress_test.go b/internal/manifests/collector/ingress_test.go
index a5605bf9..279fb4b1 100644
--- a/internal/manifests/collector/ingress_test.go
+++ b/internal/manifests/collector/ingress_test.go
@@ -24,7 +24,7 @@ func TestDesiredIngresses(t *testing.T) {
 	t.Run("should return nil invalid ingress type", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{
 					Ingress: v1beta1.Ingress{
@@ -42,7 +42,7 @@ func TestDesiredIngresses(t *testing.T) {
 	t.Run("should return nil, no ingress set", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{
 					Mode: "Deployment",
@@ -58,7 +58,7 @@ func TestDesiredIngresses(t *testing.T) {
 	t.Run("should return nil unable to parse receiver ports", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{
 					Config: v1beta1.Config{},
diff --git a/internal/manifests/collector/poddisruptionbudget_test.go b/internal/manifests/collector/poddisruptionbudget_test.go
index 3db8ed08..027ce237 100644
--- a/internal/manifests/collector/poddisruptionbudget_test.go
+++ b/internal/manifests/collector/poddisruptionbudget_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"testing"
@@ -14,7 +14,6 @@ import (
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 )
 
 func TestPDB(t *testing.T) {
@@ -114,7 +113,7 @@ func TestPDB(t *testing.T) {
 				otelcol.Spec.PodDisruptionBudget = test.spec.DeepCopy()
 				configuration := config.New()
 				pdb, err := PodDisruptionBudget(manifests.Params{
-					Log:     logger,
+					Log:     testLogger,
 					Config:  configuration,
 					OtelCol: otelcol,
 				})
diff --git a/internal/manifests/collector/route_test.go b/internal/manifests/collector/route_test.go
index 235772c4..7cec7800 100644
--- a/internal/manifests/collector/route_test.go
+++ b/internal/manifests/collector/route_test.go
@@ -24,7 +24,7 @@ func TestDesiredRoutes(t *testing.T) {
 	t.Run("should return nil invalid ingress type", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{
 					Ingress: v1beta1.Ingress{
@@ -42,7 +42,7 @@ func TestDesiredRoutes(t *testing.T) {
 	t.Run("should return nil unable to parse receiver ports", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{
 					Config: v1beta1.Config{},
diff --git a/internal/manifests/collector/service_test.go b/internal/manifests/collector/service_test.go
index 3bdc92fa..bc202cfa 100644
--- a/internal/manifests/collector/service_test.go
+++ b/internal/manifests/collector/service_test.go
@@ -129,7 +129,7 @@ func TestFilterPort(t *testing.T) {
 	}
 	for _, test := range tests {
 		t.Run(test.name, func(t *testing.T) {
-			actual := filterPort(logger, test.candidate, test.portNumbers, test.portNames)
+			actual := filterPort(testLogger, test.candidate, test.portNumbers, test.portNames)
 			if test.expected != (v1.ServicePort{}) {
 				assert.Equal(t, test.expected, *actual)
 				return
@@ -145,7 +145,7 @@ func TestDesiredService(t *testing.T) {
 	t.Run("should return nil service for unknown receiver and protocol", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{Config: v1beta1.Config{}},
 			},
@@ -220,7 +220,7 @@ func TestDesiredService(t *testing.T) {
 	t.Run("should return service with OTLP ports", func(t *testing.T) {
 		params := manifests.Params{
 			Config: config.Config{},
-			Log:    logger,
+			Log:    testLogger,
 			OtelCol: v1beta1.OpenTelemetryCollector{
 				Spec: v1beta1.OpenTelemetryCollectorSpec{Config: v1beta1.Config{
 					Receivers: v1beta1.AnyConfig{
@@ -321,7 +321,7 @@ func TestExtensionService(t *testing.T) {
 			name: "when the extension has http endpoint",
 			params: manifests.Params{
 				Config: config.Config{},
-				Log:    logger,
+				Log:    testLogger,
 				OtelCol: v1beta1.OpenTelemetryCollector{
 					ObjectMeta: metav1.ObjectMeta{
 						Name: "test",
@@ -358,7 +358,7 @@ func TestExtensionService(t *testing.T) {
 			name: "when the extension has grpc endpoint",
 			params: manifests.Params{
 				Config: config.Config{},
-				Log:    logger,
+				Log:    testLogger,
 				OtelCol: v1beta1.OpenTelemetryCollector{
 					ObjectMeta: metav1.ObjectMeta{
 						Name: "test",
@@ -395,7 +395,7 @@ func TestExtensionService(t *testing.T) {
 			name: "when the extension has both http and grpc endpoint",
 			params: manifests.Params{
 				Config: config.Config{},
-				Log:    logger,
+				Log:    testLogger,
 				OtelCol: v1beta1.OpenTelemetryCollector{
 					ObjectMeta: metav1.ObjectMeta{
 						Name: "test",
@@ -435,7 +435,7 @@ func TestExtensionService(t *testing.T) {
 			name: "when the extension has no extensions defined",
 			params: manifests.Params{
 				Config: config.Config{},
-				Log:    logger,
+				Log:    testLogger,
 				OtelCol: v1beta1.OpenTelemetryCollector{
 					ObjectMeta: metav1.ObjectMeta{
 						Name: "test",
@@ -458,7 +458,7 @@ func TestExtensionService(t *testing.T) {
 			name: "when the extension has no endpoint defined",
 			params: manifests.Params{
 				Config: config.Config{},
-				Log:    logger,
+				Log:    testLogger,
 				OtelCol: v1beta1.OpenTelemetryCollector{
 					ObjectMeta: metav1.ObjectMeta{
 						Name: "test",
diff --git a/internal/manifests/collector/statefulset_test.go b/internal/manifests/collector/statefulset_test.go
index 042cacfb..a80060b0 100644
--- a/internal/manifests/collector/statefulset_test.go
+++ b/internal/manifests/collector/statefulset_test.go
@@ -1,7 +1,7 @@
 // Copyright The OpenTelemetry Authors
 // SPDX-License-Identifier: Apache-2.0
 
-package collector_test
+package collector
 
 import (
 	"testing"
@@ -10,14 +10,12 @@ import (
 	"github.com/stretchr/testify/require"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
-	v1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/api/resource"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
 	"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
 	"github.com/open-telemetry/opentelemetry-operator/internal/config"
 	"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
-	. "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector"
 )
 
 func TestStatefulSetNewDefault(t *testing.T) {
@@ -39,7 +37,7 @@ func TestStatefulSetNewDefault(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -111,7 +109,7 @@ func TestStatefulSetReplicas(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -150,7 +148,7 @@ func TestStatefulSetVolumeClaimTemplates(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -188,7 +186,7 @@ func TestStatefulSetPeristentVolumeRetentionPolicy(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -224,7 +222,7 @@ func TestStatefulSetPodAnnotations(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -257,7 +255,7 @@ func TestStatefulSetPodSecurityContext(t *testing.T) {
 		},
 		Spec: v1beta1.OpenTelemetryCollectorSpec{
 			OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
-				PodSecurityContext: &v1.PodSecurityContext{
+				PodSecurityContext: &corev1.PodSecurityContext{
 					RunAsNonRoot: &runAsNonRoot,
 					RunAsUser:    &runAsUser,
 					RunAsGroup:   &runasGroup,
@@ -271,7 +269,7 @@ func TestStatefulSetPodSecurityContext(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := StatefulSet(params)
@@ -295,14 +293,14 @@ func TestStatefulSetHostNetwork(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := StatefulSet(params1)
 	require.NoError(t, err)
 
 	assert.Equal(t, d1.Spec.Template.Spec.HostNetwork, false)
-	assert.Equal(t, d1.Spec.Template.Spec.DNSPolicy, v1.DNSClusterFirst)
+	assert.Equal(t, d1.Spec.Template.Spec.DNSPolicy, corev1.DNSClusterFirst)
 
 	// Test hostNetwork=true
 	otelcol2 := v1beta1.OpenTelemetryCollector{
@@ -321,13 +319,13 @@ func TestStatefulSetHostNetwork(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := StatefulSet(params2)
 	require.NoError(t, err)
 	assert.Equal(t, d2.Spec.Template.Spec.HostNetwork, true)
-	assert.Equal(t, d2.Spec.Template.Spec.DNSPolicy, v1.DNSClusterFirstWithHostNet)
+	assert.Equal(t, d2.Spec.Template.Spec.DNSPolicy, corev1.DNSClusterFirstWithHostNet)
 }
 
 func TestStatefulSetFilterLabels(t *testing.T) {
@@ -349,7 +347,7 @@ func TestStatefulSetFilterLabels(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := StatefulSet(params)
@@ -380,7 +378,7 @@ func TestStatefulSetFilterAnnotations(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d, err := StatefulSet(params)
@@ -405,7 +403,7 @@ func TestStatefulSetNodeSelector(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := StatefulSet(params1)
@@ -433,7 +431,7 @@ func TestStatefulSetNodeSelector(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := StatefulSet(params2)
@@ -453,7 +451,7 @@ func TestStatefulSetPriorityClassName(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	sts1, err := StatefulSet(params1)
@@ -478,7 +476,7 @@ func TestStatefulSetPriorityClassName(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	sts2, err := StatefulSet(params2)
@@ -498,7 +496,7 @@ func TestStatefulSetAffinity(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	sts1, err := Deployment(params1)
@@ -521,7 +519,7 @@ func TestStatefulSetAffinity(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	sts2, err := StatefulSet(params2)
@@ -539,7 +537,7 @@ func TestStatefulSetInitContainer(t *testing.T) {
 		},
 		Spec: v1beta1.OpenTelemetryCollectorSpec{
 			OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
-				InitContainers: []v1.Container{
+				InitContainers: []corev1.Container{
 					{
 						Name: "test",
 					},
@@ -552,7 +550,7 @@ func TestStatefulSetInitContainer(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -579,7 +577,7 @@ func TestStatefulSetTopologySpreadConstraints(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 	s1, err := StatefulSet(params1)
 	require.NoError(t, err)
@@ -603,7 +601,7 @@ func TestStatefulSetTopologySpreadConstraints(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	s2, err := StatefulSet(params2)
@@ -623,7 +621,7 @@ func TestStatefulSetAdditionalContainers(t *testing.T) {
 		},
 		Spec: v1beta1.OpenTelemetryCollectorSpec{
 			OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
-				AdditionalContainers: []v1.Container{
+				AdditionalContainers: []corev1.Container{
 					{
 						Name: "test",
 					},
@@ -636,7 +634,7 @@ func TestStatefulSetAdditionalContainers(t *testing.T) {
 	params := manifests.Params{
 		OtelCol: otelcol,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
@@ -648,7 +646,7 @@ func TestStatefulSetAdditionalContainers(t *testing.T) {
 	assert.Equal(t, "8888", s.Spec.Template.Annotations["prometheus.io/port"])
 	assert.Equal(t, "/metrics", s.Spec.Template.Annotations["prometheus.io/path"])
 	assert.Len(t, s.Spec.Template.Spec.Containers, 2)
-	assert.Equal(t, v1.Container{Name: "test"}, s.Spec.Template.Spec.Containers[0])
+	assert.Equal(t, corev1.Container{Name: "test"}, s.Spec.Template.Spec.Containers[0])
 }
 
 func TestStatefulSetShareProcessNamespace(t *testing.T) {
@@ -664,7 +662,7 @@ func TestStatefulSetShareProcessNamespace(t *testing.T) {
 	params1 := manifests.Params{
 		OtelCol: otelcol1,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d1, err := StatefulSet(params1)
@@ -688,7 +686,7 @@ func TestStatefulSetShareProcessNamespace(t *testing.T) {
 	params2 := manifests.Params{
 		OtelCol: otelcol2,
 		Config:  cfg,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	d2, err := StatefulSet(params2)
@@ -705,7 +703,7 @@ func TestStatefulSetDNSConfig(t *testing.T) {
 		},
 		Spec: v1beta1.OpenTelemetryCollectorSpec{
 			OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{
-				PodDNSConfig: v1.PodDNSConfig{
+				PodDNSConfig: corev1.PodDNSConfig{
 					Nameservers: []string{"8.8.8.8"},
 					Searches:    []string{"my.dns.search.suffix"},
 				},
@@ -717,13 +715,13 @@ func TestStatefulSetDNSConfig(t *testing.T) {
 	params := manifests.Params{
 		Config:  cfg,
 		OtelCol: otelcol,
-		Log:     logger,
+		Log:     testLogger,
 	}
 
 	// test
 	d, err := StatefulSet(params)
 	require.NoError(t, err)
 	assert.Equal(t, "my-instance-collector", d.Name)
-	assert.Equal(t, v1.DNSPolicy("None"), d.Spec.Template.Spec.DNSPolicy)
+	assert.Equal(t, corev1.DNSPolicy("None"), d.Spec.Template.Spec.DNSPolicy)
 	assert.Equal(t, d.Spec.Template.Spec.DNSConfig.Nameservers, []string{"8.8.8.8"})
 }
diff --git a/internal/manifests/collector/suite_test.go b/internal/manifests/collector/suite_test.go
index 3b225dc9..e5873a7b 100644
--- a/internal/manifests/collector/suite_test.go
+++ b/internal/manifests/collector/suite_test.go
@@ -23,7 +23,7 @@ import (
 )
 
 var (
-	logger      = logf.Log.WithName("unit-tests")
+	testLogger  = logf.Log.WithName("unit-tests")
 	instanceUID = uuid.NewUUID()
 )
 
@@ -86,7 +86,7 @@ func paramsWithMode(mode v1beta1.Mode) manifests.Params {
 				Mode:   mode,
 			},
 		},
-		Log:      logger,
+		Log:      testLogger,
 		Recorder: record.NewFakeRecorder(10),
 	}
 }
@@ -156,7 +156,7 @@ func newParams(taContainerImage string, file string, options ...config.Option) (
 				Config: colCfg,
 			},
 		},
-		Log: logger,
+		Log: testLogger,
 	}
 	targetAllocator, err := TargetAllocator(params)
 	if err == nil {
diff --git a/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml
index 952030b8..bdf72a60 100755
--- a/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml
+++ b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml
@@ -108,8 +108,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-apache
diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml
index e99a849d..44e9d61c 100755
--- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml
+++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml
@@ -111,8 +111,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-apache-multi
@@ -120,15 +120,12 @@ spec:
   - name: step-03
     try:
       - command:
-          env:
-          - name: appnamespace
-            value: ($namespace)
           entrypoint: kubectl
           args:
             - get
             - pod
             - -n
-            - $appnamespace
+            - ${NAMESPACE}
             - -l
             - app=my-apache-multi
             - -o
@@ -222,8 +219,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-apache-multi
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 3e3f2c7a..83d8f256 100755
--- a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml
+++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml
@@ -109,8 +109,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-nginx-contnr-secctx
diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml
index 12bbf077..5fbf38c5 100755
--- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml
+++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml
@@ -109,8 +109,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-nginx-multi
@@ -217,8 +217,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-nginx-multi
diff --git a/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml
index a2f12929..ca4970e6 100755
--- a/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml
+++ b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml
@@ -109,8 +109,8 @@ spec:
             ($error == null): true
       - assert:
           resource:
-            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
-            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `0`): true
+            ($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `0`): true
     catch:
       - podLogs:
           selector: app=my-nginx
diff --git a/tests/e2e/smoke-daemonset/00-assert.yaml b/tests/e2e/smoke-daemonset/00-assert.yaml
index b509ca90..f7e76e77 100644
--- a/tests/e2e/smoke-daemonset/00-assert.yaml
+++ b/tests/e2e/smoke-daemonset/00-assert.yaml
@@ -11,6 +11,21 @@ spec:
 status:
   numberMisscheduled: 0
   (desiredNumberScheduled == numberReady): true
+
+---
+apiVersion: v1
+kind: Pod
+metadata:
+  labels:
+    app.kubernetes.io/component: opentelemetry-collector
+    app.kubernetes.io/managed-by: opentelemetry-operator
+    app.kubernetes.io/name: daemonset-test-collector
+status:
+  containerStatuses:
+  - ready: true
+    started: true
+  phase: Running
+
 ---
 apiVersion: opentelemetry.io/v1beta1
 kind: OpenTelemetryCollector
@@ -18,7 +33,7 @@ metadata:
   name: daemonset-test
 status:
   (starts_with(image, 'ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector')): true
-  (version != ''): true
   scale:
-    replicas: 1
-    statusReplicas: "1/1"
+    (replicas >= `1`): true
+    (statusReplicas != ''): true
+  (version != ''): true