Documentation
¶
Index ¶
- func GetConfigOrDie[C any]() C
- type APIConfig
- type Config
- type DBConfig
- type DBReconnectConfig
- type DependencyConfig
- type JsonOpts
- type KeystoneConfig
- type LoggingConfig
- type MQTTConfig
- type MQTTReconnectConfig
- type MonitoringConfig
- type NovaHypervisorType
- type RawOpts
- type SSOConfig
- type SchedulerAPIConfig
- type SchedulerStepConfig
- type SchedulerStepDisabledValidationsConfig
- type SharedConfig
- func (c *SharedConfig) GetAPIConfig() APIConfig
- func (c *SharedConfig) GetDBConfig() DBConfig
- func (c *SharedConfig) GetKeystoneConfig() KeystoneConfig
- func (c *SharedConfig) GetLoggingConfig() LoggingConfig
- func (c *SharedConfig) GetMQTTConfig() MQTTConfig
- func (c *SharedConfig) GetMonitoringConfig() MonitoringConfig
- func (c *SharedConfig) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigOrDie ¶
func GetConfigOrDie[C any]() C
Create a new configuration from the default config json file.
This will read two files:
- /etc/config/conf.json
- /etc/secrets/secrets.json
The values read from secrets.json will override the values in conf.json
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
GetMonitoringConfig() MonitoringConfig
GetMQTTConfig() MQTTConfig
GetAPIConfig() APIConfig
GetKeystoneConfig() KeystoneConfig
// 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"`
Reconnect DBReconnectConfig `json:"reconnect"`
}
Database configuration.
type DBReconnectConfig ¶
type DBReconnectConfig struct {
// The interval between liveness pings to the database.
LivenessPingIntervalSeconds int `json:"livenessPingIntervalSeconds"`
// The interval between reconnection attempts on connection loss.
RetryIntervalSeconds int `json:"retryIntervalSeconds"`
// The maximum number of reconnection attempts on connection loss before panic.
MaxRetries int `json:"maxRetries"`
}
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"`
}
Extractors []string `json:"extractors,omitempty"`
}
Configuration that is passed in the config file to specify dependencies.
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 KeystoneConfig ¶
type KeystoneConfig 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 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"`
Reconnect MQTTReconnectConfig `json:"reconnect"`
}
Configuration for the mqtt client.
type MQTTReconnectConfig ¶
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 NovaHypervisorType ¶
type NovaHypervisorType = string
const ( NovaHypervisorTypeQEMU NovaHypervisorType = "QEMU" NovaHypervisorTypeCH NovaHypervisorType = "CH" // Cloud hypervisor NovaHypervisorTypeVMware NovaHypervisorType = "VMware vCenter Server" NovaHypervisorTypeIronic NovaHypervisorType = "ironic" )
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 SchedulerStepConfig ¶
type SchedulerStepConfig[Extra any] struct { // The name of the step implementation. Name string `json:"name"` // The alias of this step, if any. // // The alias can be used to distinguish between different configurations // of the same step, or use a more specific name. Alias string `json:"alias,omitempty"` // 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"` // Additional configuration for the step, if needed. Extra *Extra `json:"extra,omitempty"` }
type SchedulerStepDisabledValidationsConfig ¶
type SchedulerStepDisabledValidationsConfig struct {
// Whether to validate that no subjects are removed or added from the scheduler
// step. This should only be disabled for scheduler steps that remove subjects.
// Thus, if no value is provided, the default is false.
SameSubjectNumberInOut bool `json:"sameSubjectNumberInOut,omitempty"`
// Whether to validate that, after running the step, there are remaining subjects.
// This should only be disabled for scheduler steps that are expected to
// remove all subjects.
SomeSubjectsRemain bool `json:"someSubjectsRemain,omitempty"`
}
Config for which validations to disable for a scheduler step.
type SharedConfig ¶
type SharedConfig struct {
}
func (*SharedConfig) GetAPIConfig ¶
func (c *SharedConfig) GetAPIConfig() APIConfig
func (*SharedConfig) GetDBConfig ¶
func (c *SharedConfig) GetDBConfig() DBConfig
func (*SharedConfig) GetKeystoneConfig ¶
func (c *SharedConfig) GetKeystoneConfig() KeystoneConfig
func (*SharedConfig) GetLoggingConfig ¶
func (c *SharedConfig) GetLoggingConfig() LoggingConfig
func (*SharedConfig) GetMQTTConfig ¶
func (c *SharedConfig) GetMQTTConfig() MQTTConfig
func (*SharedConfig) GetMonitoringConfig ¶
func (c *SharedConfig) GetMonitoringConfig() MonitoringConfig
func (*SharedConfig) Validate ¶
func (c *SharedConfig) Validate() error
Check if all dependencies are satisfied.