Skip to content

Commit

Permalink
Pass correctly overrides to PrometheusController
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaniuk committed Sep 24, 2019
1 parent 5fb2154 commit 1f61471
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clusterloader2/cmd/clusterloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ func main() {
var prometheusController *prometheus.PrometheusController
var prometheusFramework *framework.Framework
if clusterLoaderConfig.PrometheusConfig.EnableServer {
// Pass overrides to prometheus controller
clusterLoaderConfig.TestScenario.OverridePaths = testOverridePaths
if prometheusController, err = prometheus.NewPrometheusController(&clusterLoaderConfig); err != nil {
klog.Exitf("Error while creating Prometheus Controller: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions clusterloader2/pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type PrometheusConfig struct {
ScrapeEtcd bool
ScrapeNodeExporter bool
ScrapeKubelets bool
ScrapeKubeProxy bool
}

// GetMasterIp returns the first master ip, added for backward compatibility.
Expand Down
7 changes: 7 additions & 0 deletions clusterloader2/pkg/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func InitFlags(p *config.PrometheusConfig) {
flags.BoolEnvVar(&p.ScrapeEtcd, "prometheus-scrape-etcd", "PROMETHEUS_SCRAPE_ETCD", false, "Whether to scrape etcd metrics.")
flags.BoolEnvVar(&p.ScrapeNodeExporter, "prometheus-scrape-node-exporter", "PROMETHEUS_SCRAPE_NODE_EXPORTER", false, "Whether to scrape node exporter metrics.")
flags.BoolEnvVar(&p.ScrapeKubelets, "prometheus-scrape-kubelets", "PROMETHEUS_SCRAPE_KUBELETS", false, "Whether to scrape kubelets. Experimental, may not work in larger clusters. Requires heapster node to be at least n1-standard-4, which needs to be provided manually.")
flags.BoolEnvVar(&p.ScrapeKubeProxy, "prometheus-scrape-kube-proxy", "PROMETHEUS_SCRAPE_KUBE_PROXY", true, "Whether to scrape kube proxy.")
}

// PrometheusController is a util for managing (setting up / tearing down) the prometheus stack in
Expand Down Expand Up @@ -106,6 +107,12 @@ func NewPrometheusController(clusterLoaderConfig *config.ClusterLoaderConfig) (p
// Backward compatibility.
clusterLoaderConfig.PrometheusConfig.ScrapeNodeExporter = mapping["PROMETHEUS_SCRAPE_NODE_EXPORTER"].(bool)
}
if _, exists := mapping["PROMETHEUS_SCRAPE_KUBE_PROXY"]; !exists {
mapping["PROMETHEUS_SCRAPE_KUBE_PROXY"] = clusterLoaderConfig.PrometheusConfig.ScrapeKubeProxy
} else {
// Backward compatibility.
clusterLoaderConfig.PrometheusConfig.ScrapeKubeProxy = mapping["PROMETHEUS_SCRAPE_KUBE_PROXY"].(bool)
}
mapping["PROMETHEUS_SCRAPE_KUBELETS"] = clusterLoaderConfig.PrometheusConfig.ScrapeKubelets
pc.templateMapping = mapping

Expand Down
1 change: 1 addition & 0 deletions verify/verify-flags/known-flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ping-server-bind-address
ping-sleep-duration
prometheus-scrape-etcd
prometheus-scrape-kubelets
prometheus-scrape-kube-proxy
prometheus-scrape-node-exporter
purge-after-seconds
report-dir
Expand Down

0 comments on commit 1f61471

Please sign in to comment.