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

Issue:
When upgrading to v0.82.0, the collector cannot be created normally after adding prometheusremotewrite exporter
**helm chart version**
![image](https://github.com/open-telemetry/opentelemetry-operator/assets/83079531/65b74dd9-c2c2-4719-833e-5333775af5af)

**command**
``` bash
kubectl apply -f - <<EOF
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: demo
spec:
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    processors:
      memory_limiter:
        check_interval: 1s
        limit_percentage: 75
        spike_limit_percentage: 15
      batch:
        send_batch_size: 10000
        timeout: 10s

    exporters:
      logging:
      prometheusremotewrite/prometheus:
        endpoint: http://prometheus-server.monitoring/api/v1/write

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: [memory_limiter, batch]
          exporters: [logging]
        metrics:
          receivers: [otlp]
          processors: [memory_limiter, batch]
          exporters: [logging]
        logs:
          receivers: [otlp]
          processors: [memory_limiter, batch]
          exporters: [logging]
EOF
```

**opentelemetry-operator log**
```
{"level":"error","ts":"2023-08-13T11:52:04Z","msg":"Reconciler error","controller":"opentelemetrycollector","controllerGroup":"opentelemetry.io","contro   llerKind":"OpenTelemetryCollector","OpenTelemetryCollector":{"name":"demo","namespace":"otel-system"},"namespace":"otel-system","name":"demo","reconcile   ID":"09ae9af8-47a2-4861-a8b7-cc84087a9906","error":"failed to reconcile the expected deployments: failed to create: Deployment.apps \"demo-collector\" i   s invalid: spec.template.spec.containers[0].ports[3].containerPort: Required value","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller   .(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-   runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controll   er.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.1/pkg/   internal/controller/controller.go:226"}
```


Discussion:
From the comment above:

> failed to create: Deployment.apps \"demo-collector\" i   s invalid: spec.template.spec.containers[0].ports[3].containerPort: Required value"

@hzhhong the prometheus RW exporter is not defined in your pipeline. Did you try adding it to the pipeline? 
> Did you try adding it to the pipeline

Yes, I did. @pavolloffay 



Patch:
diff --git a/internal/manifests/collector/container.go b/internal/manifests/collector/container.go
index 946a43340d..f7e1e1b60b 100644
--- a/internal/manifests/collector/container.go
+++ b/internal/manifests/collector/container.go
@@ -220,7 +220,8 @@ func getPrometheusExporterPorts(c map[interface{}]interface{}) ([]corev1.Contain
 	if exporters, ok := c["exporters"]; ok && exporters != nil {
 		for e, exporterConfig := range exporters.(map[interface{}]interface{}) {
 			exporterName := e.(string)
-			if strings.Contains(exporterName, "prometheus") {
+			// Note that receivers, processors, exporters and/or pipelines are defined via component identifiers in type[/name] format (e.g. otlp or otlp/2). Components of a given type can be defined more than once as long as the identifiers are unique.
+			if strings.Split(exporterName, "/")[0] == "prometheus" {
 				containerPort, err := getPrometheusExporterPort(exporterConfig.(map[interface{}]interface{}))
 				if err != nil {
 					errors = append(errors,


Test patch:
diff --git a/internal/manifests/collector/container_test.go b/internal/manifests/collector/container_test.go
index 280e63d7a7..b20c2bc995 100644
--- a/internal/manifests/collector/container_test.go
+++ b/internal/manifests/collector/container_test.go
@@ -214,6 +214,38 @@ service:
 				},
 			},
 		},
+		{
+			description: "prometheus RW exporter",
+			specConfig: `exporters:
+    prometheusremotewrite/prometheus:
+        endpoint: http://prometheus-server.monitoring/api/v1/write`,
+			specPorts:     []corev1.ServicePort{},
+			expectedPorts: []corev1.ContainerPort{metricContainerPort},
+		},
+		{
+			description: "multiple prometheus exporters and prometheus RW exporter",
+			specConfig: `exporters:
+    prometheus/prod:
+        endpoint: "0.0.0.0:9090"
+    prometheus/dev:
+        endpoint: "0.0.0.0:9091"
+    prometheusremotewrite/prometheus:
+        endpoint: http://prometheus-server.monitoring/api/v1/write`,
+			specPorts: []corev1.ServicePort{},
+			expectedPorts: []corev1.ContainerPort{
+				metricContainerPort,
+				{
+					Name:          "prometheus-prod",
+					ContainerPort: 9090,
+					Protocol:      corev1.ProtocolTCP,
+				},
+				{
+					Name:          "prometheus-dev",
+					ContainerPort: 9091,
+					Protocol:      corev1.ProtocolTCP,
+				},
+			},
+		},
 	}
 
 	for _, testCase := range tests {