Skip to content

Commit

Permalink
remove updateDefaults() function
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Oct 2, 2024
1 parent dd92610 commit 99bf118
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
10 changes: 2 additions & 8 deletions processor/resourcedetectionprocessor/internal/kubeadm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 99bf118

Please sign in to comment.