status

package
v0.0.0-...-4477587 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 IstioGenerationProvider

type IstioGenerationProvider struct {
	*v1alpha1.IstioStatus
}

func (*IstioGenerationProvider) SetInner

func (i *IstioGenerationProvider) SetInner(c any)

func (*IstioGenerationProvider) SetObservedGeneration

func (i *IstioGenerationProvider) SetObservedGeneration(in int64)

func (*IstioGenerationProvider) SetValidationMessages

func (i *IstioGenerationProvider) SetValidationMessages(msgs diag.Messages)

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 Manipulator, context any)) *Controller

func (*Manager) Start

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

type Manipulator

type Manipulator interface {
	SetObservedGeneration(int64)
	SetValidationMessages(msgs diag.Messages)
	SetInner(c any)
	Unwrap() any
}

Manipulator gives controllers an opportunity to manipulate the status of an object. This allows the controller to be generic over the types of status messages it needs to handle.

func GetStatusManipulator

func GetStatusManipulator(in any) (out Manipulator)

type NopStatusManipulator

type NopStatusManipulator struct {
	// contains filtered or unexported fields
}

func (*NopStatusManipulator) SetInner

func (n *NopStatusManipulator) SetInner(c any)

func (*NopStatusManipulator) SetObservedGeneration

func (n *NopStatusManipulator) SetObservedGeneration(i int64)

func (*NopStatusManipulator) SetValidationMessages

func (n *NopStatusManipulator) SetValidationMessages(msgs diag.Messages)

func (*NopStatusManipulator) Unwrap

func (n *NopStatusManipulator) Unwrap() any

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 (Resource) String

func (r Resource) String() string

func (*Resource) ToModelKey

func (r *Resource) ToModelKey() string

type ServiceEntryGenerationProvider

type ServiceEntryGenerationProvider struct {
	*networking.ServiceEntryStatus
}

func (*ServiceEntryGenerationProvider) SetInner

func (i *ServiceEntryGenerationProvider) SetInner(c any)

func (*ServiceEntryGenerationProvider) SetObservedGeneration

func (i *ServiceEntryGenerationProvider) SetObservedGeneration(in int64)

func (*ServiceEntryGenerationProvider) SetValidationMessages

func (i *ServiceEntryGenerationProvider) SetValidationMessages(msgs diag.Messages)

func (*ServiceEntryGenerationProvider) Unwrap

func (i *ServiceEntryGenerationProvider) Unwrap() any

type Task

type Task func(entry cacheEntry)

Task to be performed.

type UpdateFunc

type UpdateFunc func(status Manipulator, context any)

UpdateFunc is called on each object before it is written to allow mutating any status

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), get func(Resource) *config.Config, maxWorkers uint) WorkerQueue

Jump to

Keyboard shortcuts

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