github.com/netdata/go.d.plugin@v0.58.1/agent/discovery/sd/kubernetes/config.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package kubernetes
     4  
     5  import "errors"
     6  
     7  type Config struct {
     8  	APIServer  string         `yaml:"api_server"` // TODO: not used
     9  	Namespaces []string       `yaml:"namespaces"`
    10  	Pod        *PodConfig     `yaml:"pod"`
    11  	Service    *ServiceConfig `yaml:"service"`
    12  }
    13  
    14  type PodConfig struct {
    15  	Tags      string `yaml:"tags"`
    16  	LocalMode bool   `yaml:"local_mode"`
    17  	Selector  struct {
    18  		Label string `yaml:"label"`
    19  		Field string `yaml:"field"`
    20  	} `yaml:"selector"`
    21  }
    22  
    23  type ServiceConfig struct {
    24  	Tags     string `yaml:"tags"`
    25  	Selector struct {
    26  		Label string `yaml:"label"`
    27  		Field string `yaml:"field"`
    28  	} `yaml:"selector"`
    29  }
    30  
    31  func validateConfig(cfg Config) error {
    32  	if cfg.Pod == nil && cfg.Service == nil {
    33  		return errors.New("no discoverers configured")
    34  	}
    35  
    36  	return nil
    37  }