squash: reaction to comments

This commit is contained in:
David Eads 2019-09-06 09:58:41 -04:00
parent 0355f4482b
commit 95ae353f3a
4 changed files with 9 additions and 8 deletions

View File

@ -422,7 +422,8 @@ func (d *namespacedResourcesDeleter) deleteEachItem(gvr schema.GroupVersionResou
} }
type gvrDeletionMetadata struct { type gvrDeletionMetadata struct {
// finalizerEstimateSeconds is an estimate of how much longer to wait // finalizerEstimateSeconds is an estimate of how much longer to wait. zero means that no estimate has made and does not
// mean that all content has been removed.
finalizerEstimateSeconds int64 finalizerEstimateSeconds int64
// numRemaining is how many instances of the gvr remain // numRemaining is how many instances of the gvr remain
numRemaining int numRemaining int

View File

@ -56,14 +56,14 @@ var (
v1.NamespaceDeletionGVParsingFailure: "All legacy kube types successfully parsed", v1.NamespaceDeletionGVParsingFailure: "All legacy kube types successfully parsed",
v1.NamespaceDeletionContentFailure: "All content successfully deleted, may be waiting on finalization", v1.NamespaceDeletionContentFailure: "All content successfully deleted, may be waiting on finalization",
v1.NamespaceContentRemaining: "All content successfully removed", v1.NamespaceContentRemaining: "All content successfully removed",
v1.NamespaceFinalizersRemaining: "All content successfully removed", v1.NamespaceFinalizersRemaining: "All content-preserving finalizers finished",
} }
okReasons = map[v1.NamespaceConditionType]string{ okReasons = map[v1.NamespaceConditionType]string{
v1.NamespaceDeletionDiscoveryFailure: "ResourcesDiscovered", v1.NamespaceDeletionDiscoveryFailure: "ResourcesDiscovered",
v1.NamespaceDeletionGVParsingFailure: "ParsedGroupVersions", v1.NamespaceDeletionGVParsingFailure: "ParsedGroupVersions",
v1.NamespaceDeletionContentFailure: "ContentDeleted", v1.NamespaceDeletionContentFailure: "ContentDeleted",
v1.NamespaceContentRemaining: "ContentRemoved", v1.NamespaceContentRemaining: "ContentRemoved",
v1.NamespaceFinalizersRemaining: "ContentRemoved", v1.NamespaceFinalizersRemaining: "ContentHasNoFinalizers",
} }
) )
@ -133,8 +133,8 @@ func (u *namespaceConditionUpdater) ProcessContentTotals(contentTotals allGVRDel
Type: v1.NamespaceFinalizersRemaining, Type: v1.NamespaceFinalizersRemaining,
Status: v1.ConditionTrue, Status: v1.ConditionTrue,
LastTransitionTime: metav1.Now(), LastTransitionTime: metav1.Now(),
Reason: "SomeFinalizerRemain", Reason: "SomeFinalizersRemain",
Message: fmt.Sprintf("Some finalizers are remaining: %s", strings.Join(remainingByFinalizer, ", ")), Message: fmt.Sprintf("Some content in the namespace has finalizers remaining: %s", strings.Join(remainingByFinalizer, ", ")),
}) })
} }
} }

View File

@ -188,7 +188,7 @@ func TestProcessContentTotals(t *testing.T) {
}, },
}, },
expecteds: []v1.NamespaceCondition{ expecteds: []v1.NamespaceCondition{
{Type: v1.NamespaceFinalizersRemaining, Status: v1.ConditionTrue, Reason: "SomeFinalizerRemain", Message: `Some finalizers are remaining: kubedb in 5 resource instances, service-catalog in 6 resource instances`}, {Type: v1.NamespaceFinalizersRemaining, Status: v1.ConditionTrue, Reason: "SomeFinalizersRemain", Message: `Some content in the namespace has finalizers remaining: kubedb in 5 resource instances, service-catalog in 6 resource instances`},
}, },
}, },
{ {
@ -206,7 +206,7 @@ func TestProcessContentTotals(t *testing.T) {
}, },
expecteds: []v1.NamespaceCondition{ expecteds: []v1.NamespaceCondition{
{Type: v1.NamespaceContentRemaining, Status: v1.ConditionTrue, Reason: "SomeResourcesRemain", Message: `Some resources are remaining: daemonsets.apps.k8s.io has 5 resource instances, deployments.apps.k8s.io has 5 resource instances`}, {Type: v1.NamespaceContentRemaining, Status: v1.ConditionTrue, Reason: "SomeResourcesRemain", Message: `Some resources are remaining: daemonsets.apps.k8s.io has 5 resource instances, deployments.apps.k8s.io has 5 resource instances`},
{Type: v1.NamespaceFinalizersRemaining, Status: v1.ConditionTrue, Reason: "SomeFinalizerRemain", Message: `Some finalizers are remaining: kubedb in 5 resource instances, service-catalog in 6 resource instances`}, {Type: v1.NamespaceFinalizersRemaining, Status: v1.ConditionTrue, Reason: "SomeFinalizersRemain", Message: `Some content in the namespace has finalizers remaining: kubedb in 5 resource instances, service-catalog in 6 resource instances`},
}, },
}, },
} }

View File

@ -101,7 +101,7 @@ func TestNamespaceCondition(t *testing.T) {
if condition.Type == corev1.NamespaceContentRemaining && condition.Message == `Some resources are remaining: deployments.apps has 1 resource instances` { if condition.Type == corev1.NamespaceContentRemaining && condition.Message == `Some resources are remaining: deployments.apps has 1 resource instances` {
conditionsFound++ conditionsFound++
} }
if condition.Type == corev1.NamespaceFinalizersRemaining && condition.Message == `Some finalizers are remaining: custom.io/finalizer in 1 resource instances` { if condition.Type == corev1.NamespaceFinalizersRemaining && condition.Message == `Some content in the namespace has finalizers remaining: custom.io/finalizer in 1 resource instances` {
conditionsFound++ conditionsFound++
} }
} }