From c3ec65f7950f99c284f9c3b3b415450d2a6c5d25 Mon Sep 17 00:00:00 2001 From: jsirianni Date: Mon, 18 Dec 2023 15:08:44 -0500 Subject: [PATCH] remove cluster name from k8s operators, cluster name is not detectable from the k8s api --- operator/builtin/input/k8sevent/k8s_event.go | 1 - .../transformer/k8smetadata/k8s_metadata_decorator.go | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/operator/builtin/input/k8sevent/k8s_event.go b/operator/builtin/input/k8sevent/k8s_event.go index 3e2e3d236..0d4b434cc 100644 --- a/operator/builtin/input/k8sevent/k8s_event.go +++ b/operator/builtin/input/k8sevent/k8s_event.go @@ -288,7 +288,6 @@ func (k *K8sEvents) consumeWatchEvents(ctx context.Context, events <-chan watch. func (k *K8sEvents) populateResource(event *apiv1.Event, entry *entry.Entry) { io := event.InvolvedObject - entry.AddResourceKey("k8s.cluster.name", event.ClusterName) entry.AddResourceKey("k8s.namespace.name", io.Namespace) switch io.Kind { diff --git a/operator/builtin/transformer/k8smetadata/k8s_metadata_decorator.go b/operator/builtin/transformer/k8smetadata/k8s_metadata_decorator.go index 65595233d..b690605a4 100644 --- a/operator/builtin/transformer/k8smetadata/k8s_metadata_decorator.go +++ b/operator/builtin/transformer/k8smetadata/k8s_metadata_decorator.go @@ -2,10 +2,10 @@ package k8smetadata import ( "context" + "net/http" + "net/url" "sync" "time" - "net/url" - "net/http" "github.com/observiq/stanza/entry" "github.com/observiq/stanza/errors" @@ -121,8 +121,8 @@ func (k *K8sMetadataDecorator) Start() error { ) } - if ! k.allowProxy { - config.Proxy = func (*http.Request) (*url.URL, error) { + if !k.allowProxy { + config.Proxy = func(*http.Request) (*url.URL, error) { return nil, nil } } @@ -226,7 +226,6 @@ func (k *K8sMetadataDecorator) refreshNamespaceMetadata(ctx context.Context, nam // Cache the results cacheEntry := MetadataCacheEntry{ - ClusterName: namespaceResponse.ClusterName, ExpirationTime: time.Now().Add(k.cacheTTL), UID: string(namespaceResponse.UID), Labels: namespaceResponse.Labels, @@ -259,7 +258,6 @@ func (k *K8sMetadataDecorator) refreshPodMetadata(ctx context.Context, namespace // Create the cache entry cacheEntry := MetadataCacheEntry{ - ClusterName: podResponse.ClusterName, UID: string(podResponse.UID), ExpirationTime: time.Now().Add(k.cacheTTL), Labels: podResponse.Labels,