Skip to content

Commit

Permalink
AddDeleteProvisioningRequest method to ProvRec client
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslava-serdiuk committed May 22, 2024
1 parent 1255a4b commit 42a7d66
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cluster-autoscaler/provisioningrequest/provreqclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,16 @@ func ProvisioningRequestForPods(client *ProvisioningRequestClient, unschedulable
}
return provReq, nil
}

// DeleteProvisioningRequest deletes the given ProvisioningRequest CR using the ProvisioningRequestInterface and returns an error in case of failure.
func (c *ProvisioningRequestClient) DeleteProvisioningRequest(pr *v1beta1.ProvisioningRequest) error {
ctx, cancel := context.WithTimeout(context.Background(), provisioningRequestClientCallTimeout)
defer cancel()

err := c.client.AutoscalingV1beta1().ProvisioningRequests(pr.Namespace).Delete(ctx, pr.Name, metav1.DeleteOptions{})
if err != nil {
return fmt.Errorf("error deleting ProvisioningRequest %s/%s: %w", pr.Namespace, pr.Name, err)
}
klog.V(4).Infof("Deleted ProvisioningRequest %s/%s", pr.Namespace, pr.Name)
return nil
}

0 comments on commit 42a7d66

Please sign in to comment.