Documentation
¶
Index ¶
- func CreateWithBackoff(ctx context.Context, c dynamic.ResourceInterface, ...) *unstructured.Unstructured
- type Applier
- type Filter
- type FilterEngine
- type FilterFunc
- type Option
- type Phase
- func (p *Phase) AddWave(wave Wave)
- func (p *Phase) AppliedCount() int
- func (p *Phase) DeletedCount() int
- func (p *Phase) HasResources() bool
- func (p *Phase) HasWaves() bool
- func (p *Phase) Name() smcommon.SyncPhase
- func (p *Phase) ResourceCount() int
- func (p *Phase) ResourceHealth() (pending, failed bool, err error)
- func (p *Phase) Skipped() []unstructured.Unstructured
- func (p *Phase) SkippedCount() int
- func (p *Phase) Waves() []Wave
- type Phases
- type Wave
- type WaveProcessor
- type WaveProcessorOption
- func WithWaveDeQueueDelay(d time.Duration) WaveProcessorOption
- func WithWaveDryRun(dryRun bool) WaveProcessorOption
- func WithWaveMaxConcurrentApplies(n int) WaveProcessorOption
- func WithWaveOnApply(onApply func(resource unstructured.Unstructured)) WaveProcessorOption
- func WithWaveSvcCache(c *cache.Cache[console.ServiceDeploymentForAgent]) WaveProcessorOption
- type WaveStatistics
- type WaveType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateWithBackoff ¶
func CreateWithBackoff(ctx context.Context, c dynamic.ResourceInterface, obj unstructured.Unstructured) *unstructured.Unstructured
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
func NewApplier ¶
func (*Applier) Apply ¶
func (in *Applier) Apply(ctx context.Context, service client.ServiceDeploymentForAgent, resources []unstructured.Unstructured, opts ...WaveProcessorOption, ) ([]client.ComponentAttributes, []client.ServiceErrorAttributes, error)
type Filter ¶
type Filter string
const (
FilterCache Filter = "cache-filter"
)
const (
FilterSkip Filter = "skip-filter"
)
type FilterEngine ¶
type FilterEngine struct {
// contains filtered or unexported fields
}
FilterEngine holds a list of filters
func NewFilterEngine ¶
func NewFilterEngine() *FilterEngine
func (*FilterEngine) Add ¶
func (fe *FilterEngine) Add(name Filter, f FilterFunc)
Add adds a new filter
func (*FilterEngine) Match ¶
func (fe *FilterEngine) Match(obj unstructured.Unstructured) bool
Match runs all filters and returns true only if all pass
func (*FilterEngine) MatchOmit ¶
func (fe *FilterEngine) MatchOmit(obj unstructured.Unstructured, omit ...Filter) bool
MatchOmit runs all filters except the ones in skip and returns true only if all pass
type FilterFunc ¶
type FilterFunc func(obj unstructured.Unstructured) bool
func CacheFilter ¶
func CacheFilter() FilterFunc
CacheFilter filters based on whether resources and/or manifests have changed since last applied.
type Option ¶
type Option func(*Applier)
func WithFilter ¶
func WithFilter(name Filter, f FilterFunc) Option
func WithOnApply ¶
func WithOnApply(f func(unstructured.Unstructured)) Option
func WithWaveDelay ¶
type Phase ¶
type Phase struct {
// contains filtered or unexported fields
}
func NewPhase ¶
func NewPhase(name smcommon.SyncPhase, resources []unstructured.Unstructured, skipFilter FilterFunc, deleteFilter func(resources []unstructured.Unstructured) (toApply, toDelete []unstructured.Unstructured)) Phase
func (*Phase) AppliedCount ¶
func (*Phase) DeletedCount ¶
func (*Phase) HasResources ¶
func (*Phase) ResourceCount ¶
func (*Phase) ResourceHealth ¶
func (*Phase) Skipped ¶
func (p *Phase) Skipped() []unstructured.Unstructured
func (*Phase) SkippedCount ¶
type Phases ¶
func NewPhases ¶
func NewPhases(resources []unstructured.Unstructured, skipFilter FilterFunc, deleteFilter func(resources []unstructured.Unstructured) (toApply, toDelete []unstructured.Unstructured)) Phases
func (Phases) HasResourcesInFollowingPhases ¶
type Wave ¶
type Wave struct {
// contains filtered or unexported fields
}
Wave is a collection of resources that will be applied or deleted together. It is used to group resources that are related to each other.
func NewWave ¶
func NewWave(resources []unstructured.Unstructured, waveType WaveType) Wave
func (*Wave) Add ¶
func (in *Wave) Add(resource unstructured.Unstructured)
type WaveProcessor ¶
type WaveProcessor struct {
// contains filtered or unexported fields
}
WaveProcessor processes a wave of resources. It applies or deletes the resources in the wave. It uses a work queue to process the items in the wave concurrently. It uses a channel to communicate between the workers and the collector goroutine. The collector goroutine collects the components and errors from the channels and returns them to the caller.
func NewWaveProcessor ¶
func NewWaveProcessor(dynamicClient dynamic.Interface, cache discoverycache.Cache, phase smcommon.SyncPhase, wave Wave, opts ...WaveProcessorOption) *WaveProcessor
func (*WaveProcessor) Run ¶
func (in *WaveProcessor) Run(ctx context.Context) (components []console.ComponentAttributes, errors []console.ServiceErrorAttributes)
func (*WaveProcessor) Statistics ¶
func (in *WaveProcessor) Statistics() WaveStatistics
type WaveProcessorOption ¶
type WaveProcessorOption func(*WaveProcessor)
func WithWaveDeQueueDelay ¶
func WithWaveDeQueueDelay(d time.Duration) WaveProcessorOption
func WithWaveDryRun ¶
func WithWaveDryRun(dryRun bool) WaveProcessorOption
func WithWaveMaxConcurrentApplies ¶
func WithWaveMaxConcurrentApplies(n int) WaveProcessorOption
func WithWaveOnApply ¶
func WithWaveOnApply(onApply func(resource unstructured.Unstructured)) WaveProcessorOption
func WithWaveSvcCache ¶
func WithWaveSvcCache(c *cache.Cache[console.ServiceDeploymentForAgent]) WaveProcessorOption
type WaveStatistics ¶
type WaveStatistics struct {
// contains filtered or unexported fields
}
func NewWaveStatistics ¶
func NewWaveStatistics(w Wave) WaveStatistics
func (*WaveStatistics) Add ¶
func (in *WaveStatistics) Add(ws WaveStatistics)
func (*WaveStatistics) Applied ¶
func (in *WaveStatistics) Applied() string
func (*WaveStatistics) Deleted ¶
func (in *WaveStatistics) Deleted() string