plugins

package
v0.0.0-...-ac5aeb3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoApprovalQuotaPlugin

type AutoApprovalQuotaPlugin struct {
	StaticBackendQuota uint64 `yaml:"static_backend_quota"`
}

AutoApprovalQuotaPlugin is a core.QuotaPlugin implementation for testing the auto-approval mechanism in quota scraping.

func (*AutoApprovalQuotaPlugin) CollectMetrics

func (p *AutoApprovalQuotaPlugin) CollectMetrics(ch chan<- prometheus.Metric, project core.KeystoneProject, serializedMetrics []byte) error

CollectMetrics implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) DescribeMetrics

func (p *AutoApprovalQuotaPlugin) DescribeMetrics(ch chan<- *prometheus.Desc)

DescribeMetrics implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) Init

Init implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) PluginTypeID

func (p *AutoApprovalQuotaPlugin) PluginTypeID() string

PluginTypeID implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) Rates

Rates implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) Resources

Resources implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) Scrape

func (p *AutoApprovalQuotaPlugin) Scrape(project core.KeystoneProject, allAZs []limes.AvailabilityZone) (result map[limesresources.ResourceName]core.ResourceData, serializedMetrics []byte, err error)

Scrape implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) ScrapeRates

func (p *AutoApprovalQuotaPlugin) ScrapeRates(project core.KeystoneProject, prevSerializedState string) (result map[limesrates.RateName]*big.Int, serializedState string, err error)

ScrapeRates implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) ServiceInfo

func (p *AutoApprovalQuotaPlugin) ServiceInfo(serviceType limes.ServiceType) limes.ServiceInfo

ServiceInfo implements the core.QuotaPlugin interface.

func (*AutoApprovalQuotaPlugin) SetQuota

SetQuota implements the core.QuotaPlugin interface.

type GenericQuotaPlugin

type GenericQuotaPlugin struct {
	StaticRateInfos    []limesrates.RateInfo                              `yaml:"rate_infos"`
	StaticResourceData map[limesresources.ResourceName]*core.ResourceData `yaml:"-"`
	OverrideQuota      map[string]map[limesresources.ResourceName]uint64  `yaml:"-"` // first key is project UUID
	// behavior flags that can be set by a unit test
	ScrapeFails   bool                                   `yaml:"-"`
	SetQuotaFails bool                                   `yaml:"-"`
	MinQuota      map[limesresources.ResourceName]uint64 `yaml:"-"`
	MaxQuota      map[limesresources.ResourceName]uint64 `yaml:"-"`
}

GenericQuotaPlugin is a core.QuotaPlugin implementation for unit tests. It mostly reports static data and offers several controls to simulate failed operations.

func (*GenericQuotaPlugin) CollectMetrics

func (p *GenericQuotaPlugin) CollectMetrics(ch chan<- prometheus.Metric, project core.KeystoneProject, serializedMetrics []byte) error

CollectMetrics implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) DescribeMetrics

func (p *GenericQuotaPlugin) DescribeMetrics(ch chan<- *prometheus.Desc)

DescribeMetrics implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Init

Init implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) PluginTypeID

func (p *GenericQuotaPlugin) PluginTypeID() string

PluginTypeID implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Rates

func (p *GenericQuotaPlugin) Rates() []limesrates.RateInfo

Rates implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Resources

Resources implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Scrape

func (p *GenericQuotaPlugin) Scrape(project core.KeystoneProject, allAZs []limes.AvailabilityZone) (result map[limesresources.ResourceName]core.ResourceData, serializedMetrics []byte, err error)

Scrape implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) ScrapeRates

func (p *GenericQuotaPlugin) ScrapeRates(project core.KeystoneProject, prevSerializedState string) (result map[limesrates.RateName]*big.Int, serializedState string, err error)

ScrapeRates implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) ServiceInfo

func (p *GenericQuotaPlugin) ServiceInfo(serviceType limes.ServiceType) limes.ServiceInfo

ServiceInfo implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) SetQuota

SetQuota implements the core.QuotaPlugin interface.

type NoopQuotaPlugin

type NoopQuotaPlugin struct {
	WithEmptyResource bool `yaml:"with_empty_resource"`
}

NoopQuotaPlugin is a core.QuotaPlugin implementation for tests, with no resources or rates at all.

