Skip to content

Commit

Permalink
Merge pull request #1350 from vimalk78/log-2259
Browse files Browse the repository at this point in the history
LOG-2259: Vector: Add Route transform for application routing only once
  • Loading branch information
openshift-merge-robot authored Feb 23, 2022
2 parents 1b9742c + dce030b commit 3d1aa40
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/generator/vector/sources_to_inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func SourcesToInputs(spec *logging.ClusterLogForwarderSpec, o generator.Options)
el = append(el, r)
}
userDefined := spec.InputMap()
routeMap := map[string]string{}
for _, pipeline := range spec.Pipelines {
for _, inRef := range pipeline.InputRefs {
if input, ok := userDefined[inRef]; ok {
Expand All @@ -121,18 +122,19 @@ func SourcesToInputs(spec *logging.ClusterLogForwarderSpec, o generator.Options)
}
}
if len(matchNS) != 0 || len(matchLabels) != 0 {
el = append(el, Route{
ComponentID: RouteApplicationLogs,
Inputs: helpers.MakeInputs(logging.InputNameApplication),
Routes: map[string]string{
input.Name: Quote(AND(OR(matchNS...), AND(matchLabels...))),
},
})
routeMap[input.Name] = Quote(AND(OR(matchNS...), AND(matchLabels...)))
}
}
}
}
}
if len(routeMap) != 0 {
el = append(el, Route{
ComponentID: RouteApplicationLogs,
Inputs: helpers.MakeInputs(logging.InputNameApplication),
Routes: routeMap,
})
}

return el
}

0 comments on commit 3d1aa40

Please sign in to comment.