Documentation
¶
Index ¶
- Constants
- func LoadFromCLI(target *Config, flagSet *pflag.FlagSet) error
- func LoadFromFile(file string, target *Config) error
- func MapToLabelSelector() mapstructure.DecodeHookFuncType
- func MapToPromConfig() mapstructure.DecodeHookFuncType
- func StringToModelDurationHookFunc() mapstructure.DecodeHookFuncType
- func ValidateConfig(config *Config) error
- type Config
- type HTTPSServerConfig
- type PrometheusCRConfig
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func LoadFromFile ¶
func MapToLabelSelector ¶ added in v0.118.0
func MapToLabelSelector() mapstructure.DecodeHookFuncType
MapToLabelSelector returns a DecodeHookFuncType that provides a mechanism for decoding both matchLabels and matchExpressions from camelcase to lowercase because we use yaml unmarshaling that supports lowercase field names if no `yaml` tag is defined and metav1.LabelSelector uses `json` tags. If both the camelcase and lowercase version is present, then the camelcase version takes precedence.
func MapToPromConfig ¶ added in v0.118.0
func MapToPromConfig() mapstructure.DecodeHookFuncType
MapToPromConfig returns a DecodeHookFuncType that provides a mechanism for decoding promconfig.Config involving its own unmarshal logic.
func StringToModelDurationHookFunc ¶ added in v0.118.0
func StringToModelDurationHookFunc() mapstructure.DecodeHookFuncType
StringToModelDurationHookFunc returns a DecodeHookFuncType that converts string to time.Duration, which can be used as model.Duration.
func ValidateConfig ¶
ValidateConfig validates the cli and file configs together.
Types ¶
type Config ¶
type Config struct {
ListenAddr string `yaml:"listen_addr,omitempty"`
KubeConfigFilePath string `yaml:"kube_config_file_path,omitempty"`
ClusterConfig *rest.Config `yaml:"-"`
RootLogger logr.Logger `yaml:"-"`
CollectorSelector *metav1.LabelSelector `yaml:"collector_selector,omitempty"`
PromConfig *promconfig.Config `yaml:"config"`
AllocationStrategy string `yaml:"allocation_strategy,omitempty"`
AllocationFallbackStrategy string `yaml:"allocation_fallback_strategy,omitempty"`
FilterStrategy string `yaml:"filter_strategy,omitempty"`
PrometheusCR PrometheusCRConfig `yaml:"prometheus_cr,omitempty"`
HTTPS HTTPSServerConfig `yaml:"https,omitempty"`
}
func CreateDefaultConfig ¶
func CreateDefaultConfig() Config
type HTTPSServerConfig ¶ added in v0.100.0
type HTTPSServerConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
ListenAddr string `yaml:"listen_addr,omitempty"`
CAFilePath string `yaml:"ca_file_path,omitempty"`
TLSCertFilePath string `yaml:"tls_cert_file_path,omitempty"`
TLSKeyFilePath string `yaml:"tls_key_file_path,omitempty"`
}
func (HTTPSServerConfig) NewTLSConfig ¶ added in v0.100.0
func (c HTTPSServerConfig) NewTLSConfig() (*tls.Config, error)
type PrometheusCRConfig ¶
type PrometheusCRConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
PodMonitorSelector *metav1.LabelSelector `yaml:"pod_monitor_selector,omitempty"`
PodMonitorNamespaceSelector *metav1.LabelSelector `yaml:"pod_monitor_namespace_selector,omitempty"`
ServiceMonitorSelector *metav1.LabelSelector `yaml:"service_monitor_selector,omitempty"`
ServiceMonitorNamespaceSelector *metav1.LabelSelector `yaml:"service_monitor_namespace_selector,omitempty"`
ScrapeConfigSelector *metav1.LabelSelector `yaml:"scrape_config_selector,omitempty"`
ScrapeConfigNamespaceSelector *metav1.LabelSelector `yaml:"scrape_config_namespace_selector,omitempty"`
ProbeSelector *metav1.LabelSelector `yaml:"probe_selector,omitempty"`
ProbeNamespaceSelector *metav1.LabelSelector `yaml:"probe_namespace_selector,omitempty"`
ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"`
}