plugins

package
v0.0.0-...-f51211f Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericQuotaPlugin

type GenericQuotaPlugin struct {
	ServiceType              db.ServiceType                                                 `yaml:"-"`
	LiquidServiceInfo        liquid.ServiceInfo                                             `yaml:"-"`
	StaticRateInfos          map[liquid.RateName]liquid.RateInfo                            `yaml:"rate_infos"`
	StaticResourceData       map[liquid.ResourceName]*core.ResourceData                     `yaml:"-"`
	StaticResourceAttributes map[liquid.ResourceName]map[string]any                         `yaml:"-"`
	OverrideQuota            map[string]map[liquid.ResourceName]liquid.ResourceQuotaRequest `yaml:"-"` // first key is project UUID
	// behavior flags that can be set by a unit test
	ReportedAZs   map[liquid.AvailabilityZone]struct{} `yaml:"-"`
	ScrapeFails   bool                                 `yaml:"-"`
	SetQuotaFails bool                                 `yaml:"-"`
	MinQuota      map[liquid.ResourceName]uint64       `yaml:"-"`
	MaxQuota      map[liquid.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) BuildServiceUsageRequest

func (p *GenericQuotaPlugin) BuildServiceUsageRequest(project core.KeystoneProject, allAZs []limes.AvailabilityZone) (liquid.ServiceUsageRequest, error)

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

func (p *GenericQuotaPlugin) Init(ctx context.Context, provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, serviceType db.ServiceType) error

Init implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) PluginTypeID

func (p *GenericQuotaPlugin) PluginTypeID() string

PluginTypeID implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Rates

Rates implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Resources

Resources implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) Scrape

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

Scrape implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) ScrapeRates

func (p *GenericQuotaPlugin) ScrapeRates(ctx context.Context, project core.KeystoneProject, allAZs []limes.AvailabilityZone, prevSerializedState string) (result map[liquid.RateName]*big.Int, serializedState string, err error)

ScrapeRates implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) ServiceInfo

func (p *GenericQuotaPlugin) ServiceInfo() core.ServiceInfo

ServiceInfo implements the core.QuotaPlugin interface.

func (*GenericQuotaPlugin) SetQuota

SetQuota implements the core.QuotaPlugin interface.

type NoopQuotaPlugin

type NoopQuotaPlugin struct {
	ServiceType            db.ServiceType `yaml:"-"`
	WithEmptyResource      bool           `yaml:"with_empty_resource"`
	WithConvertCommitments bool           `yaml:"with_convert_commitments"`
}

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) BuildServiceUsageRequest

func (p *NoopQuotaPlugin) BuildServiceUsageRequest(project core.KeystoneProject, allAZs []limes.AvailabilityZone) (liquid.ServiceUsageRequest, error)

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

func (p *NoopQuotaPlugin) Init(ctx context.Context, provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, serviceType db.ServiceType) error

Init implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) PluginTypeID

func (p *NoopQuotaPlugin) PluginTypeID() string

PluginTypeID implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Rates

Rates implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Resources

Resources implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) Scrape

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

Scrape implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) ScrapeRates

func (p *NoopQuotaPlugin) ScrapeRates(ctx context.Context, project core.KeystoneProject, allAZs []limes.AvailabilityZone, prevSerializedState string) (result map[liquid.RateName]*big.Int, serializedState string, err error)

ScrapeRates implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) ServiceInfo

func (p *NoopQuotaPlugin) ServiceInfo() core.ServiceInfo

ServiceInfo implements the core.QuotaPlugin interface.

func (*NoopQuotaPlugin) SetQuota

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) BuildServiceCapacityRequest

func (p *StaticCapacityPlugin) BuildServiceCapacityRequest(backchannel core.CapacityPluginBackchannel, allAZs []limes.AvailabilityZone) (liquid.ServiceCapacityRequest, error)

func (*StaticCapacityPlugin) CollectMetrics

func (p *StaticCapacityPlugin) CollectMetrics(ch chan<- prometheus.Metric, serializedMetrics []byte, capacitorID string) 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

func (p *StaticCapacityPlugin) Init(ctx context.Context, provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) error

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

func (p *StaticDiscoveryPlugin) Init(ctx context.Context, client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) error

Init implements the core.DiscoveryPlugin interface.

func (*StaticDiscoveryPlugin) ListDomains

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

ListDomains implements the core.DiscoveryPlugin interface.

func (*StaticDiscoveryPlugin) ListProjects

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