Skip to content

Commit 054250f

Browse files
run goimports
1 parent fbf31ed commit 054250f

File tree

5 files changed

+37
-41
lines changed

5 files changed

+37
-41
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"strings"
8+
89
"k8s.io/kubectl/pkg/util/prune"
910

1011
"k8s.io/apimachinery/pkg/api/meta"
@@ -21,7 +22,6 @@ import (
2122
cmdutil "k8s.io/kubectl/pkg/cmd/util"
2223
)
2324

24-
2525
type DirectApplier struct {
2626
inner directApplierSite
2727
}
@@ -132,13 +132,12 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
132132
IOStreams: ioStreams,
133133
FieldManager: "kubectl-client-side-apply",
134134
ValidationDirective: metav1.FieldValidationStrict,
135-
Mapper: opt.RESTMapper,
136-
DynamicClient: dynamicClient,
135+
Mapper: opt.RESTMapper,
136+
DynamicClient: dynamicClient,
137137
}
138138
// TODO this will add the print part at all times.
139139
applyOpts.PostProcessorFn = applyOpts.PrintAndPrunePostProcessor()
140140

141-
142141
whiteListResources := []string{}
143142
for i, arg := range opt.ExtraArgs {
144143
switch arg {
@@ -165,10 +164,9 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
165164
if err != nil {
166165
return err
167166
}
168-
applyOpts.PruneResources = append(applyOpts.PruneResources, r...)
167+
applyOpts.PruneResources = append(applyOpts.PruneResources, r...)
169168
}
170169

171-
172170
applyOpts.ForceConflicts = opt.Force
173171
applyOpts.Namespace = opt.Namespace
174172
applyOpts.SetObjects(infos)
@@ -178,7 +176,7 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
178176
return applyOpts.PrintFlags.ToPrinter()
179177
}
180178
applyOpts.DeleteOptions = &cmdDelete.DeleteOptions{
181-
IOStreams: ioStreams,
179+
IOStreams: ioStreams,
182180
CascadingStrategy: opt.CascadingStrategy,
183181
}
184182

pkg/patterns/declarative/pkg/applier/direct_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,33 +152,33 @@ metadata:
152152
return nil
153153
},
154154
},
155-
{
156-
name: "manifest with prune, prune-whitelist and selector",
157-
namespace: "",
158-
manifest: `---
155+
{
156+
name: "manifest with prune, prune-whitelist and selector",
157+
namespace: "",
158+
manifest: `---
159159
apiVersion: v1
160160
kind: ServiceAccount
161161
metadata:
162162
name: foo-operator
163163
namespace: kube-system`,
164-
args: []string{"--prune", "--selector", "label=true", "--prune-whitelist", "core/v1/Namespace", "--prune-whitelist", "core/v1/Service"},
165-
// TODO is this used somewhere?
166-
expectApplyOptions: &apply.ApplyOptions{
167-
Prune: true,
168-
},
169-
expectCheckFunc: func(opt *apply.ApplyOptions) error {
170-
if opt.Prune != true {
171-
return fmt.Errorf("prune is not set")
172-
}
173-
if len(opt.PruneResources) != 2 {
174-
return fmt.Errorf("prune resources are not set correctly, found %s", opt.PruneResources)
175-
}
176-
if opt.Selector != "label=true" {
177-
return fmt.Errorf("selector is not set as expected, found %s", opt.Selector)
178-
}
179-
return nil
180-
},
181-
},
164+
args: []string{"--prune", "--selector", "label=true", "--prune-whitelist", "core/v1/Namespace", "--prune-whitelist", "core/v1/Service"},
165+
// TODO is this used somewhere?
166+
expectApplyOptions: &apply.ApplyOptions{
167+
Prune: true,
168+
},
169+
expectCheckFunc: func(opt *apply.ApplyOptions) error {
170+
if opt.Prune != true {
171+
return fmt.Errorf("prune is not set")
172+
}
173+
if len(opt.PruneResources) != 2 {
174+
return fmt.Errorf("prune resources are not set correctly, found %s", opt.PruneResources)
175+
}
176+
if opt.Selector != "label=true" {
177+
return fmt.Errorf("selector is not set as expected, found %s", opt.Selector)
178+
}
179+
return nil
180+
},
181+
},
182182
}
183183

184184
for _, test := range tests {

pkg/patterns/declarative/pkg/applier/exec.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ func (c *ExecKubectl) Apply(ctx context.Context, opt ApplierOptions) error {
136136
args = append(args, "--force")
137137
}
138138

139-
140-
141139
args = append(args, opt.ExtraArgs...)
142140
args = append(args, "-f", "-")
143141

pkg/patterns/declarative/pkg/applier/type.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ type ApplierOptions struct {
2323
CascadingStrategy metav1.DeletionPropagation
2424

2525
PruneWhitelist []string
26-
Prune bool
27-
26+
Prune bool
27+
2828
// Force is set if we should "force" the apply.
2929
// For server-side-apply, this corresponds to setting the force option, which ensures we take ownership
3030
// even when another field manager owns a field.

pkg/patterns/declarative/reconciler.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ func (r *Reconciler) reconcileExists(ctx context.Context, name types.NamespacedN
303303
}
304304

305305
applierOpt := applier.ApplierOptions{
306-
RESTConfig: r.config,
307-
RESTMapper: r.restMapper,
308-
Namespace: ns,
309-
Manifest: manifestStr,
310-
Validate: r.options.validate,
311-
ExtraArgs: extraArgs,
312-
Force: true,
306+
RESTConfig: r.config,
307+
RESTMapper: r.restMapper,
308+
Namespace: ns,
309+
Manifest: manifestStr,
310+
Validate: r.options.validate,
311+
ExtraArgs: extraArgs,
312+
Force: true,
313313
// TODO Make this configurable
314-
CascadingStrategy: "Foreground",
314+
CascadingStrategy: "Foreground",
315315
}
316316

317317
applier := r.options.applier

0 commit comments

Comments
 (0)