From 2ff06d58675fa00397147e1c0186090c971e5774 Mon Sep 17 00:00:00 2001
From: "dom.bozzuto" <dom.bozzuto@datadoghq.com>
Date: Tue, 23 Apr 2024 13:41:55 -0400
Subject: [PATCH] Remove erroneous nil check on resourcePolicy

---
 .../pkg/utils/vpa/allowed_resource_filter.go                | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vertical-pod-autoscaler/pkg/utils/vpa/allowed_resource_filter.go b/vertical-pod-autoscaler/pkg/utils/vpa/allowed_resource_filter.go
index 42473134bcb1..40fb9286d20e 100644
--- a/vertical-pod-autoscaler/pkg/utils/vpa/allowed_resource_filter.go
+++ b/vertical-pod-autoscaler/pkg/utils/vpa/allowed_resource_filter.go
@@ -39,9 +39,9 @@ func (p *allowedResourceFilter) Apply(podRecommendation *vpa_types.RecommendedPo
 	conditions []vpa_types.VerticalPodAutoscalerCondition,
 	pod *corev1.Pod) (*vpa_types.RecommendedPodResources, ContainerToAnnotationsMap, error) {
 
-	if podRecommendation == nil || policy == nil {
-		// If there is no recommendation or no policies have been defined then no recommendation can be computed.
-		return podRecommendation, nil, nil
+	if podRecommendation == nil {
+		// If there is no recommendation then no filtered recommendation can be computed.
+		return nil, nil, nil
 	}
 
 	accumulatedContainerToAnnotationsMap := ContainerToAnnotationsMap{}