Documentation
¶
Index ¶
Constants ¶
const ( // MaxControllerTimeout is max timeout (s) between each intent's reevaluation. MaxControllerTimeout = 600 // MaxInformerTimeout is max timeout (s) for the informer factories for the CRDs and PODs. MaxInformerTimeout = 300 // MaxTaskChannelLen is max length for job queue for processing intents. MaxTaskChannelLen = 10000 // MaxPlanCacheTimeout is max timeout (ms) between each intent's reevaluation. MaxPlanCacheTimeout = 50000 // MaxPlanCacheTTL is max time-to-live (ms) for an entry in the planner's cache. MaxPlanCacheTTL = 500000 )
Variables ¶
This section is empty.
Functions ¶
func LoadConfig ¶
LoadConfig reads the configuration file and marshals it into an object.
Types ¶
type Config ¶
type Config struct {
Generic GenericConfig `json:"generic"`
Controller ControllerConfig `json:"controller"`
Monitor MonitorConfig `json:"monitor"`
Planner PlannerConfig `json:"planner"`
}
Config holds all the configuration information.
func ParseConfig ¶
ParseConfig loads the configuration from a JSON file.
type ControllerConfig ¶
type ControllerConfig struct {
Workers int `json:"workers"`
TaskChannelLength int `json:"task_channel_length"`
InformerTimeout int `json:"informer_timeout"`
ControllerTimeout int `json:"controller_timeout"`
PlanCacheTTL int `json:"plan_cache_ttl"`
PlanCacheTimeout int `json:"plan_cache_timeout"`
TelemetryEndpoint string `json:"telemetry_endpoint"`
HostField string `json:"host_field"`
Metrics []struct {
Name string `json:"name,omitempty"`
Query string `json:"query,omitempty"`
} `json:"metrics"`
}
ControllerConfig holds controller related configs.
type GenericConfig ¶
type GenericConfig struct {
MongoEndpoint string `json:"mongo_endpoint"`
}
GenericConfig captures generic configuration fields.
type Intent ¶
type Intent struct {
Key string
Priority float64
TargetKey string
TargetKind string
Objectives map[string]float64
}
Intent holds information about an intent in the system.
type MonitorConfig ¶
type MonitorConfig struct {
Pod struct {
Workers int `json:"workers"`
} `json:"pod"`
Profile struct {
Workers int `json:"workers"`
Queries string `json:"queries"`
} `json:"profile"`
Intent struct {
Workers int `json:"workers"`
} `json:"intent"`
}
MonitorConfig holds monitor related configs.
type PlannerConfig ¶
type PlannerConfig struct {
AStar struct {
OpportunisticCandidates int `json:"opportunistic_candidates"`
MaxStates int `json:"max_states"`
MaxCandidates int `json:"max_candidates"`
PluginManagerEndpoint string `json:"plugin_manager_endpoint"`
PluginManagerPort int `json:"plugin_manager_port"`
} `json:"astar"`
}
PlannerConfig holds planner related configs. TODO: fuzz test max states, candidates etc.
type Profile ¶
type Profile struct {
Key string
ProfileType ProfileType
Query string
External bool
Address string
}
Profile holds information about valid objective profiles.
type ProfileType ¶
type ProfileType int
ProfileType defines the type of KPIProfiles.
const ( Obsolete ProfileType = iota Latency Availability Throughput Power )
func ProfileTypeFromText ¶
func ProfileTypeFromText(text string) ProfileType
ProfileTypeFromText converts string into the right int.
type State ¶
type State struct {
Intent Intent
CurrentPods map[string]PodState
CurrentData map[string]map[string]float64
Resources map[string]int64
Annotations map[string]string
}
State represents the state a set of PODs can be in.
func (*State) Distance ¶
Distance calculates the euclidean Distance between two states. Potentially we can add weights here maybe - or another way to calculate the Distance so e.g. the Distance for P99 is more important than the Distance in P50 latency.
func (*State) IsBetter ¶ added in v0.2.0
IsBetter compares the objectives of one state to another - returns true if all latency or power related objective targets are smaller or equal, and all others are larger or equal.
func (*State) LessResources ¶ added in v0.2.0
LessResources contrast the resources and returns true if one state has less resource than another.