Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTA-1305: Add source and target labels to selector #79

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
@@ -721,19 +721,22 @@ func (a *analyzeCommand) getLabelSelector() string {
if targetExpr != "" {
if sourceExpr != "" {
// when both targets and sources are present, AND them
return fmt.Sprintf("(%s && %s) || (%s)",
targetExpr, sourceExpr, strings.Join(defaultLabels, " || "))
return fmt.Sprintf("(%s && %s) || %s || (%s)",
targetExpr, sourceExpr, outputv1.SourceTechnologyLabel,
strings.Join(defaultLabels, " || "))
} else {
// when target is specified, but source is not
// use a catch-all expression for source
return fmt.Sprintf("(%s && %s) || (%s)",
targetExpr, outputv1.SourceTechnologyLabel, strings.Join(defaultLabels, " || "))
return fmt.Sprintf("(%s && %s) || %s || (%s)",
targetExpr, outputv1.SourceTechnologyLabel, outputv1.TargetTechnologyLabel,
strings.Join(defaultLabels, " || "))
}
}
if sourceExpr != "" {
// when only source is specified, OR them all
return fmt.Sprintf("%s || (%s)",
sourceExpr, strings.Join(defaultLabels, " || "))
return fmt.Sprintf("%s || %s || (%s)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we should be passing catch-all selector, this will match a lot many builtin rules.

sourceExpr, outputv1.SourceTechnologyLabel,
strings.Join(defaultLabels, " || "))
}
return ""
}
Loading