@@ -73,24 +73,21 @@ func (dryRunAll) ApplyToUpdate(opts *UpdateOptions) {
7373func (dryRunAll ) ApplyToPatch (opts * PatchOptions ) {
7474 opts .DryRun = []string {metav1 .DryRunAll }
7575}
76+ func (dryRunAll ) ApplyToDelete (opts * DeleteOptions ) {
77+ opts .DryRun = []string {metav1 .DryRunAll }
78+ }
7679
7780// FieldOwner set the field manager name for the given server-side apply patch.
7881type FieldOwner string
7982
8083func (f FieldOwner ) ApplyToPatch (opts * PatchOptions ) {
8184 opts .FieldManager = string (f )
8285}
83-
84- // ForceOwnership indicates that in case of conflicts with server-side apply,
85- // the client should acquire ownership of the conflicting field. Most
86- // controllers should use this.
87- var ForceOwnership = forceOwnership {}
88-
89- type forceOwnership struct {}
90-
91- func (forceOwnership ) ApplyToPatch (opts * PatchOptions ) {
92- definitelyTrue := true
93- opts .Force = & definitelyTrue
86+ func (f FieldOwner ) ApplyToCreate (opts * CreateOptions ) {
87+ opts .FieldManager = string (f )
88+ }
89+ func (f FieldOwner ) ApplyToUpdate (opts * UpdateOptions ) {
90+ opts .FieldManager = string (f )
9491}
9592
9693// }}}
@@ -107,6 +104,10 @@ type CreateOptions struct {
107104 // - All: all dry run stages will be processed
108105 DryRun []string
109106
107+ // FieldManager is the name of the user or component submitting
108+ // this request. It must be set with server-side apply.
109+ FieldManager string
110+
110111 // Raw represents raw CreateOptions, as passed to the API server.
111112 Raw * metav1.CreateOptions
112113}
@@ -122,6 +123,7 @@ func (o *CreateOptions) AsCreateOptions() *metav1.CreateOptions {
122123 }
123124
124125 o .Raw .DryRun = o .DryRun
126+ o .Raw .FieldManager = o .FieldManager
125127 return o .Raw
126128}
127129
@@ -168,6 +170,13 @@ type DeleteOptions struct {
168170
169171 // Raw represents raw DeleteOptions, as passed to the API server.
170172 Raw * metav1.DeleteOptions
173+
174+ // When present, indicates that modifications should not be
175+ // persisted. An invalid or unrecognized dryRun directive will
176+ // result in an error response and no further processing of the
177+ // request. Valid values are:
178+ // - All: all dry run stages will be processed
179+ DryRun []string
171180}
172181
173182// AsDeleteOptions returns these options as a metav1.DeleteOptions.
@@ -183,6 +192,7 @@ func (o *DeleteOptions) AsDeleteOptions() *metav1.DeleteOptions {
183192 o .Raw .GracePeriodSeconds = o .GracePeriodSeconds
184193 o .Raw .Preconditions = o .Preconditions
185194 o .Raw .PropagationPolicy = o .PropagationPolicy
195+ o .Raw .DryRun = o .DryRun
186196 return o .Raw
187197}
188198
@@ -320,6 +330,10 @@ type UpdateOptions struct {
320330 // - All: all dry run stages will be processed
321331 DryRun []string
322332
333+ // FieldManager is the name of the user or component submitting
334+ // this request. It must be set with server-side apply.
335+ FieldManager string
336+
323337 // Raw represents raw UpdateOptions, as passed to the API server.
324338 Raw * metav1.UpdateOptions
325339}
@@ -335,6 +349,7 @@ func (o *UpdateOptions) AsUpdateOptions() *metav1.UpdateOptions {
335349 }
336350
337351 o .Raw .DryRun = o .DryRun
352+ o .Raw .FieldManager = o .FieldManager
338353 return o .Raw
339354}
340355
@@ -404,6 +419,18 @@ func (o *PatchOptions) AsPatchOptions() *metav1.PatchOptions {
404419 return o .Raw
405420}
406421
422+ // ForceOwnership indicates that in case of conflicts with server-side apply,
423+ // the client should acquire ownership of the conflicting field. Most
424+ // controllers should use this.
425+ var ForceOwnership = forceOwnership {}
426+
427+ type forceOwnership struct {}
428+
429+ func (forceOwnership ) ApplyToPatch (opts * PatchOptions ) {
430+ definitelyTrue := true
431+ opts .Force = & definitelyTrue
432+ }
433+
407434// PatchDryRunAll sets the "dry run" option to "all".
408435//
409436// Deprecated: Use DryRunAll
0 commit comments