Skip to content

Commit

Permalink
move default values to kubeadm.go
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Oct 4, 2024
1 parent 0313e46 commit 80bd836
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@ import (
type Config struct {
k8sconfig.APIConfig `mapstructure:",squash"`
ResourceAttributes metadata.ResourceAttributesConfig `mapstructure:"resource_attributes"`
configMapName string
configMapNamespace string
}

const defaultConfigMapName = "kubeadm-config"
const defaultConfigMapNamespace = "kube-system"

func CreateDefaultConfig() Config {
return Config{
APIConfig: k8sconfig.APIConfig{AuthType: k8sconfig.AuthTypeServiceAccount},
ResourceAttributes: metadata.DefaultResourceAttributesConfig(),
configMapName: defaultConfigMapName,
configMapNamespace: defaultConfigMapNamespace,
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
)

const (
TypeStr = "kubeadm"
TypeStr = "kubeadm"
defaultConfigMapName = "kubeadm-config"
defaultConfigMapNamespace = "kube-system"
)

var _ internal.Detector = (*detector)(nil)
Expand All @@ -33,7 +35,7 @@ type detector struct {
func NewDetector(set processor.Settings, dcfg internal.DetectorConfig) (internal.Detector, error) {
cfg := dcfg.(Config)

kubeadmProvider, err := kubeadm.NewProvider(cfg.configMapName, cfg.configMapNamespace, cfg.APIConfig)
kubeadmProvider, err := kubeadm.NewProvider(defaultConfigMapName, defaultConfigMapNamespace, cfg.APIConfig)
if err != nil {
return nil, fmt.Errorf("failed creating kubeadm provider: %w", err)
}
Expand Down

0 comments on commit 80bd836

Please sign in to comment.