@@ -71,28 +71,40 @@ var DryRunAll = dryRunAll{}
71
71
72
72
type dryRunAll struct {}
73
73
74
+ // ApplyToCreate applies this configuration to the given create options.
74
75
func (dryRunAll ) ApplyToCreate (opts * CreateOptions ) {
75
76
opts .DryRun = []string {metav1 .DryRunAll }
76
77
}
78
+
79
+ // ApplyToUpdate applies this configuration to the given update options.
77
80
func (dryRunAll ) ApplyToUpdate (opts * UpdateOptions ) {
78
81
opts .DryRun = []string {metav1 .DryRunAll }
79
82
}
83
+
84
+ // ApplyToPatch applies this configuration to the given patch options.
80
85
func (dryRunAll ) ApplyToPatch (opts * PatchOptions ) {
81
86
opts .DryRun = []string {metav1 .DryRunAll }
82
87
}
88
+
89
+ // ApplyToPatch applies this configuration to the given delete options.
83
90
func (dryRunAll ) ApplyToDelete (opts * DeleteOptions ) {
84
91
opts .DryRun = []string {metav1 .DryRunAll }
85
92
}
86
93
87
94
// FieldOwner set the field manager name for the given server-side apply patch.
88
95
type FieldOwner string
89
96
97
+ // ApplyToPatch applies this configuration to the given patch options.
90
98
func (f FieldOwner ) ApplyToPatch (opts * PatchOptions ) {
91
99
opts .FieldManager = string (f )
92
100
}
101
+
102
+ // ApplyToCreate applies this configuration to the given create options.
93
103
func (f FieldOwner ) ApplyToCreate (opts * CreateOptions ) {
94
104
opts .FieldManager = string (f )
95
105
}
106
+
107
+ // ApplyToUpdate applies this configuration to the given update options.
96
108
func (f FieldOwner ) ApplyToUpdate (opts * UpdateOptions ) {
97
109
opts .FieldManager = string (f )
98
110
}
@@ -252,33 +264,49 @@ func (o *DeleteOptions) ApplyToDelete(do *DeleteOptions) {
252
264
// to the given number of seconds.
253
265
type GracePeriodSeconds int64
254
266
267
+ // ApplyToDelete applies this configuration to the given delete options.
255
268
func (s GracePeriodSeconds ) ApplyToDelete (opts * DeleteOptions ) {
256
269
secs := int64 (s )
257
270
opts .GracePeriodSeconds = & secs
258
271
}
259
272
273
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
260
274
func (s GracePeriodSeconds ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
261
275
s .ApplyToDelete (& opts .DeleteOptions )
262
276
}
263
277
278
+ // Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
264
279
type Preconditions metav1.Preconditions
265
280
281
+ // ApplyToDelete applies this configuration to the given delete options.
266
282
func (p Preconditions ) ApplyToDelete (opts * DeleteOptions ) {
267
283
preconds := metav1 .Preconditions (p )
268
284
opts .Preconditions = & preconds
269
285
}
270
286
287
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
271
288
func (p Preconditions ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
272
289
p .ApplyToDelete (& opts .DeleteOptions )
273
290
}
274
291
292
+ // PropagationPolicy determined whether and how garbage collection will be
293
+ // performed. Either this field or OrphanDependents may be set, but not both.
294
+ // The default policy is decided by the existing finalizer set in the
295
+ // metadata.finalizers and the resource-specific default policy.
296
+ // Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
297
+ // allow the garbage collector to delete the dependents in the background;
298
+ // 'Foreground' - a cascading policy that deletes all dependents in the
299
+ // foreground.
275
300
type PropagationPolicy metav1.DeletionPropagation
276
301
302
+ // ApplyToDelete applies the given delete options on these options.
303
+ // It will propagate to the dependents of the object to let the garbage collector handle it.
277
304
func (p PropagationPolicy ) ApplyToDelete (opts * DeleteOptions ) {
278
305
policy := metav1 .DeletionPropagation (p )
279
306
opts .PropagationPolicy = & policy
280
307
}
281
308
309
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
282
310
func (p PropagationPolicy ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
283
311
p .ApplyToDelete (& opts .DeleteOptions )
284
312
}
@@ -379,12 +407,14 @@ func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions {
379
407
// MatchingLabels filters the list/delete operation on the given set of labels.
380
408
type MatchingLabels map [string ]string
381
409
410
+ // ApplyToList applies this configuration to the given list options.
382
411
func (m MatchingLabels ) ApplyToList (opts * ListOptions ) {
383
412
// TODO(directxman12): can we avoid reserializing this over and over?
384
413
sel := labels .SelectorFromValidatedSet (map [string ]string (m ))
385
414
opts .LabelSelector = sel
386
415
}
387
416
417
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
388
418
func (m MatchingLabels ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
389
419
m .ApplyToList (& opts .ListOptions )
390
420
}
@@ -393,6 +423,7 @@ func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
393
423
// without checking their values.
394
424
type HasLabels []string
395
425
426
+ // ApplyToList applies this configuration to the given list options.
396
427
func (m HasLabels ) ApplyToList (opts * ListOptions ) {
397
428
sel := labels .NewSelector ()
398
429
for _ , label := range m {
@@ -404,6 +435,7 @@ func (m HasLabels) ApplyToList(opts *ListOptions) {
404
435
opts .LabelSelector = sel
405
436
}
406
437
438
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
407
439
func (m HasLabels ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
408
440
m .ApplyToList (& opts .ListOptions )
409
441
}
@@ -415,10 +447,12 @@ type MatchingLabelsSelector struct {
415
447
labels.Selector
416
448
}
417
449
450
+ // ApplyToList applies this configuration to the given list options.
418
451
func (m MatchingLabelsSelector ) ApplyToList (opts * ListOptions ) {
419
452
opts .LabelSelector = m
420
453
}
421
454
455
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
422
456
func (m MatchingLabelsSelector ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
423
457
m .ApplyToList (& opts .ListOptions )
424
458
}
@@ -435,12 +469,14 @@ func MatchingField(name, val string) MatchingFields {
435
469
// (or index in the case of cached lists).
436
470
type MatchingFields fields.Set
437
471
472
+ // ApplyToList applies this configuration to the given list options.
438
473
func (m MatchingFields ) ApplyToList (opts * ListOptions ) {
439
474
// TODO(directxman12): can we avoid re-serializing this?
440
475
sel := fields .Set (m ).AsSelector ()
441
476
opts .FieldSelector = sel
442
477
}
443
478
479
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
444
480
func (m MatchingFields ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
445
481
m .ApplyToList (& opts .ListOptions )
446
482
}
@@ -452,21 +488,25 @@ type MatchingFieldsSelector struct {
452
488
fields.Selector
453
489
}
454
490
491
+ // ApplyToList applies this configuration to the given list options.
455
492
func (m MatchingFieldsSelector ) ApplyToList (opts * ListOptions ) {
456
493
opts .FieldSelector = m
457
494
}
458
495
496
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
459
497
func (m MatchingFieldsSelector ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
460
498
m .ApplyToList (& opts .ListOptions )
461
499
}
462
500
463
501
// InNamespace restricts the list/delete operation to the given namespace.
464
502
type InNamespace string
465
503
504
+ // ApplyToList applies this configuration to the given list options.
466
505
func (n InNamespace ) ApplyToList (opts * ListOptions ) {
467
506
opts .Namespace = string (n )
468
507
}
469
508
509
+ // ApplyToDeleteAllOf applies this configuration to the given an List options.
470
510
func (n InNamespace ) ApplyToDeleteAllOf (opts * DeleteAllOfOptions ) {
471
511
n .ApplyToList (& opts .ListOptions )
472
512
}
@@ -476,6 +516,7 @@ func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
476
516
// does not support setting it for deletecollection operations.
477
517
type Limit int64
478
518
519
+ // ApplyToList applies this configuration to the given an list options.
479
520
func (l Limit ) ApplyToList (opts * ListOptions ) {
480
521
opts .Limit = int64 (l )
481
522
}
@@ -485,6 +526,7 @@ func (l Limit) ApplyToList(opts *ListOptions) {
485
526
// does not support setting it for deletecollection operations.
486
527
type Continue string
487
528
529
+ // ApplyToList applies this configuration to the given an List options.
488
530
func (c Continue ) ApplyToList (opts * ListOptions ) {
489
531
opts .Continue = string (c )
490
532
}
0 commit comments