From 0f46f6800c1cecf18e44d1de22f8558ab17a53ad Mon Sep 17 00:00:00 2001 From: Craig Link Date: Thu, 11 Jan 2024 23:41:45 -0800 Subject: [PATCH] chore: adjust on-demand pricing to account for a 28% compute savings plan discount --- pkg/providers/pricing/pricing.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/providers/pricing/pricing.go b/pkg/providers/pricing/pricing.go index e46cff66f9bd..0fbbe5287def 100644 --- a/pkg/providers/pricing/pricing.go +++ b/pkg/providers/pricing/pricing.go @@ -194,6 +194,7 @@ func (p *Provider) UpdateOnDemandPricing(ctx context.Context) error { return fmt.Errorf("no on-demand pricing found") } + // account for 28% compute savings plan for on-demand instances p.onDemandPrices = lo.Assign(onDemandPrices, onDemandMetalPrices) for instanceType, price := range p.onDemandPrices { InstancePriceEstimate.With(prometheus.Labels{ @@ -201,7 +202,7 @@ func (p *Provider) UpdateOnDemandPricing(ctx context.Context) error { CapacityTypeLabel: ec2.UsageClassTypeOnDemand, RegionLabel: p.region, TopologyLabel: "", - }).Set(price) + }).Set(price* 0.72) } if p.cm.HasChanged("on-demand-prices", p.onDemandPrices) { logging.FromContext(ctx).With("instance-type-count", len(p.onDemandPrices)).Debugf("updated on-demand pricing")