Skip to content

Commit

Permalink
Update all references of in_cluster kubernetes config
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Jul 29, 2019
1 parent 1450f9e commit adba6b4
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 49 deletions.
2 changes: 0 additions & 2 deletions libbeat/autodiscover/providers/kubernetes/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

// Config for kubernetes autodiscover provider
type Config struct {
InCluster bool `config:"in_cluster"`
KubeConfig string `config:"kube_config"`
Host string `config:"host"`
Namespace string `config:"namespace"`
Expand All @@ -42,7 +41,6 @@ type Config struct {

func defaultConfig() *Config {
return &Config{
InCluster: true,
SyncPeriod: 10 * time.Minute,
CleanupTimeout: 60 * time.Second,
Prefix: "co.elastic",
Expand Down
5 changes: 0 additions & 5 deletions libbeat/docs/processors-using.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,6 @@ Kubernetes.
-------------------------------------------------------------------------------
processors:
- add_kubernetes_metadata:
in_cluster: true
-------------------------------------------------------------------------------

The configuration below enables the processor on a Beat running as a process on
Expand All @@ -1236,7 +1235,6 @@ the Kubernetes node.
-------------------------------------------------------------------------------
processors:
- add_kubernetes_metadata:
in_cluster: false
host: <hostname>
kube_config: ${HOME}/.kube/config
-------------------------------------------------------------------------------
Expand All @@ -1248,7 +1246,6 @@ enables ones that the user is interested in.
-------------------------------------------------------------------------------
processors:
- add_kubernetes_metadata:
in_cluster: false
host: <hostname>
kube_config: ~/.kube/config
default_indexers.enabled: false
Expand All @@ -1262,8 +1259,6 @@ processors:

The `add_kubernetes_metadata` processor has the following configuration settings:

`in_cluster`:: (Optional) Use in cluster settings for Kubernetes client, `true`
by default.
`host`:: (Optional) Identify the node where {beatname_lc} is running in case it
cannot be accurately detected, as when running {beatname_lc} in host network
mode.
Expand Down
2 changes: 0 additions & 2 deletions libbeat/docs/shared-autodiscover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ contain variables from the autodiscover event. They can be accessed under data n

The `kubernetes` autodiscover provider has the following configuration settings:

`in_cluster`:: (Optional) Use in cluster settings for Kubernetes client, `true`
by default.
`host`:: (Optional) Identify the node where {beatname_lc} is running in case it
cannot be accurately detected, as when running {beatname_lc} in host network
mode.
Expand Down
2 changes: 0 additions & 2 deletions libbeat/processors/add_kubernetes_metadata/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
)

type kubeAnnotatorConfig struct {
InCluster bool `config:"in_cluster"`
KubeConfig string `config:"kube_config"`
Host string `config:"host"`
Namespace string `config:"namespace"`
Expand All @@ -46,7 +45,6 @@ type PluginConfig []map[string]common.Config

func defaultKubernetesAnnotatorConfig() kubeAnnotatorConfig {
return kubeAnnotatorConfig{
InCluster: true,
SyncPeriod: 10 * time.Minute,
CleanupTimeout: 60 * time.Second,
DefaultMatchers: Enabled{true},
Expand Down
15 changes: 1 addition & 14 deletions libbeat/processors/add_kubernetes_metadata/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package add_kubernetes_metadata

import (
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -61,11 +60,6 @@ func New(cfg *common.Config) (processors.Processor, error) {
return nil, fmt.Errorf("fail to unpack the kubernetes configuration: %s", err)
}

err = validate(config)
if err != nil {
return nil, err
}

//Load default indexer configs
if config.DefaultIndexers.Enabled == true {
Indexing.RLock()
Expand Down Expand Up @@ -102,7 +96,7 @@ func New(cfg *common.Config) (processors.Processor, error) {
return nil, err
}

config.Host = kubernetes.DiscoverKubernetesNode(config.Host, config.InCluster, client)
config.Host = kubernetes.DiscoverKubernetesNode(config.Host, kubernetes.IsInCluster(config.KubeConfig), client)

logp.Debug("kubernetes", "Using host: %s", config.Host)
logp.Debug("kubernetes", "Initializing watcher")
Expand Down Expand Up @@ -179,10 +173,3 @@ func (k *kubernetesAnnotator) removePod(pod *kubernetes.Pod) {
func (*kubernetesAnnotator) String() string {
return "add_kubernetes_metadata"
}

func validate(config kubeAnnotatorConfig) error {
if !config.InCluster && config.KubeConfig == "" {
return errors.New("`kube_config` path can't be empty when in_cluster is set to false")
}
return nil
}
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/kubernetes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ metricbeat.modules:
# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand All @@ -97,7 +96,6 @@ metricbeat.modules:
# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ metricbeat.modules:

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand All @@ -453,7 +452,6 @@ metricbeat.modules:

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/module/kubernetes/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand All @@ -37,7 +36,6 @@

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand Down
3 changes: 0 additions & 3 deletions metricbeat/module/kubernetes/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

# Enriching parameters:
#add_metadata: true
#in_cluster: true
#labels.dedot: true
#annotations.dedot: true
# When used outside the cluster:
#in_cluster: false
#host: node_name
#kube_config: ~/.kube/config

Expand All @@ -36,7 +34,6 @@
# period: 10s
# hosts: ["kube-state-metrics:8080"]
# add_metadata: true
# in_cluster: true

# Kubernetes events
#- module: kubernetes
Expand Down
10 changes: 0 additions & 10 deletions metricbeat/module/kubernetes/event/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
package event

import (
"errors"
"time"
)

type kubeEventsConfig struct {
InCluster bool `config:"in_cluster"`
KubeConfig string `config:"kube_config"`
Namespace string `config:"namespace"`
SyncPeriod time.Duration `config:"sync_period"`
Expand All @@ -37,16 +35,8 @@ type Enabled struct {

func defaultKubernetesEventsConfig() kubeEventsConfig {
return kubeEventsConfig{
InCluster: true,
SyncPeriod: 10 * time.Minute,
LabelsDedot: true,
AnnotationsDedot: true,
}
}

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
}
3 changes: 0 additions & 3 deletions metricbeat/modules.d/kubernetes.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

# Enriching parameters:
#add_metadata: true
#in_cluster: true
#labels.dedot: true
#annotations.dedot: true
# When used outside the cluster:
#in_cluster: false
#host: node_name
#kube_config: ~/.kube/config

Expand All @@ -39,7 +37,6 @@
# period: 10s
# hosts: ["kube-state-metrics:8080"]
# add_metadata: true
# in_cluster: true

# Kubernetes events
#- module: kubernetes
Expand Down
2 changes: 0 additions & 2 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ metricbeat.modules:

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand All @@ -523,7 +522,6 @@ metricbeat.modules:

# Enriching parameters:
add_metadata: true
in_cluster: true
# When used outside the cluster:
#host: node_name
#kube_config: ~/.kube/config
Expand Down

0 comments on commit adba6b4

Please sign in to comment.