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

Merge pull request #823 from kubecost/AjayTripathy-emit-pvid

emit pv id even if there is not yet cost data
Ajay Tripathy 5 лет назад
Родитель
Сommit
3c73b44383
2 измененных файлов с 3 добавлено и 2 удалено
  1. 2 1
      pkg/cloud/awsprovider.go
  2. 1 1
      pkg/costmodel/costmodel.go

+ 2 - 1
pkg/cloud/awsprovider.go

@@ -5,7 +5,6 @@ import (
 	"compress/gzip"
 	"encoding/csv"
 	"fmt"
-	"github.com/aws/aws-sdk-go/aws/endpoints"
 	"io"
 	"io/ioutil"
 	"net/http"
@@ -16,6 +15,8 @@ import (
 	"sync"
 	"time"
 
+	"github.com/aws/aws-sdk-go/aws/endpoints"
+
 	"k8s.io/klog"
 
 	"github.com/kubecost/cost-model/pkg/clustercache"

+ 1 - 1
pkg/costmodel/costmodel.go

@@ -899,6 +899,7 @@ func GetPVCost(pv *costAnalyzerCloud.PV, kpv *v1.PersistentVolume, cp costAnalyz
 		return err
 	}
 	key := cp.GetPVKey(kpv, pv.Parameters, defaultRegion)
+	pv.ProviderID = key.ID()
 	pvWithCost, err := cp.PVPricing(key)
 	if err != nil {
 		pv.Cost = cfg.Storage
@@ -909,7 +910,6 @@ func GetPVCost(pv *costAnalyzerCloud.PV, kpv *v1.PersistentVolume, cp costAnalyz
 		return nil // set default cost
 	}
 	pv.Cost = pvWithCost.Cost
-	pv.ProviderID = key.ID()
 	return nil
 }