Просмотр исходного кода

remove commented code

Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Matt Bolt 1 год назад
Родитель
Сommit
2b60dbd2fc
1 измененных файлов с 0 добавлено и 111 удалено
  1. 0 111
      pkg/costmodel/router.go

+ 0 - 111
pkg/costmodel/router.go

@@ -965,78 +965,6 @@ func Initialize(router *httprouter.Router, additionalConfigWatchers ...*watcher.
 		panic(fatalErr)
 		panic(fatalErr)
 	}
 	}
 
 
-	/*
-		address := env.GetPrometheusServerEndpoint()
-		if address == "" {
-			log.Fatalf("No address for prometheus set in $%s. Aborting.", env.PrometheusServerEndpointEnvVar)
-		}
-
-		queryConcurrency := env.GetMaxQueryConcurrency()
-		log.Infof("Prometheus/Thanos Client Max Concurrency set to %d", queryConcurrency)
-
-		timeout := 120 * time.Second
-		keepAlive := 120 * time.Second
-		tlsHandshakeTimeout := 10 * time.Second
-		scrapeInterval := env.GetKubecostScrapeInterval()
-
-		var rateLimitRetryOpts *prom.RateLimitRetryOpts = nil
-		if env.IsPrometheusRetryOnRateLimitResponse() {
-			rateLimitRetryOpts = &prom.RateLimitRetryOpts{
-				MaxRetries:       env.GetPrometheusRetryOnRateLimitMaxRetries(),
-				DefaultRetryWait: env.GetPrometheusRetryOnRateLimitDefaultWait(),
-			}
-		}
-
-		promCli, err := prom.NewPrometheusClient(address, &prom.PrometheusClientConfig{
-			Timeout:               timeout,
-			KeepAlive:             keepAlive,
-			TLSHandshakeTimeout:   tlsHandshakeTimeout,
-			TLSInsecureSkipVerify: env.GetInsecureSkipVerify(),
-			RateLimitRetryOpts:    rateLimitRetryOpts,
-			Auth: &prom.ClientAuth{
-				Username:    env.GetDBBasicAuthUsername(),
-				Password:    env.GetDBBasicAuthUserPassword(),
-				BearerToken: env.GetDBBearerToken(),
-			},
-			QueryConcurrency:  queryConcurrency,
-			QueryLogFile:      "",
-			HeaderXScopeOrgId: env.GetPrometheusHeaderXScopeOrgId(),
-		})
-		if err != nil {
-			log.Fatalf("Failed to create prometheus client, Error: %v", err)
-		}
-
-		m, err := prom.Validate(promCli)
-		if err != nil || !m.Running {
-			if err != nil {
-				log.Errorf("Failed to query prometheus at %s. Error: %s . Troubleshooting help available at: %s", address, err.Error(), prom.PrometheusTroubleshootingURL)
-			} else if !m.Running {
-				log.Errorf("Prometheus at %s is not running. Troubleshooting help available at: %s", address, prom.PrometheusTroubleshootingURL)
-			}
-		} else {
-			log.Infof("Success: retrieved the 'up' query against prometheus at: " + address)
-		}
-
-		api := prometheusAPI.NewAPI(promCli)
-		_, err = api.Buildinfo(context.Background())
-		if err != nil {
-			log.Infof("No valid prometheus config file at %s. Error: %s . Troubleshooting help available at: %s. Ignore if using cortex/mimir/thanos here.", address, err.Error(), prom.PrometheusTroubleshootingURL)
-		} else {
-			log.Infof("Retrieved a prometheus config file from: %s", address)
-		}
-
-		if scrapeInterval == 0 {
-			scrapeInterval = time.Minute
-			// Lookup scrape interval for kubecost job, update if found
-			si, err := prom.ScrapeIntervalFor(promCli, env.GetKubecostJobName())
-			if err == nil {
-				scrapeInterval = si
-			}
-		}
-
-		log.Infof("Using scrape interval of %f", scrapeInterval.Seconds())
-	*/
-
 	// Kubernetes API setup
 	// Kubernetes API setup
 	kubeClientset, err := kubeconfig.LoadKubeClient("")
 	kubeClientset, err := kubeconfig.LoadKubeClient("")
 	if err != nil {
 	if err != nil {
@@ -1082,45 +1010,6 @@ func Initialize(router *httprouter.Router, additionalConfigWatchers ...*watcher.
 		}
 		}
 	}
 	}
 
 
-	/*
-
-		// Thanos Client
-		var thanosClient prometheus.Client
-		if thanos.IsEnabled() {
-			thanosAddress := thanos.QueryURL()
-
-			if thanosAddress != "" {
-				thanosCli, _ := thanos.NewThanosClient(thanosAddress, &prom.PrometheusClientConfig{
-					Timeout:               timeout,
-					KeepAlive:             keepAlive,
-					TLSHandshakeTimeout:   tlsHandshakeTimeout,
-					TLSInsecureSkipVerify: env.GetInsecureSkipVerify(),
-					RateLimitRetryOpts:    rateLimitRetryOpts,
-					Auth: &prom.ClientAuth{
-						Username:    env.GetMultiClusterBasicAuthUsername(),
-						Password:    env.GetMultiClusterBasicAuthPassword(),
-						BearerToken: env.GetMultiClusterBearerToken(),
-					},
-					QueryConcurrency: queryConcurrency,
-					QueryLogFile:     env.GetQueryLoggingFile(),
-				})
-
-				_, err = prom.Validate(thanosCli)
-				if err != nil {
-					log.Warnf("Failed to query Thanos at %s. Error: %s.", thanosAddress, err.Error())
-					thanosClient = thanosCli
-				} else {
-					log.Infof("Success: retrieved the 'up' query against Thanos at: " + thanosAddress)
-
-					thanosClient = thanosCli
-				}
-
-			} else {
-				log.Infof("Error resolving environment variable: $%s", env.ThanosQueryUrlEnvVar)
-			}
-		}
-	*/
-
 	// ClusterInfo Provider to provide the cluster map with local and remote cluster data
 	// ClusterInfo Provider to provide the cluster map with local and remote cluster data
 	var clusterInfoProvider clusters.ClusterInfoProvider
 	var clusterInfoProvider clusters.ClusterInfoProvider
 	if env.IsClusterInfoFileEnabled() {
 	if env.IsClusterInfoFileEnabled() {