Skip to content

Commit 88b702d

Browse files
committed
Reuse dynamic.Client in direct applier also.
1 parent 7d9d368 commit 88b702d

File tree

1 file changed

+7
-4
lines changed
  • pkg/patterns/declarative/pkg/applier

1 file changed

+7
-4
lines changed

pkg/patterns/declarative/pkg/applier/direct.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
8888
b := d.inner.NewBuilder(opt)
8989
f := d.inner.NewFactory(opt)
9090

91-
// TODO can we just reuse this
92-
dynamicClient, err := f.DynamicClient()
93-
if err != nil {
94-
return err
91+
dynamicClient := opt.DynamicClient
92+
if dynamicClient == nil {
93+
dc, err := f.DynamicClient()
94+
if err != nil {
95+
return err
96+
}
97+
dynamicClient = dc
9598
}
9699

97100
if opt.Validate {

0 commit comments

Comments
 (0)