diff --git a/cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go b/cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go index 1d47242b053f..e0bc7756d51b 100644 --- a/cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go @@ -102,7 +102,7 @@ func (gce *GceCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.N // Pricing returns pricing model for this cloud provider or error if not available. func (gce *GceCloudProvider) Pricing() (cloudprovider.PricingModel, errors.AutoscalerError) { - return NewGcePriceModel(), nil + return NewGcePriceModel(NewGcePriceInfo()), nil } // GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. diff --git a/cluster-autoscaler/cloudprovider/gce/gce_price_model.go b/cluster-autoscaler/cloudprovider/gce/gce_price_model.go index ab884b1806f4..c8d678f9c8da 100644 --- a/cluster-autoscaler/cloudprovider/gce/gce_price_model.go +++ b/cluster-autoscaler/cloudprovider/gce/gce_price_model.go @@ -34,9 +34,9 @@ type GcePriceModel struct { } // NewGcePriceModel gets a new instance of GcePriceModel -func NewGcePriceModel() *GcePriceModel { +func NewGcePriceModel(info PriceInfo) *GcePriceModel { return &GcePriceModel{ - PriceInfo: NewGcePriceInfo(), + PriceInfo: info, } } diff --git a/cluster-autoscaler/cloudprovider/gce/gce_price_model_test.go b/cluster-autoscaler/cloudprovider/gce/gce_price_model_test.go index c47628190c86..224030f420ac 100644 --- a/cluster-autoscaler/cloudprovider/gce/gce_price_model_test.go +++ b/cluster-autoscaler/cloudprovider/gce/gce_price_model_test.go @@ -175,7 +175,7 @@ func TestGetNodePrice(t *testing.T) { for tn, tc := range cases { t.Run(tn, func(t *testing.T) { - model := NewGcePriceModel() + model := NewGcePriceModel(NewGcePriceInfo()) now := time.Now() price1, err := model.NodePrice(tc.cheaperNode, now, now.Add(time.Hour)) @@ -193,7 +193,7 @@ func TestGetPodPrice(t *testing.T) { pod1 := BuildTestPod("a1", 100, 500*units.MiB) pod2 := BuildTestPod("a2", 2*100, 2*500*units.MiB) - model := NewGcePriceModel() + model := NewGcePriceModel(NewGcePriceInfo()) now := time.Now() price1, err := model.PodPrice(pod1, now, now.Add(time.Hour))