From 2be84ac59d86a5d77c6de7927d5819e54473212d Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 29 Jul 2024 18:18:35 +0200 Subject: [PATCH] Added option to use VpaMinReplicasAnnotation from labels (#720) * Added option to use VpaMinReplicasAnnotation from labels * Update vpa pod resource policy to also allow the use of labels * ci: trigger build --------- Co-authored-by: Andy Suderman --- pkg/vpa/vpa.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/vpa/vpa.go b/pkg/vpa/vpa.go index f2458ba2..c4780c24 100644 --- a/pkg/vpa/vpa.go +++ b/pkg/vpa/vpa.go @@ -411,6 +411,8 @@ func vpaResourcePolicyForResource(obj runtime.Object) (*vpav1.PodResourcePolicy, accessor, _ := meta.Accessor(obj) if val, ok := accessor.GetAnnotations()[utils.VpaResourcePolicyAnnotation]; ok { resourcePolicyStr = val + } else if val, ok := accessor.GetLabels()[utils.VpaResourcePolicyAnnotation]; ok { + resourcePolicyStr = val } if resourcePolicyStr == "" { @@ -436,6 +438,8 @@ func vpaMinReplicasForResource(obj runtime.Object) (*int32, bool) { accessor, _ := meta.Accessor(obj) if val, ok := accessor.GetAnnotations()[utils.VpaMinReplicasAnnotation]; ok { minReplicasString = val + } else if val, ok := accessor.GetLabels()[utils.VpaMinReplicasAnnotation]; ok { + minReplicasString = val } if minReplicasString == "" {