From 99bf118cbe92676eedb2683fd3a3ccd5d4c26997 Mon Sep 17 00:00:00 2001 From: odubajDT Date: Wed, 2 Oct 2024 09:45:13 +0200 Subject: [PATCH] remove updateDefaults() function Signed-off-by: odubajDT --- .../internal/kubeadm/config.go | 10 ++-------- .../internal/kubeadm/config_test.go | 2 -- .../internal/kubeadm/kubeadm.go | 3 --- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/processor/resourcedetectionprocessor/internal/kubeadm/config.go b/processor/resourcedetectionprocessor/internal/kubeadm/config.go index 5b3d10cd4692..66d7155adf60 100644 --- a/processor/resourcedetectionprocessor/internal/kubeadm/config.go +++ b/processor/resourcedetectionprocessor/internal/kubeadm/config.go @@ -18,17 +18,11 @@ type Config struct { const defaultConfigMapName = "kubeadm-config" const defaultConfigMapNamespace = "kube-system" -// UpdateDefaults validates and update the default config with user's provided settings -func (c *Config) UpdateDefaults() error { - c.configMapName = defaultConfigMapName - c.configMapNamespace = defaultConfigMapNamespace - - return nil -} - func CreateDefaultConfig() Config { return Config{ APIConfig: k8sconfig.APIConfig{AuthType: k8sconfig.AuthTypeServiceAccount}, ResourceAttributes: metadata.DefaultResourceAttributesConfig(), + configMapName: defaultConfigMapName, + configMapNamespace: defaultConfigMapNamespace, } } diff --git a/processor/resourcedetectionprocessor/internal/kubeadm/config_test.go b/processor/resourcedetectionprocessor/internal/kubeadm/config_test.go index c034ff524d44..8f07cc90febb 100644 --- a/processor/resourcedetectionprocessor/internal/kubeadm/config_test.go +++ b/processor/resourcedetectionprocessor/internal/kubeadm/config_test.go @@ -11,8 +11,6 @@ import ( func TestUpdateDefaults(t *testing.T) { cfg := CreateDefaultConfig() - err := cfg.UpdateDefaults() - assert.NoError(t, err) assert.Equal(t, defaultConfigMapName, cfg.configMapName) assert.Equal(t, defaultConfigMapNamespace, cfg.configMapNamespace) } diff --git a/processor/resourcedetectionprocessor/internal/kubeadm/kubeadm.go b/processor/resourcedetectionprocessor/internal/kubeadm/kubeadm.go index 854671ed4950..41bf2d995763 100644 --- a/processor/resourcedetectionprocessor/internal/kubeadm/kubeadm.go +++ b/processor/resourcedetectionprocessor/internal/kubeadm/kubeadm.go @@ -32,9 +32,6 @@ type detector struct { func NewDetector(set processor.Settings, dcfg internal.DetectorConfig) (internal.Detector, error) { cfg := dcfg.(Config) - if err := cfg.UpdateDefaults(); err != nil { - return nil, err - } kubeadmProvider, err := kubeadm.NewProvider(cfg.configMapName, cfg.configMapNamespace, cfg.APIConfig) if err != nil {