Repository: open-telemetry/opentelemetry-operator (Go)

Issue:
nodeSelector from collector spec ends up in container args if using operator v0.94.0
### Component(s)

collector

### What happened?

## Description

When using operator v0.94.0 node selector from collector definition ends up appended to container args which makes it fail at startup.
Works properly with v0.93.0 operator.
I am suspecting this line but I didn't go to deep in the code https://github.com/open-telemetry/opentelemetry-operator/blob/1e80370ec4ad2483681777662fbe275b49353593/internal/api/convert/v1alpha.go#L43

## Steps to Reproduce

Run operator v0.94.0 and create OpenTelemetryCollector that has some values in spec.nodeSelector.

## Expected Result

Args should not have node selector appended to them and collector container should start.
Collector pod definition:
```
-----ommited-----
containers:
    - name: otc-container
      image: otel/opentelemetry-collector-contrib:0.94.0
      args:
        - '--config=/conf/collector.yaml'
-----ommited-----
nodeSelector:
    iaac: 'true'
    kubernetes.io/arch: arm64
-----ommited-----
```

## Actual Result

Node selector gets appended to collector container args and fails startup.
Collector pod definition:
```
-----ommited-----
containers:
    - name: otc-container
      image: otel/opentelemetry-collector-contrib:0.94.0
      args:
        - '--config=/conf/collector.yaml'
        - '--iaac=true'
        - '--kubernetes.io/arch=arm64'
-----ommited-----
nodeSelector:
    iaac: 'true'
    kubernetes.io/arch: arm64
-----ommited-----
```

### Kubernetes Version

1.28.0

### Operator version

0.94.0

### Collector version

0.94.0

### Environment information

Installed operator with helm-chart to EKS.


### Log output

```shell
Error: unknown flag: --iaac
2024/02/29 12:28:25 collector server run finished with error: unknown flag: --iaac
```


### Additional context

_No response_


Discussion:

Patch:
diff --git a/.chloggen/fix-common-fields.yaml b/.chloggen/fix-common-fields.yaml
new file mode 100755
index 0000000000..79ec215e5e
--- /dev/null
+++ b/.chloggen/fix-common-fields.yaml
@@ -0,0 +1,16 @@
+# 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. operator, target allocator, github action)
+component: operator
+
+# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: fixes an error in conversion from v1alpha1 to v1beta1
+
+# One or more tracking issues related to the change
+issues: [2689]
+
+# (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:
diff --git a/internal/api/convert/v1alpha.go b/internal/api/convert/v1alpha.go
index 3079d627fe..50a4cc57bc 100644
--- a/internal/api/convert/v1alpha.go
+++ b/internal/api/convert/v1alpha.go
@@ -40,7 +40,7 @@ func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1beta1.OpenTelemetryColle
 	out.Spec.OpenTelemetryCommonFields.ManagementState = v1beta1.ManagementStateType(copy.Spec.ManagementState)
 	out.Spec.OpenTelemetryCommonFields.Resources = copy.Spec.Resources
 	out.Spec.OpenTelemetryCommonFields.NodeSelector = copy.Spec.NodeSelector
-	out.Spec.OpenTelemetryCommonFields.Args = copy.Spec.NodeSelector
+	out.Spec.OpenTelemetryCommonFields.Args = copy.Spec.Args
 	out.Spec.OpenTelemetryCommonFields.Replicas = copy.Spec.Replicas
 
 	if copy.Spec.Autoscaler != nil {


Test patch:
diff --git a/internal/api/convert/v1alpha_test.go b/internal/api/convert/v1alpha_test.go
index 0859cb5a48..fb19862766 100644
--- a/internal/api/convert/v1alpha_test.go
+++ b/internal/api/convert/v1alpha_test.go
@@ -52,12 +52,16 @@ service:
 		cfgV1 := v1alpha1.OpenTelemetryCollector{
 			Spec: v1alpha1.OpenTelemetryCollectorSpec{
 				Config: config,
+				Args: map[string]string{
+					"test": "something",
+				},
 			},
 		}
 
 		cfgV2, err := V1Alpha1to2(cfgV1)
 		assert.Nil(t, err)
 		assert.NotNil(t, cfgV2)
+		assert.Equal(t, cfgV1.Spec.Args, cfgV2.Spec.Args)
 
 		yamlCfg, err := yaml.Marshal(&cfgV2.Spec.Config)
 		assert.Nil(t, err)