limesresources

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Overview

Package limesresources contains data structures that appear on the Limes resource API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BurstingMultiplier

type BurstingMultiplier float64

BurstingMultiplier is a multiplier for quota bursting.

func (BurstingMultiplier) ApplyTo

func (m BurstingMultiplier) ApplyTo(quota uint64, qdModel QuotaDistributionModel) uint64

ApplyTo returns the bursted backend quota for the given approved quota.

type ClusterAvailabilityZoneReport

type ClusterAvailabilityZoneReport struct {
	Name        string `json:"name"`
	Capacity    uint64 `json:"capacity"`
	RawCapacity uint64 `json:"raw_capacity,omitempty"`
	Usage       uint64 `json:"usage,omitempty"`
}

ClusterAvailabilityZoneReport is a substructure of ClusterResourceReport containing capacity and usage data for a single resource in an availability zone.

type ClusterAvailabilityZoneReports

type ClusterAvailabilityZoneReports map[string]*ClusterAvailabilityZoneReport

ClusterAvailabilityZoneReports provides fast lookup of availability zones using a map, but serializes to JSON as a list.

func (ClusterAvailabilityZoneReports) MarshalJSON

func (r ClusterAvailabilityZoneReports) MarshalJSON() ([]byte, error)

func (*ClusterAvailabilityZoneReports) UnmarshalJSON

func (r *ClusterAvailabilityZoneReports) UnmarshalJSON(buf []byte) error

type ClusterReport

type ClusterReport struct {
	limes.ClusterInfo
	Services     ClusterServiceReports  `json:"services"`
	MaxScrapedAt *limes.UnixEncodedTime `json:"max_scraped_at,omitempty"`
	MinScrapedAt *limes.UnixEncodedTime `json:"min_scraped_at,omitempty"`
}

ClusterReport contains aggregated data about resource usage in a cluster. It is returned by GET endpoints for clusters.

type ClusterResourceReport

type ClusterResourceReport struct {
	//Several fields are pointers to values to enable precise control over which fields are rendered in output.
	ResourceInfo
	QuotaDistributionModel QuotaDistributionModel         `json:"quota_distribution_model,omitempty"`
	Capacity               *uint64                        `json:"capacity,omitempty"`
	RawCapacity            *uint64                        `json:"raw_capacity,omitempty"`
	CapacityPerAZ          ClusterAvailabilityZoneReports `json:"per_availability_zone,omitempty"`
	DomainsQuota           *uint64                        `json:"domains_quota,omitempty"`
	Usage                  uint64                         `json:"usage"`
	BurstUsage             uint64                         `json:"burst_usage,omitempty"`
	PhysicalUsage          *uint64                        `json:"physical_usage,omitempty"`
	Subcapacities          json.RawMessage                `json:"subcapacities,omitempty"`
}

ClusterResourceReport is a substructure of ClusterReport containing data for a single resource.

type ClusterResourceReports

type ClusterResourceReports map[string]*ClusterResourceReport

ClusterResourceReports provides fast lookup of resources by resource name, but serializes to JSON as a list.

func (ClusterResourceReports) MarshalJSON

func (r ClusterResourceReports) MarshalJSON() ([]byte, error)

func (*ClusterResourceReports) UnmarshalJSON

func (r *ClusterResourceReports) UnmarshalJSON(buf []byte) error

type ClusterServiceReport

type ClusterServiceReport struct {
	limes.ServiceInfo
	Resources    ClusterResourceReports `json:"resources"`
	MaxScrapedAt *limes.UnixEncodedTime `json:"max_scraped_at,omitempty"`
	MinScrapedAt *limes.UnixEncodedTime `json:"min_scraped_at,omitempty"`
}

ClusterServiceReport is a substructure of ClusterReport containing data for a single backend service.

type ClusterServiceReports

type ClusterServiceReports map[string]*ClusterServiceReport

ClusterServiceReports provides fast lookup of services by service type, but serializes to JSON as a list.

func (ClusterServiceReports) MarshalJSON

func (s ClusterServiceReports) MarshalJSON() ([]byte, error)

func (*ClusterServiceReports) UnmarshalJSON

func (s *ClusterServiceReports) UnmarshalJSON(buf []byte) error

type DomainReport

type DomainReport struct {
	limes.DomainInfo
	Services DomainServiceReports `json:"services"`
}

