Skip to content

Commit fd37445

Browse files
committed
fixup! Add server-side apply patch support
1 parent 42a8650 commit fd37445

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/client/options.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ type PatchOptions struct {
355355
// It's probably what controllers want to do.
356356
Force *bool
357357

358+
// FieldManager is the name of the user or component submitting
359+
// this request. It must be set with server-side apply.
360+
FieldManager string
361+
358362
// Raw represets raw patch options, passed directly to the server.
359363
Raw *metav1.PatchOptions
360364
}
@@ -378,6 +382,7 @@ func (o *PatchOptions) AsPatchOptions() *metav1.PatchOptions {
378382

379383
o.Raw.DryRun = o.DryRun
380384
o.Raw.Force = o.Force
385+
o.Raw.FieldManager = o.FieldManager
381386
return o.Raw
382387
}
383388

@@ -400,3 +405,10 @@ var ForceOwnership PatchOptionFunc = func(opts *PatchOptions) {
400405
var PatchDryRunAll PatchOptionFunc = func(opts *PatchOptions) {
401406
opts.DryRun = []string{metav1.DryRunAll}
402407
}
408+
409+
// FieldManager set the field manager name for the given server-side apply patch.
410+
func FieldManager(name string) PatchOptionFunc {
411+
return func(opts *PatchOptions) {
412+
opts.FieldManager = name
413+
}
414+
}

0 commit comments

Comments
 (0)