Alternatively, `with_empty_resource: true` can be set to report a resource with no UsageData at all (not even zero, the UsageData map just does not have any entries at all).

func (*NoopQuotaPlugin) CollectMetrics

func (p *NoopQuotaPlugin) CollectMetrics(ch chan<- prometheus.Metric, project core.KeystoneProject, serializedMetrics []byte) error

CollectMetrics implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) DescribeMetrics

func (p *NoopQuotaPlugin) DescribeMetrics(ch chan<- *prometheus.Desc)

DescribeMetrics implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Init

Init implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) PluginTypeID

func (p *NoopQuotaPlugin) PluginTypeID() string

PluginTypeID implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Rates

func (p *NoopQuotaPlugin) Rates() []limesrates.RateInfo

Rates implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Resources

func (p *NoopQuotaPlugin) Resources() []limesresources.ResourceInfo

Resources implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Scrape

func (p *NoopQuotaPlugin) Scrape(project core.KeystoneProject, allAZs []limes.AvailabilityZone) (result map[limesresources.ResourceName]core.ResourceData, serializedMetrics []byte, err error)

Scrape implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) ScrapeRates

func (p *NoopQuotaPlugin) ScrapeRates(project core.KeystoneProject, prevSerializedState string) (result map[limesrates.RateName]*big.Int, serializedState string, err error)

ScrapeRates implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) ServiceInfo

func (p *NoopQuotaPlugin) ServiceInfo(serviceType limes.ServiceType) limes.ServiceInfo

ServiceInfo implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) SetQuota

func (p *NoopQuotaPlugin) SetQuota(project core.KeystoneProject, quotas map[limesresources.ResourceName]uint64) error

SetQuota implements the core.QuotaPlugin interface.

type StaticCapacityPlugin

type StaticCapacityPlugin struct {
	Resources         []string `yaml:"resources"` // each formatted as "servicetype/resourcename"
	Capacity          uint64   `yaml:"capacity"`
	WithAZCapData     bool     `yaml:"with_capacity_per_az"`
	WithSubcapacities bool     `yaml:"with_subcapacities"`
	WithoutUsage      bool     `yaml:"without_usage"`
}

StaticCapacityPlugin is a core.CapacityPlugin implementation for unit tests.

func (*StaticCapacityPlugin) CollectMetrics

func (p *StaticCapacityPlugin) CollectMetrics(ch chan<- prometheus.Metric, serializedMetrics []byte) error

CollectMetrics implements the core.CapacityPlugin interface.

func (*StaticCapacityPlugin) DescribeMetrics

func (p *StaticCapacityPlugin) DescribeMetrics(ch chan<- *prometheus.Desc)

DescribeMetrics implements the core.CapacityPlugin interface.

func (*StaticCapacityPlugin) Init

Init implements the core.CapacityPlugin interface.

func (*StaticCapacityPlugin) PluginTypeID

func (p *StaticCapacityPlugin) PluginTypeID() string

PluginTypeID implements the core.CapacityPlugin interface.

func (*StaticCapacityPlugin) Scrape

Scrape implements the core.CapacityPlugin interface.

type StaticDiscoveryPlugin

type StaticDiscoveryPlugin struct {
	Domains  []core.KeystoneDomain             `yaml:"domains"`
	Projects map[string][]core.KeystoneProject `yaml:"projects"`
}

StaticDiscoveryPlugin is a core.DiscoveryPlugin implementation for unit tests. It reports a static set of domains and projects.

func (*StaticDiscoveryPlugin) Init

Init implements the core.DiscoveryPlugin interface.

func (*StaticDiscoveryPlugin) ListDomains

func (p *StaticDiscoveryPlugin) ListDomains() ([]core.KeystoneDomain, error)

ListDomains implements the core.DiscoveryPlugin interface.

func (*StaticDiscoveryPlugin) ListProjects

func (p *StaticDiscoveryPlugin) ListProjects(domain core.KeystoneDomain) ([]core.KeystoneProject, error)

ListProjects implements the core.DiscoveryPlugin interface.

func (*StaticDiscoveryPlugin) PluginTypeID

func (p *StaticDiscoveryPlugin) PluginTypeID() string

PluginTypeID implements the core.DiscoveryPlugin interface.

Jump to

Keyboard shortcuts

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