Documentation ¶
Index ¶
- Variables
- func ConvertUnitFor(cluster *Cluster, serviceType limes.ServiceType, ...) (uint64, error)
- type AZAwareData
- type AutogrowQuotaDistributionConfiguration
- type CapacitorConfiguration
- type CapacityData
- type CapacityPlugin
- type CapacityPluginBackchannel
- type Cluster
- func (c *Cluster) AllServiceInfos() []limes.ServiceInfo
- func (c *Cluster) BehaviorForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) ResourceBehavior
- func (c *Cluster) Connect(provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (errs errext.ErrorSet)
- func (c *Cluster) GetServiceTypesForArea(area string) (serviceTypes []limes.ServiceType)
- func (c *Cluster) HasResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) bool
- func (c *Cluster) HasService(serviceType limes.ServiceType) bool
- func (c *Cluster) HasUsageForRate(serviceType limes.ServiceType, rateName limesrates.RateName) bool
- func (c *Cluster) InfoForRate(serviceType limes.ServiceType, rateName limesrates.RateName) limesrates.RateInfo
- func (c *Cluster) InfoForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) limesresources.ResourceInfo
- func (c *Cluster) InfoForService(serviceType limes.ServiceType) limes.ServiceInfo
- func (c *Cluster) QuotaDistributionConfigForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) QuotaDistributionConfiguration
- func (c *Cluster) ServiceTypesInAlphabeticalOrder() []limes.ServiceType
- type ClusterConfiguration
- type DiscoveryConfiguration
- type DiscoveryPlugin
- type KeystoneDomain
- type KeystoneProject
- type OvercommitFactor
- type PerAZ
- type QuotaDistributionConfiguration
- type QuotaPlugin
- type RateLimitConfiguration
- type ResourceBehavior
- type ResourceData
- type ResourceDemand
- type ResourceRef
- type ServiceConfiguration
- type ServiceRateLimitConfiguration
- type UsageData
Constants ¶
This section is empty.
Variables ¶
var ( // DiscoveryPluginRegistry is a pluggable.Registry for DiscoveryPlugin implementations. DiscoveryPluginRegistry pluggable.Registry[DiscoveryPlugin] // QuotaPluginRegistry is a pluggable.Registry for QuotaPlugin implementations. QuotaPluginRegistry pluggable.Registry[QuotaPlugin] // CapacityPluginRegistry is a pluggable.Registry for CapacityPlugin implementations. CapacityPluginRegistry pluggable.Registry[CapacityPlugin] )
Functions ¶
func ConvertUnitFor ¶
func ConvertUnitFor(cluster *Cluster, serviceType limes.ServiceType, resourceName limesresources.ResourceName, v limes.ValueWithUnit) (uint64, error)
ConvertUnitFor works like ConvertTo, but instead of taking a unit as an argument, it uses the native unit of the specified resource. In contrast to ConvertTo(), this also handles UnitUnspecified. Values with unspecified unit will be interpreted as being in the native unit, and will not be converted.
Types ¶
type AZAwareData ¶
type AZAwareData[Self any] interface { // List of permitted types. This is required for type inference, as explained here: // <https://stackoverflow.com/a/73851453> UsageData | CapacityData // contains filtered or unexported methods }
AZAwareData is an interface for types that can be put into the PerAZ container.
type AutogrowQuotaDistributionConfiguration ¶
type AutogrowQuotaDistributionConfiguration struct { AllowQuotaOvercommit bool `yaml:"allow_quota_overcommit"` ProjectBaseQuota uint64 `yaml:"project_base_quota"` GrowthMultiplier float64 `yaml:"growth_multiplier"` GrowthMinimum uint64 `yaml:"growth_minimum"` UsageDataRetentionPeriod util.MarshalableTimeDuration `yaml:"usage_data_retention_period"` }
AutogrowQuotaDistributionConfiguration appears in type QuotaDistributionConfiguration.
type CapacitorConfiguration ¶
type CapacitorConfiguration struct { ID string `yaml:"id"` PluginType string `yaml:"type"` Parameters util.YamlRawMessage `yaml:"params"` }
CapacitorConfiguration describes a capacity plugin that is enabled for a certain cluster.
type CapacityData ¶
type CapacityData struct { //NOTE: The json tags are only relevant for the output of `limes test-scan-capacity`. Capacity uint64 `json:"capacity"` Usage *uint64 `json:"usage,omitempty"` //NOTE: currently only relevant on AZ level, regional level uses the aggregation of project usages Subcapacities []any `json:"subcapacities,omitempty"` // only if supported by plugin and enabled in config }
CapacityData contains capacity data for a single project resource.
type CapacityPlugin ¶
type CapacityPlugin interface { pluggable.Plugin // Init is called before any other interface methods, and allows the plugin to // perform first-time initialization. If the plugin needs to access OpenStack // APIs, it needs to spawn the respective ServiceClients in this method and // retain them. // // Before Init is called, the `capacitors[].params` provided in the config // file will be yaml.Unmarshal()ed into the plugin object itself. Init(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) error // Scrape queries the backend service(s) for the capacities of the resources // that this plugin is concerned with. The result is a two-dimensional map, // with the first key being the service type, and the second key being the // resource name. The capacity collector will ignore service types for which // there is no QuotaPlugin, and resources which are not advertised by that // QuotaPlugin. // // The serializedMetrics return value is persisted in the Limes DB and // supplied to all subsequent RenderMetrics calls. Scrape(backchannel CapacityPluginBackchannel, allAZs []limes.AvailabilityZone) (result map[limes.ServiceType]map[limesresources.ResourceName]PerAZ[CapacityData], serializedMetrics []byte, err error) // DescribeMetrics is called when Prometheus is scraping metrics from // limes-collect, to provide an opportunity to the plugin to emit its own // metrics. // // Together with CollectMetrics, this interface is roughly analogous to the // prometheus.Collector interface; cf. documentation over there. DescribeMetrics(ch chan<- *prometheus.Desc) // CollectMetrics is called when Prometheus is scraping metrics from // limes-collect, to provide an opportunity to the plugin to emit its own // metrics. The serializedMetrics argument contains the respective value // returned from the last Scrape call on the same project. // // Some plugins also emit metrics directly within Scrape. This newer interface // should be preferred since metrics emitted here won't be lost between // restarts of limes-collect. CollectMetrics(ch chan<- prometheus.Metric, serializedMetrics []byte, capacitorID string) error }
CapacityPlugin is the interface that all capacity collector plugins must implement.
While there can only be one QuotaPlugin for each backend service, there may be different CapacityPlugin instances for each backend service, and a single CapacityPlugin can even report capacities for multiple service types. The reason is that quotas are handled in the concrete backend service, thus their handling is independent from the underlying infrastructure. Capacity calculations, however, may be highly dependent on the infrastructure. For example, for the Compute service, there could be different capacity plugins for each type of hypervisor (KVM, VMware, etc.) which use the concrete APIs of these hypervisors instead of the OpenStack Compute API.
type CapacityPluginBackchannel ¶
type CapacityPluginBackchannel interface { GetGlobalResourceDemand(serviceType limes.ServiceType, resourceName limesresources.ResourceName) (map[limes.AvailabilityZone]ResourceDemand, error) GetOvercommitFactor(serviceType limes.ServiceType, resourceName limesresources.ResourceName) (OvercommitFactor, error) }
CapacityPluginBackchannel is a callback interface that is provided to CapacityPlugin.Scrape(). Most capacity scrape implementations will not need this, but some esoteric usecases use this information to distribute available capacity among resources in accordance with customer demand.
Note that ResourceDemand is measured against effective capacity, which differs from the raw capacity seen by the CapacityPlugin by this OvercommitFactor.
type Cluster ¶
type Cluster struct { Config ClusterConfiguration DiscoveryPlugin DiscoveryPlugin QuotaPlugins map[limes.ServiceType]QuotaPlugin CapacityPlugins map[string]CapacityPlugin Authoritative bool QuotaOverrides map[string]map[string]map[limes.ServiceType]map[limesresources.ResourceName]uint64 }
Cluster contains all configuration and runtime information for the target cluster.
func NewCluster ¶
func NewCluster(config ClusterConfiguration) (c *Cluster, errs errext.ErrorSet)
NewCluster creates a new Cluster instance with the given ID and configuration, and also initializes all quota and capacity plugins. Errors will be logged when some of the requested plugins cannot be found.
func NewClusterFromYAML ¶
NewClusterFromYAML reads and validates the configuration in the given YAML document. Errors are logged and will result in program termination, causing the function to not return.
func (*Cluster) AllServiceInfos ¶
func (c *Cluster) AllServiceInfos() []limes.ServiceInfo
AllServiceInfos returns the ServiceInfo for all known services.
func (*Cluster) BehaviorForResource ¶
func (c *Cluster) BehaviorForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) ResourceBehavior
BehaviorForResource returns the ResourceBehavior for the given resource in the given scope.
func (*Cluster) Connect ¶
func (c *Cluster) Connect(provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (errs errext.ErrorSet)
Connect calls Init() on all plugins.
It also loads the QuotaOverrides for this cluster, if configured. We also validate if Config.ResourceBehavior[].ScalesWith refers to existing resources.
We cannot do any of this earlier because we only know all resources after calling Init() on all quota plugins.
func (*Cluster) GetServiceTypesForArea ¶
func (c *Cluster) GetServiceTypesForArea(area string) (serviceTypes []limes.ServiceType)
GetServiceTypesForArea returns all service types that belong to the given area.
func (*Cluster) HasResource ¶
func (c *Cluster) HasResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) bool
HasResource checks whether the given service is enabled in this cluster and whether it advertises the given resource.
func (*Cluster) HasService ¶
func (c *Cluster) HasService(serviceType limes.ServiceType) bool
HasService checks whether the given service is enabled in this cluster.
func (*Cluster) HasUsageForRate ¶
func (c *Cluster) HasUsageForRate(serviceType limes.ServiceType, rateName limesrates.RateName) bool
HasUsageForRate checks whether the given service is enabled in this cluster and whether it scrapes usage for the given rate.
func (*Cluster) InfoForRate ¶
func (c *Cluster) InfoForRate(serviceType limes.ServiceType, rateName limesrates.RateName) limesrates.RateInfo
InfoForRate finds the plugin for the given serviceType and finds within that plugin the RateInfo for the given rateName. If the service or rate does not exist, an empty RateInfo (with .Unit == UnitNone) is returned. Note that this only returns non-empty RateInfos for rates where a usage is reported. There may be rates that only have a limit, as defined in the ClusterConfiguration.
func (*Cluster) InfoForResource ¶
func (c *Cluster) InfoForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) limesresources.ResourceInfo
InfoForResource finds the plugin for the given serviceType and finds within that plugin the ResourceInfo for the given resourceName. If the service or resource does not exist, an empty ResourceInfo (with .Unit == UnitNone and .Category == "") is returned.
func (*Cluster) InfoForService ¶
func (c *Cluster) InfoForService(serviceType limes.ServiceType) limes.ServiceInfo
InfoForService finds the plugin for the given serviceType and returns its ServiceInfo(), or an empty ServiceInfo (with .Area == "") when no such service exists in this cluster.
func (*Cluster) QuotaDistributionConfigForResource ¶
func (c *Cluster) QuotaDistributionConfigForResource(serviceType limes.ServiceType, resourceName limesresources.ResourceName) QuotaDistributionConfiguration
QuotaDistributionConfigForResource returns the QuotaDistributionConfiguration for the given resource.
func (*Cluster) ServiceTypesInAlphabeticalOrder ¶
func (c *Cluster) ServiceTypesInAlphabeticalOrder() []limes.ServiceType
ServiceTypesInAlphabeticalOrder can be used when service types need to be iterated over in a stable order (mostly to ensure deterministic behavior in unit tests).
type ClusterConfiguration ¶
type ClusterConfiguration struct { AvailabilityZones []limes.AvailabilityZone `yaml:"availability_zones"` CatalogURL string `yaml:"catalog_url"` Discovery DiscoveryConfiguration `yaml:"discovery"` Services []ServiceConfiguration `yaml:"services"` Capacitors []CapacitorConfiguration `yaml:"capacitors"` // ^ Sorry for the stupid pun. Not. ResourceBehaviors []ResourceBehavior `yaml:"resource_behavior"` QuotaDistributionConfigs []*QuotaDistributionConfiguration `yaml:"quota_distribution_configs"` }
ClusterConfiguration contains all the configuration data for a single cluster. It is instantiated from YAML and then transformed into type Cluster during the startup phase.
func (*ClusterConfiguration) GetServiceConfigurationForType ¶
func (cluster *ClusterConfiguration) GetServiceConfigurationForType(serviceType limes.ServiceType) (ServiceConfiguration, error)
GetServiceConfigurationForType returns the ServiceConfiguration or an error.
type DiscoveryConfiguration ¶
type DiscoveryConfiguration struct { Method string `yaml:"method"` ExcludeDomainRx regexpext.PlainRegexp `yaml:"except_domains"` IncludeDomainRx regexpext.PlainRegexp `yaml:"only_domains"` Parameters util.YamlRawMessage `yaml:"params"` }
DiscoveryConfiguration describes the method of discovering Keystone domains and projects.
func (DiscoveryConfiguration) FilterDomains ¶
func (c DiscoveryConfiguration) FilterDomains(domains []KeystoneDomain) []KeystoneDomain
FilterDomains applies the configured ExcludeDomainRx and IncludeDomainRx to the given list of domains.
type DiscoveryPlugin ¶
type DiscoveryPlugin interface { pluggable.Plugin // Init is called before any other interface methods, and allows the plugin to // perform first-time initialization. If the plugin needs to access OpenStack // APIs, it needs to spawn the respective ServiceClients in this method and // retain them. // // Before Init is called, the `discovery.params` provided in the configuration // file will be yaml.Unmarshal()ed into the plugin object itself. Init(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) error // ListDomains returns all Keystone domains in the cluster. ListDomains() ([]KeystoneDomain, error) // ListProjects returns all Keystone projects in the given domain. ListProjects(domain KeystoneDomain) ([]KeystoneProject, error) }
DiscoveryPlugin is the interface that the collector uses to discover Keystone projects and domains in a cluster.
type KeystoneDomain ¶
type KeystoneDomain struct { UUID string `json:"id" yaml:"id"` Name string `json:"name" yaml:"name"` }
KeystoneDomain describes the basic attributes of a Keystone domain.
func KeystoneDomainFromDB ¶
func KeystoneDomainFromDB(dbDomain db.Domain) KeystoneDomain
KeystoneDomainFromDB converts a db.Domain into a KeystoneDomain.
type KeystoneProject ¶
type KeystoneProject struct { UUID string `json:"id" yaml:"id"` Name string `json:"name" yaml:"name"` ParentUUID string `json:"parent_id,omitempty" yaml:"parent_id,omitempty"` Domain KeystoneDomain `json:"domain" yaml:"domain"` }
KeystoneProject describes the basic attributes of a Keystone project.
func KeystoneProjectFromDB ¶
func KeystoneProjectFromDB(dbProject db.Project, domain KeystoneDomain) KeystoneProject
KeystoneProjectFromDB converts a db.Project into a KeystoneProject.
type OvercommitFactor ¶
type OvercommitFactor float64
OvercommitFactor is a float64 with a convenience method.
func (OvercommitFactor) ApplyInReverseTo ¶
func (f OvercommitFactor) ApplyInReverseTo(capacity uint64) uint64
ApplyInReverseTo turns the given effective capacity back into a raw capacity.
func (OvercommitFactor) ApplyInReverseToDemand ¶
func (f OvercommitFactor) ApplyInReverseToDemand(demand ResourceDemand) ResourceDemand
ApplyInReverseToDemand is a shorthand for calling ApplyInReverseTo() on all fields of a ResourceDemand. This can be used in capacity plugins to convert demand numbers operating on overcommitted capacity into numbers that relate to raw capacity.
func (OvercommitFactor) ApplyTo ¶
func (f OvercommitFactor) ApplyTo(rawCapacity uint64) uint64
ApplyTo converts a raw capacity into an effective capacity.
type PerAZ ¶
type PerAZ[D AZAwareData[D]] map[limes.AvailabilityZone]*D
PerAZ is a container for data that can be reported for each AZ.
func InAnyAZ ¶
func InAnyAZ[D AZAwareData[D]](data D) PerAZ[D]
InAnyAZ is a convenience constructor for PerAZ that puts all data in the "any" AZ. Use this for data relating to resources that are not AZ-aware.
func InUnknownAZUnlessEmpty ¶
func InUnknownAZUnlessEmpty[D AZAwareData[D]](data D) PerAZ[D]
InUnknownAZUnlessEmpty is a convenience constructor for PerAZ that puts all data in the "unknown" AZ. Use this for data relating to AZ-aware resources where the AZ association is unknown.
If the provided data is empty, an empty map is returned instead. (We usually only report "unknown" if there is actually something to report.)
func (PerAZ[D]) AndZeroInTheseAZs ¶
func (p PerAZ[D]) AndZeroInTheseAZs(availabilityZones []limes.AvailabilityZone) PerAZ[D]
AndZeroInTheseAZs adds zero-valued entries for each of the given AZs, then returns the same map.
This is used for AZ-aware usage reporting when the main API is not AZ-aware. The initial UsageData is constructed as `InUnknownAZ(totalUsage).AndZeroInTheseAZs(knownAZs)`. Then as we iterate through AZ-localized objects, their respective usage is moved from AZ `any` to their specific AZ using AddLocalizedUsage().
func (PerAZ[D]) Keys ¶
func (p PerAZ[D]) Keys() []limes.AvailabilityZone
Keys returns all availability zones that have entries in this map.
type QuotaDistributionConfiguration ¶
type QuotaDistributionConfiguration struct { FullResourceNameRx regexpext.BoundedRegexp `yaml:"resource"` Model limesresources.QuotaDistributionModel `yaml:"model"` // options for AutogrowQuotaDistribution Autogrow *AutogrowQuotaDistributionConfiguration `yaml:"autogrow"` }
QuotaDistributionConfiguration contains configuration options for specifying the QuotaDistributionModel of specific resources.
type QuotaPlugin ¶
type QuotaPlugin interface { pluggable.Plugin // Init is called before any other interface methods, and allows the plugin to // perform first-time initialization. If the plugin needs to access OpenStack // APIs, it needs to spawn the respective ServiceClients in this method and // retain them. // // Implementations can use it f.i. to discover the available Resources(). For // plugins that support subresource scraping, the final argument indicates // which resources to scrape (the keys are resource names). // // Before Init is called, the `services[].params` provided in the config // file will be yaml.Unmarshal()ed into the plugin object itself. Init(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) error // ServiceInfo returns metadata for this service. // // This receives the `serviceType` as an argument because it needs to appear // in the ServiceInfo struct. But in general, a plugin cannot know which // serviceType it was instantiated for (esp. in unit tests, where the generic // test plugin is instantiated multiple times for different service types). ServiceInfo(serviceType limes.ServiceType) limes.ServiceInfo // Resources returns metadata for all the resources that this plugin scrapes // from the backend service. Resources() []limesresources.ResourceInfo // Scrape queries the backend service for the quota and usage data of all // known resources for the given project in the given domain. The string keys // in the result map must be identical to the resource names // from Resources(). // // The `allAZs` list comes from the Limes config and should be used when // building AZ-aware usage data, to ensure that each AZ-aware resource reports // usage in all available AZs, even when the project in question does not have // usage in every AZ. // // The `serializedMetrics` return value is persisted in the Limes DB and // supplied to all subsequent RenderMetrics calls. Scrape(project KeystoneProject, allAZs []limes.AvailabilityZone) (result map[limesresources.ResourceName]ResourceData, serializedMetrics []byte, err error) // SetQuota updates the backend service's quotas for the given project in the // given domain to the values specified here. The map is guaranteed to contain // values for all resources defined by Resources(). SetQuota(project KeystoneProject, quotas map[limesresources.ResourceName]uint64) error // Rates returns metadata for all the rates that this plugin scrapes // from the backend service. Rates() []limesrates.RateInfo // ScrapeRates queries the backend service for the usage data of all the rates // enumerated by Rates() for the given project in the given domain. The string // keys in the result map must be identical to the rate names from Rates(). // // The serializedState return value is persisted in the Limes DB and returned // back to the next ScrapeRates() call for the same project in the // prevSerializedState argument. Besides that, this field is not interpreted // by the core application in any way. The plugin implementation can use this // field to carry state between ScrapeRates() calls, esp. to detect and handle // counter resets in the backend. ScrapeRates(project KeystoneProject, prevSerializedState string) (result map[limesrates.RateName]*big.Int, serializedState string, err error) // DescribeMetrics is called when Prometheus is scraping metrics from // limes-collect, to provide an opportunity to the plugin to emit its own // metrics. // // Together with CollectMetrics, this interface is roughly analogous to the // prometheus.Collector interface; cf. documentation over there. DescribeMetrics(ch chan<- *prometheus.Desc) // CollectMetrics is called when Prometheus is scraping metrics from // limes-collect, to provide an opportunity to the plugin to emit its own // metrics. The serializedMetrics argument contains the respective value // returned from the last Scrape call on the same project. // // Some plugins also emit metrics directly within Scrape. This newer interface // should be preferred since metrics emitted here won't be lost between // restarts of limes-collect. CollectMetrics(ch chan<- prometheus.Metric, project KeystoneProject, serializedMetrics []byte) error }
QuotaPlugin is the interface that the quota/usage collector plugins for all backend services must implement. There can only be one QuotaPlugin for each backend service.
type RateLimitConfiguration ¶
type RateLimitConfiguration struct { Name limesrates.RateName `yaml:"name"` Unit limes.Unit `yaml:"unit"` Limit uint64 `yaml:"limit"` Window limesrates.Window `yaml:"window"` }
RateLimitConfiguration describes a rate limit configuration.
type ResourceBehavior ¶
type ResourceBehavior struct { FullResourceNameRx regexpext.BoundedRegexp `yaml:"resource"` OvercommitFactor OvercommitFactor `yaml:"overcommit_factor"` CommitmentDurations []limesresources.CommitmentDuration `yaml:"commitment_durations"` CommitmentIsAZAware bool `yaml:"commitment_is_az_aware"` CommitmentMinConfirmDate *time.Time `yaml:"commitment_min_confirm_date"` }
ResourceBehavior contains the configuration options for specialized behaviors of a single resource (or a set thereof).
func (*ResourceBehavior) Merge ¶
func (b *ResourceBehavior) Merge(other ResourceBehavior)
Merge computes the union of both given resource behaviors.
func (ResourceBehavior) ToCommitmentConfig ¶
func (b ResourceBehavior) ToCommitmentConfig(now time.Time) *limesresources.CommitmentConfiguration
ToCommitmentConfig returns the CommitmentConfiguration for this resource, or nil if commitments are not allowed on this resource.
func (*ResourceBehavior) Validate ¶
func (b *ResourceBehavior) Validate(path string) (errs errext.ErrorSet)
Validate returns a list of all errors in this behavior configuration. It also applies default values. The `path` argument denotes the location of this behavior in the configuration file, and will be used when generating error messages.
type ResourceData ¶
type ResourceData struct { Quota int64 // negative values indicate infinite quota MinQuota *uint64 // if set, indicates that SetQuota will reject values below this level MaxQuota *uint64 // if set, indicates that SetQuota will reject values above this level UsageData PerAZ[UsageData] }
ResourceData contains quota and usage data for a single project resource.
func (ResourceData) AddLocalizedUsage ¶
func (r ResourceData) AddLocalizedUsage(az limes.AvailabilityZone, usage uint64)
AddLocalizedUsage subtracts the given `usage from the `unknown` AZ (if any) and adds it to the given AZ instead.
This is used when breaking down a usage total reported by a non-AZ-aware API by iterating over AZ-localized objects. If the sum of usage of the AZ-localized objects matches the reported usage total, the entry for the "unknown" AZ will be removed entirely once it reaches zero usage.
func (ResourceData) UsageInAZ ¶
func (r ResourceData) UsageInAZ(az limes.AvailabilityZone) *UsageData
UsageInAZ is like `r.UsageData[az]`, but inserts a new zero-valued UsageData on first access. This is useful when calculating AZ-aware usage by iterating through a list of AZ-localized objects.
type ResourceDemand ¶
type ResourceDemand struct { Usage uint64 `yaml:"usage"` // UnusedCommitments counts all commitments that are confirmed but not covered by existing usage. UnusedCommitments uint64 `yaml:"unused_commitments"` // PendingCommitments counts all commitments that should be confirmed by now, but are not. PendingCommitments uint64 `yaml:"pending_commitments"` }
ResourceDemand describes cluster-wide demand for a certain resource within a specific AZ. It appears in type CapacityPluginBackchannel.
type ResourceRef ¶
type ResourceRef struct { ServiceType limes.ServiceType ResourceName limesresources.ResourceName }
ResourceRef contains a pair of service type and resource name. When read from the configuration YAML, this deserializes from a string in the "service/resource" format.
func (*ResourceRef) UnmarshalYAML ¶
func (r *ResourceRef) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ServiceConfiguration ¶
type ServiceConfiguration struct { ServiceType limes.ServiceType `yaml:"service_type"` PluginType string `yaml:"type"` // RateLimits describes the global rate limits (all requests for to a backend) and default project level rate limits. RateLimits ServiceRateLimitConfiguration `yaml:"rate_limits"` Parameters util.YamlRawMessage `yaml:"params"` }
ServiceConfiguration describes a service that is enabled for a certain cluster.
type ServiceRateLimitConfiguration ¶
type ServiceRateLimitConfiguration struct { Global []RateLimitConfiguration `yaml:"global"` ProjectDefault []RateLimitConfiguration `yaml:"project_default"` }
ServiceRateLimitConfiguration describes the global and project-level default rate limit configurations for a service.
func (*ServiceRateLimitConfiguration) GetProjectDefaultRateLimit ¶
func (svcRlConfig *ServiceRateLimitConfiguration) GetProjectDefaultRateLimit(name limesrates.RateName) (RateLimitConfiguration, bool)
GetProjectDefaultRateLimit returns the default project-level rate limit for a given target type URI and action or an error if not found.