applier

package
v0.6.49 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Applier

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

func NewApplier

func NewApplier(client dynamic.Interface, discoveryCache discoverycache.Cache, store store.Store, opts ...Option) *Applier

func (*Applier) Destroy

func (in *Applier) Destroy(ctx context.Context, serviceID string) ([]client.ComponentAttributes, 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.

func SkipFilter

func SkipFilter() FilterFunc

SkipFilter filters based on whether resources

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

func WithWaveDelay(d time.Duration) Option

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

func (p *Phase) AddWave(wave Wave)

func (*Phase) AppliedCount

func (p *Phase) AppliedCount() int

func (*Phase) DeletedCount

func (p *Phase) DeletedCount() int

func (*Phase) HasResources

func (p *Phase) HasResources() bool

func (*Phase) HasWaves

func (p *Phase) HasWaves() bool

func (*Phase) Name

func (p *Phase) Name() smcommon.SyncPhase

func (*Phase) ResourceCount

func (p *Phase) ResourceCount() int

func (*Phase) ResourceHealth

func (p *Phase) ResourceHealth() (pending, failed bool, err error)

func (*Phase) Skipped

func (p *Phase) Skipped() []unstructured.Unstructured

func (*Phase) SkippedCount

func (p *Phase) SkippedCount() int

func (*Phase) Waves

func (p *Phase) Waves() []Wave

type Phases

type Phases map[smcommon.SyncPhase]Phase

func NewPhases

func NewPhases(resources []unstructured.Unstructured, skipFilter FilterFunc, deleteFilter func(resources []unstructured.Unstructured) (toApply, toDelete []unstructured.Unstructured)) Phases

func (Phases) HasResourcesInFollowingPhases

func (in Phases) HasResourcesInFollowingPhases(phase *smcommon.SyncPhase) bool

func (Phases) Next

func (in Phases) Next(phase *smcommon.SyncPhase, failed bool) (*Phase, bool)

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)

func (*Wave) Len

func (in *Wave) Len() int

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 (*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

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

type WaveType

type WaveType string
const (
	ApplyWave  WaveType = "apply"
	DeleteWave WaveType = "delete"
)

Jump to

Keyboard shortcuts

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