pkg/controller: fix staticcheck warning
This commit is contained in:
@@ -138,7 +138,7 @@ func (d *namespacedResourcesDeleter) Delete(nsName string) error {
|
||||
}
|
||||
|
||||
// we have removed content, so mark it finalized by us
|
||||
namespace, err = d.retryOnConflictError(namespace, d.finalizeNamespace)
|
||||
_, err = d.retryOnConflictError(namespace, d.finalizeNamespace)
|
||||
if err != nil {
|
||||
// in normal practice, this should not be possible, but if a deployment is running
|
||||
// two controllers to do namespace deletion that share a common finalizer token it's
|
||||
@@ -188,20 +188,6 @@ func (d *namespacedResourcesDeleter) initOpCache() {
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes the given namespace.
|
||||
func (d *namespacedResourcesDeleter) deleteNamespace(namespace *v1.Namespace) error {
|
||||
var opts *metav1.DeleteOptions
|
||||
uid := namespace.UID
|
||||
if len(uid) > 0 {
|
||||
opts = &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &uid}}
|
||||
}
|
||||
err := d.nsClient.Delete(namespace.Name, opts)
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResourcesRemainingError is used to inform the caller that all resources are not yet fully removed from the namespace.
|
||||
type ResourcesRemainingError struct {
|
||||
Estimate int64
|
||||
|
@@ -82,7 +82,7 @@ func TestFinalizeNamespaceFunc(t *testing.T) {
|
||||
if len(finalizers) != 1 {
|
||||
t.Errorf("There should be a single finalizer remaining")
|
||||
}
|
||||
if "other" != string(finalizers[0]) {
|
||||
if string(finalizers[0]) != "other" {
|
||||
t.Errorf("Unexpected finalizer value, %v", finalizers[0])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user