diff --git a/internal/controller/telemetry/collector_controller.go b/internal/controller/telemetry/collector_controller.go index 4c0db1c5..593a3ce5 100644 --- a/internal/controller/telemetry/collector_controller.go +++ b/internal/controller/telemetry/collector_controller.go @@ -165,7 +165,7 @@ func (r *CollectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( collector.Status.Tenants = tenantNames - if reflect.DeepEqual(*originalCollectorStatus, collector.Status) { + if !reflect.DeepEqual(*originalCollectorStatus, collector.Status) { logger.Info("updating collector status") err = r.Status().Update(ctx, collector) if err != nil { diff --git a/internal/controller/telemetry/otel_col_conf_test_fixtures/complex.yaml b/internal/controller/telemetry/otel_col_conf_test_fixtures/complex.yaml index 1505761b..a683f8ce 100644 --- a/internal/controller/telemetry/otel_col_conf_test_fixtures/complex.yaml +++ b/internal/controller/telemetry/otel_col_conf_test_fixtures/complex.yaml @@ -85,6 +85,10 @@ processors: k8sattributes: auth_type: serviceAccount extract: + labels: + - from: pod + key_regex: .* + tag_name: all_labels metadata: - k8s.pod.name - k8s.pod.uid diff --git a/internal/controller/telemetry/otel_conf_gen.go b/internal/controller/telemetry/otel_conf_gen.go index 29c472f2..db6bac69 100644 --- a/internal/controller/telemetry/otel_conf_gen.go +++ b/internal/controller/telemetry/otel_conf_gen.go @@ -346,11 +346,20 @@ func (cfgInput *OtelColConfigInput) generateDefaultKubernetesProcessor() map[str "k8s.pod.start_time", } + var defaultLabels = []map[string]string{ + { + "from": "pod", + "tag_name": "all_labels", + "key_regex": ".*", + }, + } + k8sProcessor := map[string]any{ "auth_type": "serviceAccount", "passthrough": false, "extract": map[string]any{ "metadata": defaultMetadata, + "labels": defaultLabels, }, "pod_association": defaultPodAssociation, } diff --git a/internal/controller/telemetry/otel_conf_gen_test.go b/internal/controller/telemetry/otel_conf_gen_test.go index d66f58d0..16beca52 100644 --- a/internal/controller/telemetry/otel_conf_gen_test.go +++ b/internal/controller/telemetry/otel_conf_gen_test.go @@ -142,14 +142,10 @@ func TestOtelColConfComplex(t *testing.T) { generatedIR := inputCfg.ToIntermediateRepresentation() // Final YAML - generatedYAML, err := generatedIR.ToYAML() + _, err := generatedIR.ToYAML() if err != nil { t.Fatalf("YAML formatting failed, err=%v", err) } - t.Logf(`the generated YAML is: ---- -%v ----`, generatedYAML) actualYAMLBytes, err := generatedIR.ToYAMLRepresentation() if err != nil {