Skip to content

Commit

Permalink
feat: refine annotation check to just numaproj labels
Browse files Browse the repository at this point in the history
Signed-off-by: Dillen Padhiar <[email protected]>
  • Loading branch information
dpadhiar committed Oct 5, 2023
1 parent 5612e8b commit fcc3cab
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions pkg/reconciler/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Check failure on line 541 in pkg/reconciler/pipeline/controller.go

View workflow job for this annotation

GitHub Actions / Lint

S1008: should use 'return !equality.Semantic.DeepEqual(oldNumaAnnotations, newNumaAnnotations)' instead of 'if !equality.Semantic.DeepEqual(oldNumaAnnotations, newNumaAnnotations) { return true }; return false' (gosimple)
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 {
Expand Down

0 comments on commit fcc3cab

Please sign in to comment.