cache

package
v1.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// KubernetesVersionTTL is the time before the detected Kubernetes version is removed from cache,
	// to be re-detected next time it is needed.
	KubernetesVersionTTL = 15 * time.Minute
	// UnavailableOfferingsTTL is the time before offerings that were marked as unavailable
	// are removed from the cache and are available for launch again
	UnavailableOfferingsTTL = 3 * time.Minute

	// DefaultCleanupInterval triggers cache cleanup (lazy eviction) at this interval.
	DefaultCleanupInterval = 1 * time.Minute
	// UnavailableOfferingsCleanupInterval triggers cache cleanup (lazy eviction) at this interval.
	// We drop the cleanup interval down for the ICE cache to get quicker reactivity to offerings
	// that become available after they get evicted from the cache
	UnavailableOfferingsCleanupInterval = time.Second * 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UnavailableOfferings

type UnavailableOfferings struct {
	SeqNum uint64
	// contains filtered or unexported fields
}

UnavailableOfferings stores any offerings that return ICE (insufficient capacity errors) when attempting to launch the capacity. These offerings are ignored as long as they are in the cache on GetInstanceTypes responses We maintain two caches (singleOfferingCache and vmFamilyCache) to better handle error cases in which we know that allocation from a specific VM family + capacity type + zone combination will not work. Information available from skewer.SKU is used to determine details about the VM SKU for which we encountered allocation errors. We don't bundle the two caches together into one to avoid accidentally bundling together different SKUs while handling errors which don't necessarily warrant blocking more than just the single instance type. This could be adjusted in the future, as we gather more data and get more confidence in information available in skewer.SKU.

func NewUnavailableOfferings

func NewUnavailableOfferings() *UnavailableOfferings

func NewUnavailableOfferingsWithCache

func NewUnavailableOfferingsWithCache(singleOfferingCache, vmFamilyCache *cache.Cache) *UnavailableOfferings

func (*UnavailableOfferings) Flush

func (u *UnavailableOfferings) Flush()

func (*UnavailableOfferings) IsUnavailable

func (u *UnavailableOfferings) IsUnavailable(sku *skewer.SKU, zone, capacityType string) bool

IsUnavailable returns true if the offering appears in the cache

func (*UnavailableOfferings) MarkFamilyUnavailable added in v1.6.1

func (u *UnavailableOfferings) MarkFamilyUnavailable(ctx context.Context, skuFamilyName, zone, capacityType string, ttl time.Duration)

MarkFamilyUnavailable marks the entire VM family as unavailable in a specific zone for a specific capacity type with custom TTL

func (*UnavailableOfferings) MarkFamilyUnavailableAtCPUCount added in v1.6.1

func (u *UnavailableOfferings) MarkFamilyUnavailableAtCPUCount(ctx context.Context, skuFamilyName, zone, capacityType string, cpuCount int64, ttl time.Duration)

MarkFamilyUnavailableAtCPUCount marks a VM family with custom TTL in a specific zone for all instance types that have CPU count at or above the provided cpuCount Value of -1 is used as a "wholeVMFamilyBlockedSentinel" to indicate that the entire VM family is blocked in this zone for the specified capacity type. skuFamilyName e.g. "StandardDv2Family" for "Standard_D2_v2" VM SKU

func (*UnavailableOfferings) MarkSpotUnavailableWithTTL

func (u *UnavailableOfferings) MarkSpotUnavailableWithTTL(ctx context.Context, ttl time.Duration)

MarkSpotUnavailable communicates recently observed temporary capacity shortages for spot

func (*UnavailableOfferings) MarkUnavailable

func (u *UnavailableOfferings) MarkUnavailable(ctx context.Context, unavailableReason, instanceType, zone, capacityType string)

MarkUnavailable communicates recently observed temporary capacity shortages in the provided offerings

func (*UnavailableOfferings) MarkUnavailableWithTTL

func (u *UnavailableOfferings) MarkUnavailableWithTTL(ctx context.Context, unavailableReason, instanceType, zone, capacityType string, ttl time.Duration)

MarkUnavailableWithTTL allows us to mark an offering unavailable with a custom TTL

Jump to

Keyboard shortcuts

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