@@ -38,7 +38,7 @@ import (
3838
3939// ResourceOperations provides methods to manage k8s resources
4040type 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 )
4242 ReplaceResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , force bool ) (string , error )
4343 CreateResource (ctx context.Context , obj * unstructured.Unstructured , dryRunStrategy cmdutil.DryRunStrategy , validate bool ) (string , error )
4444 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
224224}
225225
226226// 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 ) {
228228 span := k .tracer .StartSpan ("ApplyResource" )
229229 span .SetBaggageItem ("kind" , obj .GetKind ())
230230 span .SetBaggageItem ("name" , obj .GetName ())
@@ -237,15 +237,15 @@ func (k *kubectlResourceOperations) ApplyResource(ctx context.Context, obj *unst
237237 }
238238 defer cleanup ()
239239
240- applyOpts , err := k .newApplyOptions (ioStreams , obj , fileName , validate , force , dryRunStrategy )
240+ applyOpts , err := k .newApplyOptions (ioStreams , obj , fileName , validate , force , serverSideApply , dryRunStrategy )
241241 if err != nil {
242242 return err
243243 }
244244 return applyOpts .Run ()
245245 })
246246}
247247
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 ) {
249249 flags := apply .NewApplyFlags (k .fact , ioStreams )
250250 o := & apply.ApplyOptions {
251251 IOStreams : ioStreams ,
@@ -255,6 +255,7 @@ func (k *kubectlResourceOperations) newApplyOptions(ioStreams genericclioptions.
255255 PrintFlags : flags .PrintFlags ,
256256 Overwrite : true ,
257257 OpenAPIPatch : true ,
258+ ServerSideApply : serverSideApply ,
258259 }
259260 dynamicClient , err := dynamic .NewForConfig (k .config )
260261 if err != nil {
0 commit comments