generated: run refactor
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package deletion
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
@@ -95,7 +96,7 @@ func (d *namespacedResourcesDeleter) Delete(nsName string) error {
|
||||
// Multiple controllers may edit a namespace during termination
|
||||
// first get the latest state of the namespace before proceeding
|
||||
// if the namespace was deleted already, don't do anything
|
||||
namespace, err := d.nsClient.Get(nsName, metav1.GetOptions{})
|
||||
namespace, err := d.nsClient.Get(context.TODO(), nsName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
return nil
|
||||
@@ -249,7 +250,7 @@ func (d *namespacedResourcesDeleter) retryOnConflictError(namespace *v1.Namespac
|
||||
return nil, err
|
||||
}
|
||||
prevNamespace := latestNamespace
|
||||
latestNamespace, err = d.nsClient.Get(latestNamespace.Name, metav1.GetOptions{})
|
||||
latestNamespace, err = d.nsClient.Get(context.TODO(), latestNamespace.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -268,7 +269,7 @@ func (d *namespacedResourcesDeleter) updateNamespaceStatusFunc(namespace *v1.Nam
|
||||
newNamespace.ObjectMeta = namespace.ObjectMeta
|
||||
newNamespace.Status = *namespace.Status.DeepCopy()
|
||||
newNamespace.Status.Phase = v1.NamespaceTerminating
|
||||
return d.nsClient.UpdateStatus(&newNamespace)
|
||||
return d.nsClient.UpdateStatus(context.TODO(), &newNamespace)
|
||||
}
|
||||
|
||||
// finalized returns true if the namespace.Spec.Finalizers is an empty list
|
||||
@@ -550,7 +551,7 @@ func (d *namespacedResourcesDeleter) deleteAllContent(ns *v1.Namespace) (int64,
|
||||
// we need to reflect that information. Recall that additional finalizers can be set on namespaces, so this finalizer may clear itself and
|
||||
// NOT remove the resource instance.
|
||||
if hasChanged := conditionUpdater.Update(ns); hasChanged {
|
||||
if _, err = d.nsClient.UpdateStatus(ns); err != nil {
|
||||
if _, err = d.nsClient.UpdateStatus(context.TODO(), ns); err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("couldn't update status condition for namespace %q: %v", namespace, err))
|
||||
}
|
||||
}
|
||||
@@ -590,7 +591,7 @@ func (d *namespacedResourcesDeleter) estimateGracefulTerminationForPods(ns strin
|
||||
if podsGetter == nil || reflect.ValueOf(podsGetter).IsNil() {
|
||||
return 0, fmt.Errorf("unexpected: podsGetter is nil. Cannot estimate grace period seconds for pods")
|
||||
}
|
||||
items, err := podsGetter.Pods(ns).List(metav1.ListOptions{})
|
||||
items, err := podsGetter.Pods(ns).List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user