From 0fd0bc8d9c0b5e495423101243ffc72afeebd21f Mon Sep 17 00:00:00 2001 From: Michal Pecenka Date: Fri, 3 Jan 2025 13:44:22 +0100 Subject: [PATCH 1/4] getting provider information using new processor --- deploy/helm/Chart.yaml | 4 +- deploy/helm/events-collector-config.yaml | 34 +++++ ...events-collector-config-map_test.yaml.snap | 136 ++++++++++++++++++ 3 files changed, 172 insertions(+), 2 deletions(-) diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml index 4c93986b..a2ec2ff4 100644 --- a/deploy/helm/Chart.yaml +++ b/deploy/helm/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: swo-k8s-collector -version: 4.3.1 -appVersion: 0.12.2 +version: 4.4.0-alpha.1 +appVersion: 0.12.3 description: SolarWinds Kubernetes Integration keywords: - monitoring diff --git a/deploy/helm/events-collector-config.yaml b/deploy/helm/events-collector-config.yaml index 20f9bcbb..31264d25 100644 --- a/deploy/helm/events-collector-config.yaml +++ b/deploy/helm/events-collector-config.yaml @@ -234,6 +234,7 @@ processors: - key: sw.k8s.log.type value: event action: insert + resource/manifest: attributes: # Collector and Manifest version @@ -257,6 +258,38 @@ processors: - key: sw.k8s.log.type value: manifest action: insert + + resourcedetection/providers: + detectors: ["ec2","azure","openshift"] + timeout: 2s + override: false + azure: + resource_attributes: + azure.vm.scaleset.name: + enabled: false + azure.vm.size: + enabled: false + host.id: + enabled: false + host.name: + enabled: false + openshift: + resource_attributes: + k8s.cluster.name: + enabled: false + ec2: + resource_attributes: + cloud.availability_zone: + enabled: false + host.id: + enabled: false + host.image.id: + enabled: false + host.name: + enabled: false + host.type: + enabled: false + batch: {{ toYaml .Values.otel.events.batch | indent 4 }} swk8sattributes: @@ -327,6 +360,7 @@ service: - transform/set_labels_and_annotations_for_entities - transform/stringify_body - resource/manifest + - resourcedetection/providers - swk8sattributes - transform/cleanup_attributes_for_nonexisting_entities {{- if not (and .Values.otel.events.enabled .Values.otel.manifests.enabled) }} diff --git a/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap b/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap index 26c23917..601e5d1f 100644 --- a/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap @@ -91,6 +91,39 @@ Custom events filter with new syntax: - action: insert key: sw.k8s.log.type value: manifest + resourcedetection/providers: + azure: + resource_attributes: + azure.vm.scaleset.name: + enabled: false + azure.vm.size: + enabled: false + host.id: + enabled: false + host.name: + enabled: false + detectors: + - ec2 + - azure + - openshift + ec2: + resource_attributes: + cloud.availability_zone: + enabled: false + host.id: + enabled: false + host.image.id: + enabled: false + host.name: + enabled: false + host.type: + enabled: false + openshift: + resource_attributes: + k8s.cluster.name: + enabled: false + override: false + timeout: 2s swk8sattributes: auth_type: serviceAccount cronjob: @@ -528,6 +561,7 @@ Custom events filter with new syntax: - transform/set_labels_and_annotations_for_entities - transform/stringify_body - resource/manifest + - resourcedetection/providers - swk8sattributes - transform/cleanup_attributes_for_nonexisting_entities - transform/scope @@ -635,6 +669,39 @@ Custom events filter with old syntax: - action: insert key: sw.k8s.log.type value: manifest + resourcedetection/providers: + azure: + resource_attributes: + azure.vm.scaleset.name: + enabled: false + azure.vm.size: + enabled: false + host.id: + enabled: false + host.name: + enabled: false + detectors: + - ec2 + - azure + - openshift + ec2: + resource_attributes: + cloud.availability_zone: + enabled: false + host.id: + enabled: false + host.image.id: + enabled: false + host.name: + enabled: false + host.type: + enabled: false + openshift: + resource_attributes: + k8s.cluster.name: + enabled: false + override: false + timeout: 2s swk8sattributes: auth_type: serviceAccount cronjob: @@ -1072,6 +1139,7 @@ Custom events filter with old syntax: - transform/set_labels_and_annotations_for_entities - transform/stringify_body - resource/manifest + - resourcedetection/providers - swk8sattributes - transform/cleanup_attributes_for_nonexisting_entities - transform/scope @@ -1172,6 +1240,39 @@ Events config should match snapshot when using default values: - action: insert key: sw.k8s.log.type value: manifest + resourcedetection/providers: + azure: + resource_attributes: + azure.vm.scaleset.name: + enabled: false + azure.vm.size: + enabled: false + host.id: + enabled: false + host.name: + enabled: false + detectors: + - ec2 + - azure + - openshift + ec2: + resource_attributes: + cloud.availability_zone: + enabled: false + host.id: + enabled: false + host.image.id: + enabled: false + host.name: + enabled: false + host.type: + enabled: false + openshift: + resource_attributes: + k8s.cluster.name: + enabled: false + override: false + timeout: 2s swk8sattributes: auth_type: serviceAccount cronjob: @@ -1608,6 +1709,7 @@ Events config should match snapshot when using default values: - transform/set_labels_and_annotations_for_entities - transform/stringify_body - resource/manifest + - resourcedetection/providers - swk8sattributes - transform/cleanup_attributes_for_nonexisting_entities - transform/scope @@ -1708,6 +1810,39 @@ Events config should not contain manifest collection pipeline when disabled: - action: insert key: sw.k8s.log.type value: manifest + resourcedetection/providers: + azure: + resource_attributes: + azure.vm.scaleset.name: + enabled: false + azure.vm.size: + enabled: false + host.id: + enabled: false + host.name: + enabled: false + detectors: + - ec2 + - azure + - openshift + ec2: + resource_attributes: + cloud.availability_zone: + enabled: false + host.id: + enabled: false + host.image.id: + enabled: false + host.name: + enabled: false + host.type: + enabled: false + openshift: + resource_attributes: + k8s.cluster.name: + enabled: false + override: false + timeout: 2s swk8sattributes: auth_type: serviceAccount cronjob: @@ -2084,6 +2219,7 @@ Events config should not contain manifest collection pipeline when disabled: - transform/set_labels_and_annotations_for_entities - transform/stringify_body - resource/manifest + - resourcedetection/providers - swk8sattributes - transform/cleanup_attributes_for_nonexisting_entities - filter/k8s_collector_config_include From 26622af61f5f7a8d154d7d15e54d1ddf92ea2b6c Mon Sep 17 00:00:00 2001 From: Michal Pecenka Date: Mon, 6 Jan 2025 10:20:36 +0100 Subject: [PATCH 2/4] comments --- deploy/helm/events-collector-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/helm/events-collector-config.yaml b/deploy/helm/events-collector-config.yaml index 31264d25..cd25c152 100644 --- a/deploy/helm/events-collector-config.yaml +++ b/deploy/helm/events-collector-config.yaml @@ -264,6 +264,7 @@ processors: timeout: 2s override: false azure: + # keep: cloud.account.id, cloud.platform, cloud.provider, cloud.region, azure.resourcegroup.name, azure.vm.name resource_attributes: azure.vm.scaleset.name: enabled: false @@ -274,10 +275,12 @@ processors: host.name: enabled: false openshift: + # keep: cloud.platform, cloud.provider, cloud.region resource_attributes: k8s.cluster.name: enabled: false ec2: + # keep: cloud.account.id, cloud.platform, cloud.provider, cloud.region resource_attributes: cloud.availability_zone: enabled: false From dbee2a82031e99ba1c660bf0f6548693be880321 Mon Sep 17 00:00:00 2001 From: Michal Pecenka Date: Mon, 6 Jan 2025 13:56:07 +0100 Subject: [PATCH 3/4] do not sent azure.vm.name --- deploy/helm/events-collector-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/helm/events-collector-config.yaml b/deploy/helm/events-collector-config.yaml index cd25c152..ae9f52bc 100644 --- a/deploy/helm/events-collector-config.yaml +++ b/deploy/helm/events-collector-config.yaml @@ -264,8 +264,10 @@ processors: timeout: 2s override: false azure: - # keep: cloud.account.id, cloud.platform, cloud.provider, cloud.region, azure.resourcegroup.name, azure.vm.name + # keep: cloud.account.id, cloud.platform, cloud.provider, cloud.region, azure.resourcegroup.name resource_attributes: + azure.vm.name: + enabled: false azure.vm.scaleset.name: enabled: false azure.vm.size: From a5535b10cea2bd6ece6549d586cbfa8dfda8303a Mon Sep 17 00:00:00 2001 From: Michal Pecenka Date: Mon, 6 Jan 2025 13:57:07 +0100 Subject: [PATCH 4/4] tests --- .../events-collector-config-map_test.yaml.snap | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap b/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap index 601e5d1f..22f56557 100644 --- a/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/events-collector-config-map_test.yaml.snap @@ -94,6 +94,8 @@ Custom events filter with new syntax: resourcedetection/providers: azure: resource_attributes: + azure.vm.name: + enabled: false azure.vm.scaleset.name: enabled: false azure.vm.size: @@ -672,6 +674,8 @@ Custom events filter with old syntax: resourcedetection/providers: azure: resource_attributes: + azure.vm.name: + enabled: false azure.vm.scaleset.name: enabled: false azure.vm.size: @@ -1243,6 +1247,8 @@ Events config should match snapshot when using default values: resourcedetection/providers: azure: resource_attributes: + azure.vm.name: + enabled: false azure.vm.scaleset.name: enabled: false azure.vm.size: @@ -1813,6 +1819,8 @@ Events config should not contain manifest collection pipeline when disabled: resourcedetection/providers: azure: resource_attributes: + azure.vm.name: + enabled: false azure.vm.scaleset.name: enabled: false azure.vm.size: