Documentation
¶
Index ¶
- type APIConfig
- type Config
- type DBConfig
- type DependencyConfig
- type DependencyGraph
- type FeatureExtractorConfig
- type FeaturesConfig
- type FeaturesDependency
- type JsonOpts
- type KPIPluginConfig
- type KPIsConfig
- type LoggingConfig
- type MQTTConfig
- type MonitoringConfig
- type RawOpts
- type SSOConfig
- type SchedulerAPIConfig
- type SchedulerConfig
- type SchedulerStepConfig
- type SchedulerStepDisabledValidationsConfig
- type SyncConfig
- type SyncOpenStackConfig
- type SyncOpenStackKeystoneConfig
- type SyncOpenStackNovaConfig
- type SyncOpenStackPlacementConfig
- type SyncPrometheusConfig
- type SyncPrometheusHostConfig
- type SyncPrometheusMetricConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIConfig ¶
type APIConfig struct {
// The port to expose the API on.
Port int `json:"port"`
}
Configuration for the api port.
type Config ¶
type Config interface {
GetLoggingConfig() LoggingConfig
GetDBConfig() DBConfig
GetSyncConfig() SyncConfig
GetFeaturesConfig() FeaturesConfig
GetSchedulerConfig() SchedulerConfig
GetKPIsConfig() KPIsConfig
GetMonitoringConfig() MonitoringConfig
GetMQTTConfig() MQTTConfig
GetAPIConfig() APIConfig
// Check if the configuration is valid.
Validate() error
}
Configuration for the cortex service.
type DBConfig ¶
type DBConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Database string `json:"database"`
User string `json:"user"`
Password string `json:"password"`
}
Database configuration.
type DependencyConfig ¶
type DependencyConfig struct {
Sync struct {
OpenStack struct {
Nova struct {
ObjectTypes []string `json:"types,omitempty"`
} `json:"nova,omitempty"`
Placement struct {
ObjectTypes []string `json:"types,omitempty"`
} `json:"placement,omitempty"`
} `json:"openstack,omitempty"`
Prometheus struct {
Metrics []struct {
Alias string `json:"alias,omitempty"`
Type string `json:"type,omitempty"`
} `json:"metrics,omitempty"`
} `json:"prometheus,omitempty"`
}
Features FeaturesDependency `json:"features,omitempty"`
}
Configuration that is passed in the config file to specify dependencies.
type DependencyGraph ¶
type DependencyGraph[K comparable] struct { // Dependencies between the individual steps. Dependencies map[K][]K // List of individual steps. Nodes []K }
Dependency graph.
func (*DependencyGraph[K]) DistinctSubgraphs ¶
func (g *DependencyGraph[K]) DistinctSubgraphs(condition func(K) bool) []DependencyGraph[K]
Get distinct subgraphs from the dependency graph where a condition is met.
Example: consider the following graph:
- A -> B (condition: true) -> C, D (condition: true) -> E
- F (condition: true) -> G, H -> I
The result would be two subgraphs: B -> C, D -> E and F -> G, H -> I. The subgraph after node D is part of B's subgraph, therefore we don't get three results.
func (*DependencyGraph[K]) Resolve ¶
func (g *DependencyGraph[K]) Resolve() ([][]K, error)
Resolve the dependency graph into an execution order. This function returns a list of steps which may contain one or multiple steps that can be run in parallel. It starts with the steps that have no dependencies and then recursively resolves the dependencies of the steps that depend on them.
type FeatureExtractorConfig ¶
type FeatureExtractorConfig struct {
// The name of the extractor.
Name string `json:"name"`
// Custom options for the extractor, as a raw yaml map.
Options RawOpts `json:"options,omitempty"`
// The dependencies this extractor needs.
DependencyConfig `json:"dependencies,omitempty"`
}
type FeaturesConfig ¶
type FeaturesConfig struct {
Plugins []FeatureExtractorConfig `json:"plugins"`
}
Configuration for the features module.
type FeaturesDependency ¶
type FeaturesDependency struct {
ExtractorNames []string `json:"extractors,omitempty"`
}
type JsonOpts ¶
type JsonOpts[Options any] struct { // Options loaded from a json config using the Load method. Options Options }
Mixin that adds the ability to load options from a json map. Usage: type StructUsingOpts struct { conf.JsonOpts[MyOpts] }
type KPIPluginConfig ¶
type KPIPluginConfig struct {
// The name of the KPI plugin.
Name string `json:"name"`
// Custom options for the KPI plugin, as a raw json map.
Options RawOpts `json:"options,omitempty"`
// The dependencies this KPI plugin needs.
DependencyConfig `json:"dependencies,omitempty"`
}
Configuration for a single KPI plugin.
type KPIsConfig ¶
type KPIsConfig struct {
// KPI plugins to use.
Plugins []KPIPluginConfig `json:"plugins"`
}
Configuration for the kpis module.
type LoggingConfig ¶
type LoggingConfig struct {
// The log level to use (debug, info, warn, error).
LevelStr string `json:"level"`
// The log format to use (json, text).
Format string `json:"format"`
}
Configuration for structured logging.
func (LoggingConfig) Level ¶
func (c LoggingConfig) Level() slog.Level
Conform to the slog.Leveler interface.
func (LoggingConfig) SetDefaultLogger ¶
func (c LoggingConfig) SetDefaultLogger()
Set the structured logger as given in the config.
type MQTTConfig ¶
type MQTTConfig struct {
// The URL of the MQTT broker to use for mqtt.
URL string `json:"url"`
// Credentials for the MQTT broker.
Username string `json:"username"`
Password string `json:"password"`
}
Configuration for the mqtt client.
type MonitoringConfig ¶
type MonitoringConfig struct {
// The labels to add to all metrics.
Labels map[string]string `json:"labels"`
// The port to expose the metrics on.
Port int `json:"port"`
}
Configuration for the monitoring module.
type RawOpts ¶
type RawOpts struct {
// contains filtered or unexported fields
}
Raw options that are not directly unmarshalled when loading from json. Usage: call Unmarshal to unmarshal the options into a struct.
func NewRawOpts ¶
Create a new RawOpts instance with the given json string.
func (*RawOpts) Unmarshal ¶
Call the postponed unmarshal function and unmarshal the options into a struct.
func (*RawOpts) UnmarshalJSON ¶
Override the default json unmarshal behavior to postpone the unmarshal.
type SSOConfig ¶
type SSOConfig struct {
Cert string `json:"cert,omitempty"`
CertKey string `json:"certKey,omitempty"`
// If the certificate is self-signed, we need to skip verification.
SelfSigned bool `json:"selfSigned,omitempty"`
}
Configuration for single-sign-on (SSO).
type SchedulerAPIConfig ¶
type SchedulerAPIConfig struct {
// If request bodies should be logged out.
// This feature is intended for debugging purposes only.
LogRequestBodies bool `json:"logRequestBodies"`
}
Configuration for the scheduler API.
type SchedulerConfig ¶
type SchedulerConfig struct {
// Scheduler step plugins by their name.
Plugins []SchedulerStepConfig `json:"plugins"`
API SchedulerAPIConfig `json:"api"`
}
Configuration for the scheduler module.
type SchedulerStepConfig ¶
type SchedulerStepConfig struct {
// The name of the step.
Name string `json:"name"`
// Custom options for the step, as a raw yaml map.
Options RawOpts `json:"options,omitempty"`
// The dependencies this step needs.
DependencyConfig `json:"dependencies,omitempty"`
// The validations to use for this step.
DisabledValidations SchedulerStepDisabledValidationsConfig `json:"disabledValidations,omitempty"`
}
type SchedulerStepDisabledValidationsConfig ¶
type SchedulerStepDisabledValidationsConfig struct {
// Whether to validate that no hosts are removed or added from the scheduler
// step. This should only be disabled for scheduler steps that remove hosts.
// Thus, if no value is provided, the default is false.
SameHostNumberInOut bool `json:"sameHostNumberInOut,omitempty"`
}
Config for which validations to disable for a scheduler step.
type SyncConfig ¶
type SyncConfig struct {
Prometheus SyncPrometheusConfig `json:"prometheus"`
OpenStack SyncOpenStackConfig `json:"openstack"`
}
Configuration for the sync module.
type SyncOpenStackConfig ¶
type SyncOpenStackConfig struct {
// Configuration for the keystone service.
Keystone SyncOpenStackKeystoneConfig `json:"keystone"`
// Configuration for the nova service.
Nova SyncOpenStackNovaConfig `json:"nova"`
// Configuration for the placement service.
Placement SyncOpenStackPlacementConfig `json:"placement"`
}
Configuration for the sync/openstack module.
type SyncOpenStackKeystoneConfig ¶
type SyncOpenStackKeystoneConfig struct {
// The URL of the keystone service.
URL string `json:"url"`
// The SSO certificate to use. If none is given, we won't
// use SSO to connect to the openstack services.
SSO SSOConfig `json:"sso,omitempty"`
// The OpenStack username (OS_USERNAME in openstack cli).
OSUsername string `json:"username"`
// The OpenStack password (OS_PASSWORD in openstack cli).
OSPassword string `json:"password"`
// The OpenStack project name (OS_PROJECT_NAME in openstack cli).
OSProjectName string `json:"projectName"`
// The OpenStack user domain name (OS_USER_DOMAIN_NAME in openstack cli).
OSUserDomainName string `json:"userDomainName"`
// The OpenStack project domain name (OS_PROJECT_DOMAIN_NAME in openstack cli).
OSProjectDomainName string `json:"projectDomainName"`
}
Configuration for the keystone authentication.
type SyncOpenStackNovaConfig ¶
type SyncOpenStackNovaConfig struct {
// Availability of the service, such as "public", "internal", or "admin".
Availability string `json:"availability"`
// The types of resources to sync.
Types []string `json:"types"`
}
Configuration for the nova service.
type SyncOpenStackPlacementConfig ¶
type SyncOpenStackPlacementConfig struct {
// Availability of the service, such as "public", "internal", or "admin".
Availability string `json:"availability"`
// The types of resources to sync.
Types []string `json:"types"`
}
Configuration for the placement service.
type SyncPrometheusConfig ¶
type SyncPrometheusConfig struct {
Hosts []SyncPrometheusHostConfig `json:"hosts,omitempty"`
Metrics []SyncPrometheusMetricConfig `json:"metrics,omitempty"`
}
Configuration for the sync/prometheus module containing a list of metrics.
type SyncPrometheusHostConfig ¶
type SyncPrometheusHostConfig struct {
// The name of the prometheus host.
Name string `json:"name"`
// The URL of the prometheus host.
URL string `json:"url"`
// The SSO configuration for this host.
SSO SSOConfig `json:"sso,omitempty"`
// The types of metrics this host provides.
ProvidedMetricTypes []string `json:"provides"`
}
Configuration for a single prometheus host.
type SyncPrometheusMetricConfig ¶
type SyncPrometheusMetricConfig struct {
// The query to use to fetch the metric.
Query string `json:"query"`
// Especially when a more complex query is used, we need an alias
// under which the table will be stored in the database.
// Additionally, this alias is used to reference the metric in the
// feature extractors as dependency.
Alias string `json:"alias"`
// The type of the metric, mapping directly to a metric model.
Type string `json:"type"`
TimeRangeSeconds *int `json:"timeRangeSeconds,omitempty"`
IntervalSeconds *int `json:"intervalSeconds,omitempty"`
ResolutionSeconds *int `json:"resolutionSeconds,omitempty"`
}
Metric configuration for the sync/prometheus module.