subscription

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package subscription keeps a billed environment's Subscription and EntitlementUsage current. It runs on the leader only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureResources

func EnsureResources(ctx context.Context, c kclient.Client) error

EnsureResources creates the Subscription and the EntitlementUsage unless they exist.

Types

type Handler

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

func New

func New(billingClient *billing.Client, gatewayClient *gateway.Client) *Handler

func (*Handler) CountUsage

func (h *Handler) CountUsage(req router.Request, _ router.Response) error

CountUsage keeps the EntitlementUsage's status current. Listing the objects that use compute through the controller's client makes it run again when any of them changes.

func (*Handler) EnsureOverLimitSince

func (h *Handler) EnsureOverLimitSince(req router.Request, _ router.Response) error

EnsureOverLimitSince starts the over-limit clock when usage is over the subscription's limits, and clears it once usage is back within them. Reading the EntitlementUsage through the controller's client makes it run again when compute changes. Users and devices are counted at each sync, and again after the gateway deletes one.

func (*Handler) Sync

func (h *Handler) Sync(req router.Request, resp router.Response) error

Sync records billing's answer when a sync is due, or requested with SubscriptionSyncAnnotation. A failed sync keeps the last answer.

Jump to

Keyboard shortcuts

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