status

package
v0.0.0-...-5e5ceee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypedStatus

func GetTypedStatus(in any) (out *v1alpha1.IstioStatus, err error)

func NewIstioContext

func NewIstioContext(stop <-chan struct{}) context.Context

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 any, 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() any
}

func GetOGProvider

func GetOGProvider(in any) (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() any

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 resource 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 any) *v1alpha1.IstioStatus) *Controller

func (*Manager) Start

func (m *Manager) Start(stop <-chan struct{})

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 ResourceFromMetadata(i resource.Metadata) Resource

func ResourceFromModelConfig

func ResourceFromModelConfig(c config.Config) Resource

func ResourceFromString

func ResourceFromString(s string) *Resource

func (Resource) String

func (r Resource) String() string

func (*Resource) ToModelKey

func (r *Resource) ToModelKey() string

type Task

type Task func(entry cacheEntry)

Task to be performed.

type UpdateFunc

type UpdateFunc func(status any, context any) GenerationProvider

type WorkQueue

type WorkQueue struct {
	OnPush func()
	// contains filtered or unexported fields
}

func (*WorkQueue) Delete

func (wq *WorkQueue) Delete(target Resource)

func (*WorkQueue) Length

func (wq *WorkQueue) Length() int

func (*WorkQueue) Pop

func (wq *WorkQueue) Pop(exclusion sets.Set[lockResource]) (target Resource, progress map[*Controller]any)

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 any)

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 any)

func (*WorkerPool) Run

func (wp *WorkerPool) Run(ctx context.Context)

type WorkerQueue

type WorkerQueue interface {
	// Push a task.
	Push(target Resource, controller *Controller, context any)
	// 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.

func NewWorkerPool

func NewWorkerPool(write func(*config.Config, any), get func(Resource) *config.Config, maxWorkers uint) WorkerQueue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL