pricing

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package pricing periodically refreshes the instance-type catalog from Clever Cloud's public price API. It is a singleton controller: it fires once shortly after startup and then on a fixed period. A failed refresh keeps the last-known-good catalog (the binary always seeds DefaultFlavors), so the network is never on the critical path.

Index

Constants

View Source
const (
	// DefaultRefreshPeriod is how often the catalog is refreshed on success.
	DefaultRefreshPeriod = 12 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController(resolver Resolver, instanceTypeProvider *instancetype.Provider, period time.Duration) *Controller

NewController builds the refresher. A non-positive period falls back to DefaultRefreshPeriod.

func (*Controller) Name

func (c *Controller) Name() string

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context) (reconciler.Result, error)

func (*Controller) Register

func (c *Controller) Register(_ context.Context, m manager.Manager) error

type Resolver

type Resolver interface {
	Resolve(ctx context.Context) ([]instancetype.Flavor, error)
}

Resolver fetches a freshly priced catalog. *pricing.Provider satisfies it; an interface keeps the controller testable without HTTP.

Jump to

Keyboard shortcuts

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