DomainReport contains aggregated data about resource usage in a domain. It is returned by GET requests on domains.

type DomainResourceReport

type DomainResourceReport struct {
	//Several fields are pointers to values to enable precise control over which fields are rendered in output.
	ResourceInfo
	QuotaDistributionModel QuotaDistributionModel `json:"quota_distribution_model,omitempty"`
	DomainQuota            *uint64                `json:"quota,omitempty"`
	ProjectsQuota          *uint64                `json:"projects_quota,omitempty"`
	Usage                  uint64                 `json:"usage"`
	BurstUsage             uint64                 `json:"burst_usage,omitempty"`
	PhysicalUsage          *uint64                `json:"physical_usage,omitempty"`
	BackendQuota           *uint64                `json:"backend_quota,omitempty"`
	InfiniteBackendQuota   *bool                  `json:"infinite_backend_quota,omitempty"`
	Scaling                *ScalingBehavior       `json:"scales_with,omitempty"`
	//Annotations may contain arbitrary metadata that was configured for this
	//resource in this scope by Limes' operator.
	Annotations map[string]interface{} `json:"annotations,omitempty"`
}

DomainResourceReport is a substructure of DomainReport containing data for a single resource.

type DomainResourceReports

type DomainResourceReports map[string]*DomainResourceReport

DomainResourceReports provides fast lookup of resources using a map, but serializes to JSON as a list.

func (DomainResourceReports) MarshalJSON

func (r DomainResourceReports) MarshalJSON() ([]byte, error)

func (*DomainResourceReports) UnmarshalJSON

func (r *DomainResourceReports) UnmarshalJSON(buf []byte) error

type DomainServiceReport

type DomainServiceReport struct {
	limes.ServiceInfo
	Resources    DomainResourceReports  `json:"resources"`
	MaxScrapedAt *limes.UnixEncodedTime `json:"max_scraped_at,omitempty"`
	MinScrapedAt *limes.UnixEncodedTime `json:"min_scraped_at,omitempty"`
}

DomainServiceReport is a substructure of DomainReport containing data for a single backend service.

type DomainServiceReports

type DomainServiceReports map[string]*DomainServiceReport

DomainServiceReports provides fast lookup of services using a map, but serializes to JSON as a list.

func (DomainServiceReports) MarshalJSON

func (s DomainServiceReports) MarshalJSON() ([]byte, error)

func (*DomainServiceReports) UnmarshalJSON

func (s *DomainServiceReports) UnmarshalJSON(buf []byte) error

type ProjectBurstingInfo

type ProjectBurstingInfo struct {
	Enabled    bool               `json:"enabled"`
	Multiplier BurstingMultiplier `json:"multiplier"`
}

