Skip to content

Commit 06a12ec

Browse files
jpbetzk8s-publishing-bot
authored andcommitted
Add tests for the default behaviors of strategies
Kubernetes-commit: f12d822216fddd56431dfb1272b419e232f44fd8
1 parent a47407e commit 06a12ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/registry/generic/registry/store.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,12 +932,12 @@ func shouldOrphanDependents(ctx context.Context, e *Store, accessor metav1.Objec
932932
return defaultGCPolicy == rest.OrphanDependents
933933
}
934934

935-
// shouldDeleteDependents returns true if the finalizer for foreground deletion should be set
935+
// shouldDeleteDependentsInForeground returns true if the finalizer for foreground deletion should be set
936936
// updated for FinalizerDeleteDependents. In the order of highest to lowest
937937
// priority, there are three factors affect whether to add/remove the
938938
// FinalizerDeleteDependents: options, existing finalizers of the object, and
939939
// e.DeleteStrategy.DefaultGarbageCollectionPolicy.
940-
func shouldDeleteDependents(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
940+
func shouldDeleteDependentsInForeground(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
941941
// Get default GC policy from this REST object type
942942
if gcStrategy, ok := e.DeleteStrategy.(rest.GarbageCollectionDeleteStrategy); ok && gcStrategy.DefaultGarbageCollectionPolicy(ctx) == rest.Unsupported {
943943
// return false to indicate that we should NOT delete in foreground
@@ -986,7 +986,7 @@ func deletionFinalizersForGarbageCollection(ctx context.Context, e *Store, acces
986986
return false, []string{}
987987
}
988988
shouldOrphan := shouldOrphanDependents(ctx, e, accessor, options)
989-
shouldDeleteDependentInForeground := shouldDeleteDependents(ctx, e, accessor, options)
989+
shouldDeleteInForeground := shouldDeleteDependentsInForeground(ctx, e, accessor, options)
990990
newFinalizers := []string{}
991991

992992
// first remove both finalizers, add them back if needed.
@@ -1000,7 +1000,7 @@ func deletionFinalizersForGarbageCollection(ctx context.Context, e *Store, acces
10001000
if shouldOrphan {
10011001
newFinalizers = append(newFinalizers, metav1.FinalizerOrphanDependents)
10021002
}
1003-
if shouldDeleteDependentInForeground {
1003+
if shouldDeleteInForeground {
10041004
newFinalizers = append(newFinalizers, metav1.FinalizerDeleteDependents)
10051005
}
10061006

0 commit comments

Comments
 (0)