Skip to content

Commit

Permalink
🐛 remove dep label selector from dependency condition (#380)
Browse files Browse the repository at this point in the history
fixes #377

Signed-off-by: Shawn Hurley <[email protected]>
  • Loading branch information
shawn-hurley authored Oct 19, 2023
1 parent 20a9d91 commit 6b0dfac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
3 changes: 1 addition & 2 deletions parser/rule_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,7 @@ func (r *RuleParser) getConditionForProvider(langProvider, capability string, va

if capability == "dependency" && !r.NoDependencyRules {
depCondition := provider.DependencyCondition{
Client: client,
LabelSelector: r.DepLabelSelector,
Client: client,
}

fullCondition, ok := value.(map[interface{}]interface{})
Expand Down
12 changes: 0 additions & 12 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,6 @@ type DependencyCondition struct {
NameRegex string

Client Client

LabelSelector *labels.LabelSelector[*Dep]
}

func (dc DependencyCondition) Evaluate(ctx context.Context, log logr.Logger, condCtx engine.ConditionContext) (engine.ConditionResponse, error) {
Expand All @@ -549,16 +547,6 @@ func (dc DependencyCondition) Evaluate(ctx context.Context, log logr.Logger, con
matchedDeps := []matchedDep{}
for u, ds := range deps {
for _, dep := range ds {
if dc.LabelSelector != nil {
got, err := dc.LabelSelector.Matches(dep)
if err != nil {
return resp, err
}
if !got {
continue
}
}

if dep.Name == dc.Name {
matchedDeps = append(matchedDeps, matchedDep{dep: dep, uri: u})
break
Expand Down

0 comments on commit 6b0dfac

Please sign in to comment.