ProjectBurstingInfo is a substructure of ProjectReport containing information about quota bursting. (It is omitted if bursting is not supported for the project's cluster.)

type ProjectReport

type ProjectReport struct {
	limes.ProjectInfo
	Bursting *ProjectBurstingInfo  `json:"bursting,omitempty"`
	Services ProjectServiceReports `json:"services"`
}

ProjectReport contains all data about resource usage in a project.

type ProjectResourceReport

type ProjectResourceReport struct {
	//Several fields are pointers to values to enable precise control over which fields are rendered in output.
	ResourceInfo
	QuotaDistributionModel QuotaDistributionModel `json:"quota_distribution_model,omitempty"`
	Quota                  *uint64                `json:"quota,omitempty"`
	DefaultQuota           *uint64                `json:"default_quota,omitempty"`
	UsableQuota            *uint64                `json:"usable_quota,omitempty"`
	Usage                  uint64                 `json:"usage"`
	BurstUsage             uint64                 `json:"burst_usage,omitempty"`
	PhysicalUsage          *uint64                `json:"physical_usage,omitempty"`
	BackendQuota           *int64                 `json:"backend_quota,omitempty"`
	Subresources           json.RawMessage        `json:"subresources,omitempty"`
	Scaling                *ScalingBehavior       `json:"scales_with,omitempty"`
	//Annotations may contain arbitrary metadata that was configured for this
	//resource in this scope by Limes' operator.
	Annotations map[string]interface{} `json:"annotations,omitempty"`
}

ProjectResourceReport is a substructure of ProjectReport containing data for a single resource.

type ProjectResourceReports

type ProjectResourceReports map[string]*ProjectResourceReport

ProjectResourceReports provides fast lookup of resources using a map, but serializes to JSON as a list.

func (ProjectResourceReports) MarshalJSON

func (r ProjectResourceReports) MarshalJSON() ([]byte, error)

func (*ProjectResourceReports) UnmarshalJSON

func (r *ProjectResourceReports) UnmarshalJSON(buf []byte) error

type ProjectServiceReport

type ProjectServiceReport struct {
	limes.ServiceInfo
	Resources ProjectResourceReports `json:"resources"`
	ScrapedAt *limes.UnixEncodedTime `json:"scraped_at,omitempty"`
}

ProjectServiceReport is a substructure of ProjectReport containing data for a single backend service.

type ProjectServiceReports

type ProjectServiceReports map[string]*ProjectServiceReport

ProjectServiceReports provides fast lookup of services using a map, but serializes to JSON as a list.

func (ProjectServiceReports) MarshalJSON

func (s ProjectServiceReports) MarshalJSON() ([]byte, error)

func (*ProjectServiceReports) UnmarshalJSON

func (s *ProjectServiceReports) UnmarshalJSON(buf []byte) error

type QuotaDistributionModel added in v1.4.1

type QuotaDistributionModel string

QuotaDistributionModel is an enum.

const (
	// HierarchicalQuotaDistribution is the default QuotaDistributionModel,
	// wherein quota is distributed to domains by the cloud admins, and then the
	// projects by the domain admins. Domains and projects start out at zero
	// quota.
	HierarchicalQuotaDistribution QuotaDistributionModel = "hierarchical"
	// CentralizedQuotaDistribution is an alternative QuotaDistributionModel,
	// wherein quota is directly given to projects by the cloud admins. Projects
	// start out at a generous default quota as configured by the Limes operator.
	// The domain quota cannot be edited and is always reported equal to the
	// projects quota.
	CentralizedQuotaDistribution QuotaDistributionModel = "centralized"
)

type QuotaRequest

type QuotaRequest map[string]ServiceQuotaRequest

QuotaRequest contains new quota values for resources in multiple services. The map key is the service type. This type is used to serialize JSON request bodies in PUT requests on domains and projects.

func (QuotaRequest) MarshalJSON

func (r QuotaRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*QuotaRequest) UnmarshalJSON

func (r *QuotaRequest) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ResourceInfo

type ResourceInfo struct {
	Name string     `json:"name"`
	Unit limes.Unit `json:"unit,omitempty"`
	//Category is an optional hint that UIs can use to group resources of one
	//service into subgroups. If it is used, it should be set on all
	//ResourceInfos reported by the same QuotaPlugin.
	Category string `json:"category,omitempty"`
	//If AutoApproveInitialQuota is non-zero, when a new project is scraped for
	//the first time, a backend quota equal to this value will be approved
	//automatically (i.e. Quota will be set equal to BackendQuota).
	AutoApproveInitialQuota uint64 `json:"-"`
	//If NoQuota is true, quota is not tracked at all for this resource. The
	//resource will only report usage. This field is not shown in API responses.
	//Check `res.Quota == nil` instead.
	NoQuota bool `json:"-"`
	//ContainedIn is an optional hint that UIs can use to group resources. If non-empty,
	//this resource is semantically contained within the resource with that name
	//in the same service.
	ContainedIn string `json:"contained_in,omitempty"`
}

ResourceInfo contains the metadata for a resource (i.e. some thing for which quota and usage values can be retrieved from a backend service).

type ResourceQuotaRequest

type ResourceQuotaRequest limes.ValueWithUnit

ResourceQuotaRequest contains new quota values for a single resource. This type appears in type ServiceQuotaRequest.

type ScalingBehavior

type ScalingBehavior struct {
	ScalesWithResourceName string  `json:"resource_name"`
	ScalesWithServiceType  string  `json:"service_type"`
	ScalingFactor          float64 `json:"factor"`
}

ScalingBehavior appears in type DomainResourceReport and type ProjectResourceReport and describes the scaling behavior of a single resource.

type ServiceQuotaRequest

type ServiceQuotaRequest map[string]ResourceQuotaRequest

ServiceQuotaRequest contains new quota values for resources in a single service. The map key is the resource name. This type appears in type QuotaRequest.

Jump to

Keyboard shortcuts

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