@@ -73,24 +73,21 @@ func (dryRunAll) ApplyToUpdate(opts *UpdateOptions) {
73
73
func (dryRunAll ) ApplyToPatch (opts * PatchOptions ) {
74
74
opts .DryRun = []string {metav1 .DryRunAll }
75
75
}
76
+ func (dryRunAll ) ApplyToDelete (opts * DeleteOptions ) {
77
+ opts .DryRun = []string {metav1 .DryRunAll }
78
+ }
76
79
77
80
// FieldOwner set the field manager name for the given server-side apply patch.
78
81
type FieldOwner string
79
82
80
83
func (f FieldOwner ) ApplyToPatch (opts * PatchOptions ) {
81
84
opts .FieldManager = string (f )
82
85
}
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 )
94
91
}
95
92
96
93
// }}}
@@ -107,6 +104,10 @@ type CreateOptions struct {
107
104
// - All: all dry run stages will be processed
108
105
DryRun []string
109
106
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
+
110
111
// Raw represents raw CreateOptions, as passed to the API server.
111
112
Raw * metav1.CreateOptions
112
113
}
@@ -122,6 +123,7 @@ func (o *CreateOptions) AsCreateOptions() *metav1.CreateOptions {
122
123
}
123
124
124
125
o .Raw .DryRun = o .DryRun
126
+ o .Raw .FieldManager = o .FieldManager
125
127
return o .Raw
126
128
}
127
129
@@ -168,6 +170,13 @@ type DeleteOptions struct {
168
170
169
171
// Raw represents raw DeleteOptions, as passed to the API server.
170
172
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
171
180
}
172
181
173
182
// AsDeleteOptions returns these options as a metav1.DeleteOptions.
@@ -183,6 +192,7 @@ func (o *DeleteOptions) AsDeleteOptions() *metav1.DeleteOptions {
183
192
o .Raw .GracePeriodSeconds = o .GracePeriodSeconds
184
193
o .Raw .Preconditions = o .Preconditions
185
194
o .Raw .PropagationPolicy = o .PropagationPolicy
195
+ o .Raw .DryRun = o .DryRun
186
196
return o .Raw
187
197
}
188
198
@@ -320,6 +330,10 @@ type UpdateOptions struct {
320
330
// - All: all dry run stages will be processed
321
331
DryRun []string
322
332
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
+
323
337
// Raw represents raw UpdateOptions, as passed to the API server.
324
338
Raw * metav1.UpdateOptions
325
339
}
@@ -335,6 +349,7 @@ func (o *UpdateOptions) AsUpdateOptions() *metav1.UpdateOptions {
335
349
}
336
350
337
351
o .Raw .DryRun = o .DryRun
352
+ o .Raw .FieldManager = o .FieldManager
338
353
return o .Raw
339
354
}
340
355
@@ -404,6 +419,18 @@ func (o *PatchOptions) AsPatchOptions() *metav1.PatchOptions {
404
419
return o .Raw
405
420
}
406
421
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
+
407
434
// PatchDryRunAll sets the "dry run" option to "all".
408
435
//
409
436
// Deprecated: Use DryRunAll
0 commit comments