Documentation
¶
Index ¶
- func GVKtoGVR(in config.GroupVersionKind) *schema.GroupVersionResource
- func GVRtoGVK(in schema.GroupVersionResource) config.GroupVersionKind
- func GetTypedStatus(in interface{}) (out *v1alpha1.IstioStatus, err error)
- func NewIstioContext(stop <-chan struct{}) context.Context
- func ResourceToModelConfig(c Resource) config.Meta
- type Controller
- type GenerationProvider
- type IstioGenerationProvider
- type Manager
- type Resource
- type Task
- type UpdateFunc
- type WorkQueue
- type WorkerPool
- type WorkerQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GVKtoGVR ¶
func GVKtoGVR(in config.GroupVersionKind) *schema.GroupVersionResource
func GVRtoGVK ¶
func GVRtoGVK(in schema.GroupVersionResource) config.GroupVersionKind
func GetTypedStatus ¶
func GetTypedStatus(in interface{}) (out *v1alpha1.IstioStatus, err error)
func NewIstioContext ¶
func ResourceToModelConfig ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func (*Controller) Delete ¶
func (c *Controller) Delete(r Resource)
func (*Controller) EnqueueStatusUpdateResource ¶
func (c *Controller) EnqueueStatusUpdateResource(context interface{}, target Resource)
EnqueueStatusUpdateResource informs the manager that this controller would like to update the status of target, using the information in context. Once the status workers are ready to perform this update, the controller's UpdateFunc will be called with target and context as input.
type GenerationProvider ¶
type GenerationProvider interface { SetObservedGeneration(int64) Unwrap() interface{} }
func GetOGProvider ¶
func GetOGProvider(in interface{}) (out GenerationProvider, err error)
type IstioGenerationProvider ¶
type IstioGenerationProvider struct {
*v1alpha1.IstioStatus
}
func (*IstioGenerationProvider) SetObservedGeneration ¶
func (i *IstioGenerationProvider) SetObservedGeneration(in int64)
func (*IstioGenerationProvider) Unwrap ¶
func (i *IstioGenerationProvider) Unwrap() interface{}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager allows multiple controllers to provide input into configuration status without needlessly doubling the number of writes, or overwriting one another. Each status controller calls newController, passing in an arbitrary status modification function, and then calls EnqueueStatusUpdate when an individual resource is ready to be updated with the relevant data.
func NewManager ¶
func NewManager(store model.ConfigStore) *Manager
func (*Manager) CreateGenericController ¶
func (m *Manager) CreateGenericController(fn UpdateFunc) *Controller
CreateGenericController provides an interface for a status update function to be called in series with other controllers, minimizing the number of actual api server writes sent from various status controllers. The UpdateFunc must take the target resrouce status and arbitrary context information as parameters, and return the updated status value. Multiple controllers will be called in series, so the input status may not have been written to the API server yet, and the output status may be modified by other controllers before it is written to the server.
func (*Manager) CreateIstioStatusController ¶
func (m *Manager) CreateIstioStatusController(fn func(status *v1alpha1.IstioStatus, context interface{}) *v1alpha1.IstioStatus) *Controller
type Resource ¶
type Resource struct { schema.GroupVersionResource Namespace string Name string Generation string }
TODO: maybe replace with a kubernetes resource identifier, if that's a thing
func ResourceFromMetadata ¶
func ResourceFromModelConfig ¶
func ResourceFromString ¶
func (*Resource) ToModelKey ¶
type UpdateFunc ¶
type UpdateFunc func(status interface{}, context interface{}) GenerationProvider
type WorkQueue ¶
type WorkQueue struct { OnPush func() // contains filtered or unexported fields }
func (*WorkQueue) Pop ¶
func (wq *WorkQueue) Pop(exclusion map[lockResource]struct{}) (target Resource, progress map[*Controller]interface{})
Pop returns the first item in the queue not in exclusion, along with it's latest progress
func (*WorkQueue) Push ¶
func (wq *WorkQueue) Push(target Resource, ctl *Controller, progress interface{})
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func (*WorkerPool) Delete ¶
func (wp *WorkerPool) Delete(target Resource)
func (*WorkerPool) Push ¶
func (wp *WorkerPool) Push(target Resource, controller *Controller, context interface{})
func (*WorkerPool) Run ¶
func (wp *WorkerPool) Run(ctx context.Context)
type WorkerQueue ¶
type WorkerQueue interface { // Push a task. Push(target Resource, controller *Controller, context interface{}) // Run the loop until a signal on the context Run(ctx context.Context) // Delete a task Delete(target Resource) }
WorkerQueue implements an expandable goroutine pool which executes at most one concurrent routine per target resource. Multiple calls to Push() will not schedule multiple executions per target resource, but will ensure that the single execution uses the latest value.