From fcc3cab3467178bf0edf9d793e8d5cba42ccaaf1 Mon Sep 17 00:00:00 2001 From: Dillen Padhiar Date: Thu, 5 Oct 2023 08:47:43 -0700 Subject: [PATCH] feat: refine annotation check to just numaproj labels Signed-off-by: Dillen Padhiar --- pkg/reconciler/pipeline/controller.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pkg/reconciler/pipeline/controller.go b/pkg/reconciler/pipeline/controller.go index df3a00dc40..9aea992e6b 100644 --- a/pkg/reconciler/pipeline/controller.go +++ b/pkg/reconciler/pipeline/controller.go @@ -535,21 +535,26 @@ func needsUpdate(old, new *dfv1.Pipeline) bool { return true } - oldAnnotations := old.GetAnnotations() - newAnnotations := new.GetAnnotations() - if oldAnnotations != nil && newAnnotations == nil { - return true - } - if oldAnnotations == nil && newAnnotations != nil { + oldNumaAnnotations := annotSlice("numaflow.numaproj.io/", old.GetAnnotations()) + newNumaAnnotations := annotSlice("numaflow.numaproj.io/", new.GetAnnotations()) + + if !equality.Semantic.DeepEqual(oldNumaAnnotations, newNumaAnnotations) { return true } - for k, v := range oldAnnotations { - if strings.Contains(k, "numaflow.numaproj.io/") && v != newAnnotations[k] { - return true + return false +} + +func annotSlice(label string, annotations map[string]string) map[string]string { + + slice := make(map[string]string) + for k, v := range annotations { + if strings.Contains(k, label) { + slice[k] = v } } - return false + return slice + } func buildVertices(pl *dfv1.Pipeline) map[string]dfv1.Vertex {