Skip to content

Commit

Permalink
Propagate applyOpts extraArgs
Browse files Browse the repository at this point in the history
A not so pretty solution for
kubernetes-sigs#201,
more like a temporary workaround.
I think it would be nicer to use `ApplyOptions` directly
instead of the internal `ApplierOptions` type, but this
would break compatibility with ExecApplier.
  • Loading branch information
wscheep committed Jan 20, 2022
1 parent fea7e5c commit 9604f7c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/patterns/declarative/pkg/applier/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
}

applyOpts := apply.NewApplyOptions(ioStreams)

for i, arg := range opt.ExtraArgs {
switch arg {
case "--force":
applyOpts.ForceConflicts = true
case "--prune":
applyOpts.Prune = true
case "--selector":
applyOpts.Selector = opt.ExtraArgs[i + 1]
default:
continue
}
}

applyOpts.Namespace = opt.Namespace
applyOpts.SetObjects(infos)
applyOpts.ToPrinter = func(operation string) (printers.ResourcePrinter, error) {
Expand Down

0 comments on commit 9604f7c

Please sign in to comment.