File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ const (
241241)
242242
243243// PatchType represents the "--type=json|merge|strategic" option on the patch command.
244+ // NOTE: As a special case, an "apply" patch will produce a "--server-side" option instead.
244245type PatchType string
245246
246247func (o PatchType ) patchCmd (cmd * exec.Cmd ) { o .kubectlCmd (cmd ) }
@@ -254,6 +255,8 @@ func (o PatchType) kubectlCmd(cmd *exec.Cmd) {
254255 cmd .Args = append (cmd .Args , "--type=merge" )
255256 case "application/strategic-merge-patch+json" :
256257 cmd .Args = append (cmd .Args , "--type=strategic" )
258+ case "application/apply-patch+yaml" :
259+ cmd .Args = append (cmd .Args , "--server-side" )
257260 default :
258261 cmd .Args = append (cmd .Args , "--type=" + string (o ))
259262 }
@@ -266,6 +269,16 @@ const (
266269 PatchTypeStrategic PatchType = "strategic"
267270)
268271
272+ // ServerSide represents the "--server-side" option on the patch command.
273+ type ServerSide bool
274+
275+ func (o ServerSide ) patchCmd (cmd * exec.Cmd ) { o .kubectlCmd (cmd ) }
276+ func (o ServerSide ) kubectlCmd (cmd * exec.Cmd ) {
277+ if o {
278+ cmd .Args = append (cmd .Args , "--server-side" )
279+ }
280+ }
281+
269282// Patch represents the "--patch" option on the patch command.
270283type Patch string
271284
You can’t perform that action at this time.
0 commit comments