forked from bigpigeon/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
35 lines (28 loc) · 751 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package event
import (
"errors"
"time"
"github.com/elastic/beats/libbeat/common"
)
type kubeEventsConfig struct {
InCluster bool `config:"in_cluster"`
KubeConfig string `config:"kube_config"`
Namespace string `config:"namespace"`
SyncPeriod time.Duration `config:"sync_period"`
}
type Enabled struct {
Enabled bool `config:"enabled"`
}
type PluginConfig []map[string]common.Config
func defaultKuberentesEventsConfig() kubeEventsConfig {
return kubeEventsConfig{
InCluster: true,
SyncPeriod: 1 * time.Second,
}
}
func (c kubeEventsConfig) Validate() error {
if !c.InCluster && c.KubeConfig == "" {
return errors.New("`kube_config` path can't be empty when in_cluster is set to false")
}
return nil
}