Remove DeepCopy

It's unneeded
This commit is contained in:
Adrian Moisey 2024-11-27 08:48:09 +02:00
parent e277df0063
commit e9c1c1cc26
No known key found for this signature in database
GPG Key ID: 41AE4AE32747C7CF
2 changed files with 3 additions and 3 deletions

View File

@ -56,8 +56,8 @@ func (c *cappingRecommendationProcessor) Apply(
pod *apiv1.Pod) (*vpa_types.RecommendedPodResources, ContainerToAnnotationsMap, error) {
// TODO: Annotate if request enforced by maintaining proportion with limit and allowed limit range is in conflict with policy.
policy := vpa.Spec.ResourcePolicy.DeepCopy()
podRecommendation := vpa.Status.Recommendation.DeepCopy()
policy := vpa.Spec.ResourcePolicy
podRecommendation := vpa.Status.Recommendation
if podRecommendation == nil && policy == nil {
// If there is no recommendation and no policies have been defined then no recommendation can be computed.

View File

@ -31,7 +31,7 @@ type fakeProcessor struct {
func (p *fakeProcessor) Apply(vpa *vpa_types.VerticalPodAutoscaler,
pod *v1.Pod) (*vpa_types.RecommendedPodResources, ContainerToAnnotationsMap, error) {
result := vpa.Status.Recommendation.DeepCopy()
result := vpa.Status.Recommendation
result.ContainerRecommendations[0].ContainerName += p.message
containerToAnnotationsMap := ContainerToAnnotationsMap{"trace": []string{p.message}}
return result, containerToAnnotationsMap, nil