diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go index 5acdefbaf97a..fe636c8ffc16 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machinedeployment.go @@ -120,13 +120,9 @@ func (r machineDeploymentScalableResource) UnmarkMachineForDeletion(machine *Mac func (r machineDeploymentScalableResource) MarkMachineForDeletion(machine *Machine) error { u, err := r.controller.dynamicclient.Resource(*r.controller.machineResource).Namespace(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{}) - if err != nil { return err } - if u == nil { - return fmt.Errorf("unknown machine %s", machine.Name) - } u = u.DeepCopy() diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go index 03b86f073335..97d396c119aa 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_machineset.go @@ -102,13 +102,9 @@ func (r machineSetScalableResource) SetSize(nreplicas int32) error { func (r machineSetScalableResource) MarkMachineForDeletion(machine *Machine) error { u, err := r.controller.dynamicclient.Resource(*r.controller.machineResource).Namespace(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{}) - if err != nil { return err } - if u == nil { - return fmt.Errorf("unknown machine %s", machine.Name) - } u = u.DeepCopy() diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_scalableresource.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_scalableresource.go index 454531599ffd..aa1228fb4420 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_scalableresource.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_scalableresource.go @@ -18,7 +18,6 @@ package clusterapi import ( "context" - "fmt" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -60,13 +59,9 @@ type scalableResource interface { func unmarkMachineForDeletion(controller *machineController, machine *Machine) error { u, err := controller.dynamicclient.Resource(*controller.machineResource).Namespace(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{}) - if err != nil { return err } - if u == nil { - return fmt.Errorf("unknown machine %s", machine.Name) - } annotations := u.GetAnnotations() if _, ok := annotations[machineDeleteAnnotationKey]; ok {