@@ -237,10 +237,14 @@ func (r *Service) CreateItem(gvk schema.GroupVersionKind, scope v1.ResourceScope
237
237
return nil , errors .New ("object metadata.name is required" )
238
238
}
239
239
240
- dryRun , err := getDryRunArg (p .Args , DryRunArg , false )
240
+ dryRunBool , err := getBoolArg (p .Args , DryRunArg , false )
241
241
if err != nil {
242
242
return nil , err
243
243
}
244
+ dryRun := []string {}
245
+ if dryRunBool {
246
+ dryRun = []string {"All" }
247
+ }
244
248
245
249
if err := r .runtimeClient .Create (ctx , obj , & client.CreateOptions {DryRun : dryRun }); err != nil {
246
250
log .Error ().Err (err ).Msg ("Failed to create object" )
@@ -292,10 +296,14 @@ func (r *Service) UpdateItem(gvk schema.GroupVersionKind, scope v1.ResourceScope
292
296
return nil , err
293
297
}
294
298
295
- dryRun , err := getDryRunArg (p .Args , DryRunArg , false )
299
+ dryRunBool , err := getBoolArg (p .Args , DryRunArg , false )
296
300
if err != nil {
297
301
return nil , err
298
302
}
303
+ dryRun := []string {}
304
+ if dryRunBool {
305
+ dryRun = []string {"All" }
306
+ }
299
307
300
308
// Apply the merge patch to the existing object
301
309
patch := client .RawPatch (types .MergePatchType , patchData )
@@ -335,10 +343,14 @@ func (r *Service) DeleteItem(gvk schema.GroupVersionKind, scope v1.ResourceScope
335
343
obj .SetNamespace (namespace )
336
344
}
337
345
338
- dryRun , err := getDryRunArg (p .Args , DryRunArg , false )
346
+ dryRunBool , err := getBoolArg (p .Args , DryRunArg , false )
339
347
if err != nil {
340
348
return nil , err
341
349
}
350
+ dryRun := []string {}
351
+ if dryRunBool {
352
+ dryRun = []string {"All" }
353
+ }
342
354
343
355
if err := r .runtimeClient .Delete (ctx , obj , & client.DeleteOptions {DryRun : dryRun }); err != nil {
344
356
log .Error ().Err (err ).Msg ("Failed to delete object" )
0 commit comments