Documentation ¶
Index ¶
- Constants
- Variables
- func MockResponse(messageBody string, statusCode int)
- func PodSetAvailability(pods map[string]common.PodState) float64
- type IntentController
- func (c *IntentController) Run(nWorkers int, stopper <-chan struct{})
- func (c *IntentController) SetPlanner(planner planner.Planner)
- func (c *IntentController) UpdateIntent() chan<- common.Intent
- func (c *IntentController) UpdatePodError() chan<- common.PodError
- func (c *IntentController) UpdateProfile() chan<- common.Profile
- type IntentMonitor
- type KPIProfileMonitor
- type MockClient
- type MongoTracer
- type PodMonitor
- type Tracer
Constants ¶
const MongoURIForTesting string = "mongodb://foo:123"
MongoURIForTesting enables test cases.
Variables ¶
var Client httpClient
Client represents a http client.
Functions ¶
func MockResponse ¶
MockResponse sets up the mock function.
Types ¶
type IntentController ¶
type IntentController struct {
// contains filtered or unexported fields
}
IntentController defines the overall intent controller.
func NewController ¶
func NewController(cfg common.Config, tracer Tracer, clientSet kubernetes.Interface, informer v1.PodInformer) *IntentController
NewController initializes a new IntentController.
func (*IntentController) Run ¶
func (c *IntentController) Run(nWorkers int, stopper <-chan struct{})
Run the overall IntentController logic.
func (*IntentController) SetPlanner ¶
func (c *IntentController) SetPlanner(planner planner.Planner)
SetPlanner sets planner used by all workers. This function is thread-safe, it blocks until the planner is set. All jobs run before SetPlanner call will finish their computations using previous planner.
func (*IntentController) UpdateIntent ¶
func (c *IntentController) UpdateIntent() chan<- common.Intent
UpdateIntent channel function used by the intent monitor so send updates.
func (*IntentController) UpdatePodError ¶
func (c *IntentController) UpdatePodError() chan<- common.PodError
UpdatePodError channel function used by the pod monitor to send updates.
func (*IntentController) UpdateProfile ¶
func (c *IntentController) UpdateProfile() chan<- common.Profile
UpdateProfile channel function used by the profile monitor to send updates.
type IntentMonitor ¶
type IntentMonitor struct {
// contains filtered or unexported fields
}
IntentMonitor is the part implementing the monitoring of Intents.
func NewIntentMonitor ¶
func NewIntentMonitor(intentClient clientSet.Interface, intentInformer informers.IntentInformer, ch chan<- common.Intent) *IntentMonitor
NewIntentMonitor returns a new monitor instance.
func (*IntentMonitor) Run ¶
func (mon *IntentMonitor) Run(nWorkers int, stopper <-chan struct{})
Run the basic monitor.
type KPIProfileMonitor ¶
type KPIProfileMonitor struct {
// contains filtered or unexported fields
}
KPIProfileMonitor is the part implementing the monitoring the KPIProfiles.
func NewKPIProfileMonitor ¶
func NewKPIProfileMonitor(cfg common.MonitorConfig, profileClient clientSet.Interface, profileInformer informers.KPIProfileInformer, ch chan<- common.Profile) *KPIProfileMonitor
NewKPIProfileMonitor returns a new monitor instance.
func (*KPIProfileMonitor) Run ¶
func (mon *KPIProfileMonitor) Run(nWorkers int, stopper <-chan struct{})
Run the basic monitors.
type MongoTracer ¶
type MongoTracer struct {
// contains filtered or unexported fields
}
MongoTracer wraps around a MongoDB client.
func NewMongoTracer ¶
func NewMongoTracer(mongoURI string) *MongoTracer
NewMongoTracer initializes a new tracer.
func (MongoTracer) TraceEvent ¶
type PodMonitor ¶
type PodMonitor struct {
// contains filtered or unexported fields
}
PodMonitor struct.
func NewPodMonitor ¶
func NewPodMonitor(podClient kubernetes.Interface, informer coreInformer.PodInformer, ch chan<- common.PodError) *PodMonitor
NewPodMonitor initialize a new monitor for PODs - the foundation of a lot of what is going on in K8s/K3s.
func (*PodMonitor) Run ¶
func (mon *PodMonitor) Run(nWorkers int, stopper <-chan struct{})
Run the basic monitors. Note that it is crucial to have enough workers, so you do not miss any errors as they are stuck in the queue.
type Tracer ¶
type Tracer interface { // TraceEvent adds an event to the e.g. a database. TraceEvent(current common.State, desired common.State, plan []planner.Action) // GetEffect returns the data describing the effect of an action. GetEffect(name string, group string, profileName string, lookBackMinutes int, constructor func() interface{}) (interface{}, error) }
Tracer allows us to trace events & hence keep a record of what the planner did.