Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/apply/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ func (a *Applier) Run(ctx context.Context, invInfo inventory.Info, objects objec
runner := taskrunner.NewTaskStatusRunner(allIds, statusWatcher)
klog.V(4).Infoln("applier running TaskStatusRunner...")
err = runner.Run(ctx, taskContext, taskQueue.ToChannel(), taskrunner.Options{
EmitStatusEvents: options.EmitStatusEvents,
EmitStatusEvents: options.EmitStatusEvents,
WatcherRESTScopeStrategy: options.WatcherRESTScopeStrategy,
})
if err != nil {
handleError(eventChannel, err)
Expand Down Expand Up @@ -288,6 +289,10 @@ type ApplierOptions struct {

// ValidationPolicy defines how to handle invalid objects.
ValidationPolicy validation.Policy

// RESTScopeStrategy specifies which strategy to use when listing and
// watching resources. By default, the strategy is selected automatically.
WatcherRESTScopeStrategy watcher.RESTScopeStrategy
}

// setDefaults set the options to the default values if they
Expand Down
7 changes: 6 additions & 1 deletion pkg/apply/taskrunner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type TaskStatusRunner struct {
// the statusPoller.
type Options struct {
EmitStatusEvents bool
// RESTScopeStrategy specifies which strategy to use when listing and
// watching resources. By default, the strategy is selected automatically.
WatcherRESTScopeStrategy watcher.RESTScopeStrategy
}

// Run executes the tasks in the taskqueue, with the statusPoller running in the
Expand All @@ -57,7 +60,9 @@ func (tsr *TaskStatusRunner) Run(
// If taskStatusRunner.Run is cancelled, baseRunner.run will exit early,
// causing the poller to be cancelled.
statusCtx, cancelFunc := context.WithCancel(context.Background())
statusChannel := tsr.StatusWatcher.Watch(statusCtx, tsr.Identifiers, watcher.Options{})
statusChannel := tsr.StatusWatcher.Watch(statusCtx, tsr.Identifiers, watcher.Options{
RESTScopeStrategy: opts.WatcherRESTScopeStrategy,
})

// complete stops the statusPoller, drains the statusChannel, and returns
// the provided error.
Expand Down