From 837bf66bec8034bb73c058b4a3f2d4a852bede3a Mon Sep 17 00:00:00 2001 From: Yaroslava Serdiuk Date: Thu, 24 Oct 2024 13:32:59 +0000 Subject: [PATCH] Remove redundant copy in UpdateProvisioningRequest() method --- .../provisioningrequest/provreqclient/client.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cluster-autoscaler/provisioningrequest/provreqclient/client.go b/cluster-autoscaler/provisioningrequest/provreqclient/client.go index 941c3f40c97a..c5c12a953ec0 100644 --- a/cluster-autoscaler/provisioningrequest/provreqclient/client.go +++ b/cluster-autoscaler/provisioningrequest/provreqclient/client.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned" "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions" listers "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1" @@ -130,12 +130,7 @@ func (c *ProvisioningRequestClient) UpdateProvisioningRequest(pr *v1.Provisionin ctx, cancel := context.WithTimeout(context.Background(), provisioningRequestClientCallTimeout) defer cancel() - // UpdateStatus API call on a copy of the PR with cleared Spec field ensures that - // the default null template.metadata.creationTimestamp field of PodTemplateSpec - // will not generate false error logs as a side effect. - prCopy := pr.DeepCopy() - prCopy.Spec = v1.ProvisioningRequestSpec{} - updatedPr, err := c.client.AutoscalingV1().ProvisioningRequests(prCopy.Namespace).UpdateStatus(ctx, prCopy, metav1.UpdateOptions{}) + updatedPr, err := c.client.AutoscalingV1().ProvisioningRequests(pr.Namespace).UpdateStatus(ctx, pr, metav1.UpdateOptions{}) if err != nil { return pr, err }