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

fix logs, actually allow x-cluster configs on gcp

AjayTripathy 6 лет назад
Родитель
Сommit
57f263a730
3 измененных файлов с 6 добавлено и 17 удалено
  1. 1 1
      pkg/cloud/awsprovider.go
  2. 0 16
      pkg/cloud/gcpprovider.go
  3. 5 0
      pkg/cloud/provider.go

+ 1 - 1
pkg/cloud/awsprovider.go

@@ -1204,7 +1204,7 @@ func (a *AWS) ExternalAllocations(start string, end string, aggregators []string
 	}
 
 	if customPricing.BillingDataDataset != "" { // There is GCP data, meaning someone has tried to configure a GCP out-of-cluster allocation
-		gcp, err := NewCrossClusterProvider("aws", "aws.json", a.Clientset)
+		gcp, err := NewCrossClusterProvider("gcp", "gcp.json", a.Clientset)
 		if err != nil {
 			klog.Infof("Could not instantiate cross-cluster provider %s", err.Error())
 		}

+ 0 - 16
pkg/cloud/gcpprovider.go

@@ -73,7 +73,6 @@ func multiKeyGCPAllocationToOutOfClusterAllocation(gcpAlloc multiKeyGCPAllocatio
 	var environment string
 	var usedAggregatorName string
 	if gcpAlloc.Keys.Valid {
-		klog.Infof("VALID!!!!!!!!")
 		err := json.Unmarshal([]byte(gcpAlloc.Keys.StringVal), &keys)
 		if err != nil {
 			klog.Infof("Invalid unmarshaling response from BigQuery filtered query: %s", err.Error())
@@ -84,8 +83,6 @@ func multiKeyGCPAllocationToOutOfClusterAllocation(gcpAlloc multiKeyGCPAllocatio
 				if label["key"] == aggregatorName {
 					environment = label["value"]
 					usedAggregatorName = label["key"]
-					klog.Infof("ENVIRONMENT: %s", environment)
-					klog.Infof("AGGREGATOR NAME: %s", usedAggregatorName)
 					break keyloop
 				}
 			}
@@ -344,19 +341,6 @@ func (gcp *GCP) ExternalAllocations(start string, end string, aggregators []stri
 	return s, qerr
 }
 
-/*
-  (SELECT
-    service.description as service,
-    TO_JSON_STRING(labels) as gl,
-    SUM(cost)
-  FROM  `guestbook-227502.billing_data.gcp_billing_export_v1_01AC9F_74CF1D_5565A2`
-  WHERE
-    EXISTS (SELECT * FROM UNNEST(labels) AS l WHERE l.key = "kubernetes_namespace" AND l.value = "kubecost")
-    AND EXISTS(SELECT * FROM UNNEST(labels) AS l2 WHERE l2.key = "kubernetes_label_app")
-    AND usage_start_time >= "2020-02-10" AND usage_start_time < "2020-02-13"
-	GROUP BY  service,gl)
-*/
-
 func (gcp *GCP) multiLabelQuery(query string, aggregators []string) ([]*OutOfClusterAllocation, error) {
 	c, err := gcp.Config.GetCustomPricingData()
 	if err != nil {

+ 5 - 0
pkg/cloud/provider.go

@@ -211,6 +211,11 @@ func NewCrossClusterProvider(ctype string, overrideConfigPath string, cache clus
 			Clientset: cache,
 			Config:    NewProviderConfig(overrideConfigPath),
 		}, nil
+	} else if ctype == "gcp" {
+		return &GCP{
+			Clientset: cache,
+			Config:    NewProviderConfig(overrideConfigPath),
+		}, nil
 	}
 	return &CustomProvider{
 		Clientset: cache,