Skip to content

Commit

Permalink
fix #100
Browse files Browse the repository at this point in the history
  • Loading branch information
gmeghnag committed Jul 11, 2023
1 parent 58507c0 commit 570e73f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func MatchLabels(labels string, selector string) bool {
}

func MatchLabelsFromMap(labels map[string]string, selector string) (bool, error) {
fmt.Println(labels)
if selector == "" {
return true, nil
}
Expand All @@ -365,8 +366,8 @@ func MatchLabelsFromMap(labels map[string]string, selector string) (bool, error)
}
key := split[0]
val := split[1]
value, _ := labels[key]
if val != value {
value, isPresent := labels[key]
if val != value || !isPresent {
return false, nil
}
} else if strings.Contains(s, "=") {
Expand All @@ -376,8 +377,8 @@ func MatchLabelsFromMap(labels map[string]string, selector string) (bool, error)
}
key := split[0]
val := split[1]
value, _ := labels[key]
if val != value {
value, isPresent := labels[key]
if val != value || !isPresent {
return false, nil
}
} else if !strings.Contains(s, "!=") && !strings.Contains(s, "=") && !strings.Contains(s, "==") {
Expand Down

0 comments on commit 570e73f

Please sign in to comment.