api

package
v0.0.0-...-f631f21 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeCommitmentsAPIMonitor

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

ChangeCommitmentsAPIMonitor provides metrics for the CR change API.

func NewChangeCommitmentsAPIMonitor

func NewChangeCommitmentsAPIMonitor() ChangeCommitmentsAPIMonitor

NewChangeCommitmentsAPIMonitor creates a new monitor with Prometheus metrics. Metrics are pre-initialized with zero values for common HTTP status codes to ensure they appear in Prometheus before the first request.

func (*ChangeCommitmentsAPIMonitor) Collect

func (m *ChangeCommitmentsAPIMonitor) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*ChangeCommitmentsAPIMonitor) Describe

func (m *ChangeCommitmentsAPIMonitor) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

type HTTPAPI

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

HTTPAPI implements Limes LIQUID commitment validation endpoints.

func NewAPI

func NewAPI(client client.Client) *HTTPAPI

func NewAPIWithConfig

func NewAPIWithConfig(k8sClient client.Client, config commitments.Config, usageDB commitments.UsageDBClient) *HTTPAPI

NewAPIWithConfig creates an HTTPAPI with the given config and optional usageDB client.

func (*HTTPAPI) HandleChangeCommitments

func (api *HTTPAPI) HandleChangeCommitments(w http.ResponseWriter, r *http.Request)

implements POST /commitments/v1/change-commitments from Limes LIQUID API: See: https://github.com/sapcc/go-api-declarations/blob/main/liquid/commitment.go See: https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid

This endpoint handles commitment changes by creating/updating/deleting Reservation CRDs based on the commitment lifecycle. A request may contain multiple commitment changes which are processed in a single transaction. If any change fails, all changes are rolled back.

func (*HTTPAPI) HandleQuota

func (api *HTTPAPI) HandleQuota(w http.ResponseWriter, r *http.Request)

HandleQuota implements PUT /commitments/v1/projects/:project_id/quota from Limes LIQUID API. See: https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid

This is a no-op endpoint that accepts quota requests but doesn't store them. Cortex does not enforce quotas for committed resources - quota enforcement happens through commitment validation at change-commitments time. The endpoint exists for API compatibility with the LIQUID specification.

func (*HTTPAPI) HandleReportCapacity

func (api *HTTPAPI) HandleReportCapacity(w http.ResponseWriter, r *http.Request)

handles POST /commitments/v1/report-capacity requests from Limes: See: https://github.com/sapcc/go-api-declarations/blob/main/liquid/commitment.go See: https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid Reports available capacity across all flavor group resources. Note, unit is specified in the Info API response with multiple of the smallest memory resource unit within a flavor group.

func (*HTTPAPI) HandleReportUsage

func (api *HTTPAPI) HandleReportUsage(w http.ResponseWriter, r *http.Request)

HandleReportUsage implements POST /commitments/v1/projects/:project_id/report-usage from Limes LIQUID API. See: https://github.com/sapcc/go-api-declarations/blob/main/liquid/report_usage.go See: https://pkg.go.dev/github.com/sapcc/go-api-declarations/liquid

This endpoint reports usage information for a specific project's committed resources, including per-AZ usage, physical usage, and detailed VM subresources.

func (*HTTPAPI) Init

func (api *HTTPAPI) Init(mux *http.ServeMux, registry prometheus.Registerer, log logr.Logger)

type InfoAPIMonitor

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

InfoAPIMonitor provides metrics for the CR info API.

func NewInfoAPIMonitor

func NewInfoAPIMonitor() InfoAPIMonitor

NewInfoAPIMonitor creates a new monitor with Prometheus metrics. Metrics are pre-initialized with zero values for common HTTP status codes to ensure they appear in Prometheus before the first request.

func (*InfoAPIMonitor) Collect

func (m *InfoAPIMonitor) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*InfoAPIMonitor) Describe

func (m *InfoAPIMonitor) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

type ReportCapacityAPIMonitor

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

ReportCapacityAPIMonitor provides metrics for the CR report-capacity API.

func NewReportCapacityAPIMonitor

func NewReportCapacityAPIMonitor() ReportCapacityAPIMonitor

NewReportCapacityAPIMonitor creates a new monitor with Prometheus metrics. Metrics are pre-initialized with zero values for common HTTP status codes to ensure they appear in Prometheus before the first request.

func (*ReportCapacityAPIMonitor) Collect

func (m *ReportCapacityAPIMonitor) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*ReportCapacityAPIMonitor) Describe

func (m *ReportCapacityAPIMonitor) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

type ReportUsageAPIMonitor

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

ReportUsageAPIMonitor provides metrics for the CR report-usage API.

func NewReportUsageAPIMonitor

func NewReportUsageAPIMonitor() ReportUsageAPIMonitor

NewReportUsageAPIMonitor creates a new monitor with Prometheus metrics. Metrics are pre-initialized with zero values for common HTTP status codes to ensure they appear in Prometheus before the first request.

func (*ReportUsageAPIMonitor) Collect

func (m *ReportUsageAPIMonitor) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*ReportUsageAPIMonitor) Describe

func (m *ReportUsageAPIMonitor) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

Jump to

Keyboard shortcuts

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