@@ -38,7 +38,7 @@ import (
38
38
39
39
// ResourceOperations provides methods to manage k8s resources
40
40
type ResourceOperations interface {
41
- ApplyResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force , validate bool ) (string , error )
41
+ ApplyResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force , validate , serverSideApply bool ) (string , error )
42
42
ReplaceResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force bool ) (string , error )
43
43
CreateResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , validate bool ) (string , error )
44
44
UpdateResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy ) (* unstructured.Unstructured , error )
@@ -224,7 +224,7 @@ func (k *kubectlResourceOperations) UpdateResource(ctx context.Context, obj *uns
224
224
}
225
225
226
226
// ApplyResource performs an apply of a unstructured resource
227
- func (k * kubectlResourceOperations ) ApplyResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force , validate bool ) (string , error ) {
227
+ func (k * kubectlResourceOperations ) ApplyResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force , validate , serverSideApply bool ) (string , error ) {
228
228
span := k .tracer .StartSpan ("ApplyResource" )
229
229
span .SetBaggageItem ("kind" , obj .GetKind ())
230
230
span .SetBaggageItem ("name" , obj .GetName ())
@@ -237,15 +237,15 @@ func (k *kubectlResourceOperations) ApplyResource(ctx context.Context, obj *unst
237
237
}
238
238
defer cleanup ()
239
239
240
- applyOpts , err := k .newApplyOptions (ioStreams , obj , fileName , validate , force , dryRunStrategy )
240
+ applyOpts , err := k .newApplyOptions (ioStreams , obj , fileName , validate , force , serverSideApply , dryRunStrategy )
241
241
if err != nil {
242
242
return err
243
243
}
244
244
return applyOpts .Run ()
245
245
})
246
246
}
247
247
248
- func (k * kubectlResourceOperations ) newApplyOptions (ioStreams genericclioptions.IOStreams , obj * unstructured.Unstructured , fileName string , validate bool , force bool , dryRunStrategy cmdutil.DryRunStrategy ) (* apply.ApplyOptions , error ) {
248
+ func (k * kubectlResourceOperations ) newApplyOptions (ioStreams genericclioptions.IOStreams , obj * unstructured.Unstructured , fileName string , validate bool , force , serverSideApply bool , dryRunStrategy cmdutil.DryRunStrategy ) (* apply.ApplyOptions , error ) {
249
249
flags := apply .NewApplyFlags (k .fact , ioStreams )
250
250
o := & apply.ApplyOptions {
251
251
IOStreams : ioStreams ,
@@ -255,6 +255,7 @@ func (k *kubectlResourceOperations) newApplyOptions(ioStreams genericclioptions.
255
255
PrintFlags : flags .PrintFlags ,
256
256
Overwrite : true ,
257
257
OpenAPIPatch : true ,
258
+ ServerSideApply : serverSideApply ,
258
259
}
259
260
dynamicClient , err := dynamic .NewForConfig (k .config )
260
261
if err != nil {
0 commit comments