pricing

package
v0.29.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InstanceTypeLabel     = "instance_type"
	CapacityTypeLabel     = "capacity_type"
	RegionLabel           = "region"
	TopologyLabel         = "zone"
	InstancePriceEstimate = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: metrics.Namespace,
			Subsystem: cloudProviderSubsystem,
			Name:      "instance_type_price_estimate",
			Help:      "Estimated hourly price used when making informed decisions on node cost calculation. This is updated once on startup and then every 12 hours.",
		},
		[]string{
			InstanceTypeLabel,
			CapacityTypeLabel,
			RegionLabel,
			TopologyLabel,
		})
)

Functions

func NewAPI

func NewAPI(sess *session.Session, region string) pricingiface.PricingAPI

NewPricingAPI returns a pricing API configured based on a particular region

Types

type Controller added in v0.27.3

type Controller struct {
	// contains filtered or unexported fields
}

func NewController added in v0.27.3

func NewController(pricingProvider *Provider) *Controller

func (*Controller) Builder added in v0.27.3

func (*Controller) Name added in v0.27.3

func (c *Controller) Name() string

func (*Controller) Reconcile added in v0.27.3

func (c *Controller) Reconcile(ctx context.Context, _ reconcile.Request) (reconcile.Result, error)

type Err

type Err struct {
	// contains filtered or unexported fields
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider provides actual pricing data to the AWS cloud provider to allow it to make more informed decisions regarding which instances to launch. This is initialized at startup with a periodically updated static price list to support running in locations where pricing data is unavailable. In those cases the static pricing data provides a relative ordering that is still more accurate than our previous pricing model. In the event that a pricing update fails, the previous pricing information is retained and used which may be the static initial pricing data if pricing updates never succeed.

func NewProvider

func NewProvider(_ context.Context, pricing pricingiface.PricingAPI, ec2Api ec2iface.EC2API, region string) *Provider

func (*Provider) InstanceTypes

func (p *Provider) InstanceTypes() []string

InstanceTypes returns the list of all instance types for which either a spot or on-demand price is known.

func (*Provider) LivenessProbe

func (p *Provider) LivenessProbe(_ *http.Request) error

func (*Provider) OnDemandLastUpdated

func (p *Provider) OnDemandLastUpdated() time.Time

OnDemandLastUpdated returns the time that the on-demand pricing was last updated

func (*Provider) OnDemandPrice

func (p *Provider) OnDemandPrice(instanceType string) (float64, bool)

OnDemandPrice returns the last known on-demand price for a given instance type, returning an error if there is no known on-demand pricing for the instance type.

func (*Provider) Reset added in v0.27.3

func (p *Provider) Reset()

func (*Provider) SpotLastUpdated

func (p *Provider) SpotLastUpdated() time.Time

SpotLastUpdated returns the time that the spot pricing was last updated

func (*Provider) SpotPrice

func (p *Provider) SpotPrice(instanceType string, zone string) (float64, bool)

SpotPrice returns the last known spot price for a given instance type and zone, returning an error if there is no known spot pricing for that instance type or zone

func (*Provider) UpdateOnDemandPricing

func (p *Provider) UpdateOnDemandPricing(ctx context.Context) error

func (*Provider) UpdateSpotPricing

func (p *Provider) UpdateSpotPricing(ctx context.Context) error

nolint: gocyclo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL