From 8266af8c477f2b39916d70288f9399bb728091f7 Mon Sep 17 00:00:00 2001 From: odubajDT Date: Mon, 30 Sep 2024 09:46:27 +0200 Subject: [PATCH] add new detector to processor factory Signed-off-by: odubajDT --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + processor/resourcedetectionprocessor/config.go | 7 +++++++ processor/resourcedetectionprocessor/doc.go | 1 + processor/resourcedetectionprocessor/factory.go | 2 ++ 8 files changed, 15 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 70a5e095cb32..2b4dce18e6be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -199,6 +199,7 @@ processor/resourcedetectionprocessor/internal/docker/ @open-teleme processor/resourcedetectionprocessor/internal/gcp/ @open-telemetry/collector-contrib-approvers processor/resourcedetectionprocessor/internal/heroku/ @open-telemetry/collector-contrib-approvers @atoulme processor/resourcedetectionprocessor/internal/k8snode/ @open-telemetry/collector-contrib-approvers +processor/resourcedetectionprocessor/internal/kubeadm/ @open-telemetry/collector-contrib-approvers processor/resourcedetectionprocessor/internal/openshift/ @open-telemetry/collector-contrib-approvers @frzifus processor/resourcedetectionprocessor/internal/system/ @open-telemetry/collector-contrib-approvers processor/resourceprocessor/ @open-telemetry/collector-contrib-approvers @dmitryax diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index b705cbecfb53..8aba4b1eaa70 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -195,6 +195,7 @@ body: - processor/resourcedetection/internal/gcp - processor/resourcedetection/internal/heroku - processor/resourcedetection/internal/k8snode + - processor/resourcedetection/internal/kubeadm - processor/resourcedetection/internal/openshift - processor/resourcedetection/internal/system - processor/routing diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 8ec681fa0a67..8273d8465d0b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -189,6 +189,7 @@ body: - processor/resourcedetection/internal/gcp - processor/resourcedetection/internal/heroku - processor/resourcedetection/internal/k8snode + - processor/resourcedetection/internal/kubeadm - processor/resourcedetection/internal/openshift - processor/resourcedetection/internal/system - processor/routing diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index b0098510b798..70288d02689a 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -189,6 +189,7 @@ body: - processor/resourcedetection/internal/gcp - processor/resourcedetection/internal/heroku - processor/resourcedetection/internal/k8snode + - processor/resourcedetection/internal/kubeadm - processor/resourcedetection/internal/openshift - processor/resourcedetection/internal/system - processor/routing diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index df65436ba755..0ab6c2ce1c4a 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -194,6 +194,7 @@ body: - processor/resourcedetection/internal/gcp - processor/resourcedetection/internal/heroku - processor/resourcedetection/internal/k8snode + - processor/resourcedetection/internal/kubeadm - processor/resourcedetection/internal/openshift - processor/resourcedetection/internal/system - processor/routing diff --git a/processor/resourcedetectionprocessor/config.go b/processor/resourcedetectionprocessor/config.go index 8dd1c1f10c8b..1f2e8a73bbdf 100644 --- a/processor/resourcedetectionprocessor/config.go +++ b/processor/resourcedetectionprocessor/config.go @@ -19,6 +19,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/heroku" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/k8snode" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/kubeadm" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/openshift" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/system" ) @@ -86,6 +87,9 @@ type DetectorConfig struct { // K8SNode contains user-specified configurations for the K8SNode detector K8SNodeConfig k8snode.Config `mapstructure:"k8snode"` + + // Kubeadm contains user-specified configurations for the Kubeadm detector + KubeadmConfig kubeadm.Config `mapstructure:"kubeadm"` } func detectorCreateDefaultConfig() DetectorConfig { @@ -104,6 +108,7 @@ func detectorCreateDefaultConfig() DetectorConfig { SystemConfig: system.CreateDefaultConfig(), OpenShiftConfig: openshift.CreateDefaultConfig(), K8SNodeConfig: k8snode.CreateDefaultConfig(), + KubeadmConfig: kubeadm.CreateDefaultConfig(), } } @@ -137,6 +142,8 @@ func (d *DetectorConfig) GetConfigFromType(detectorType internal.DetectorType) i return d.OpenShiftConfig case k8snode.TypeStr: return d.K8SNodeConfig + case kubeadm.TypeStr: + return d.KubeadmConfig default: return nil } diff --git a/processor/resourcedetectionprocessor/doc.go b/processor/resourcedetectionprocessor/doc.go index 67a30eb31cf3..91c606b11568 100644 --- a/processor/resourcedetectionprocessor/doc.go +++ b/processor/resourcedetectionprocessor/doc.go @@ -16,6 +16,7 @@ //go:generate mdatagen internal/openshift/metadata.yaml //go:generate mdatagen internal/system/metadata.yaml //go:generate mdatagen internal/k8snode/metadata.yaml +//go:generate mdatagen internal/kubeadm/metadata.yaml // package resourcedetectionprocessor implements a processor // which can be used to detect resource information from the host, diff --git a/processor/resourcedetectionprocessor/factory.go b/processor/resourcedetectionprocessor/factory.go index f08d4e1b560f..032a163ac5b9 100644 --- a/processor/resourcedetectionprocessor/factory.go +++ b/processor/resourcedetectionprocessor/factory.go @@ -29,6 +29,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/heroku" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/k8snode" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/kubeadm" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/openshift" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/system" @@ -63,6 +64,7 @@ func NewFactory() processor.Factory { system.TypeStr: system.NewDetector, openshift.TypeStr: openshift.NewDetector, k8snode.TypeStr: k8snode.NewDetector, + kubeadm.TypeStr: kubeadm.NewDetector, }) f := &factory{