Skip to content

Commit dce030b

Browse files
committed
LOG-2259: Vector: Add Route transform for application routing only once
1 parent 2185bba commit dce030b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

internal/generator/vector/sources_to_inputs.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func SourcesToInputs(spec *logging.ClusterLogForwarderSpec, o generator.Options)
9696
el = append(el, r)
9797
}
9898
userDefined := spec.InputMap()
99+
routeMap := map[string]string{}
99100
for _, pipeline := range spec.Pipelines {
100101
for _, inRef := range pipeline.InputRefs {
101102
if input, ok := userDefined[inRef]; ok {
@@ -121,18 +122,19 @@ func SourcesToInputs(spec *logging.ClusterLogForwarderSpec, o generator.Options)
121122
}
122123
}
123124
if len(matchNS) != 0 || len(matchLabels) != 0 {
124-
el = append(el, Route{
125-
ComponentID: RouteApplicationLogs,
126-
Inputs: helpers.MakeInputs(logging.InputNameApplication),
127-
Routes: map[string]string{
128-
input.Name: Quote(AND(OR(matchNS...), AND(matchLabels...))),
129-
},
130-
})
125+
routeMap[input.Name] = Quote(AND(OR(matchNS...), AND(matchLabels...)))
131126
}
132127
}
133128
}
134129
}
135130
}
131+
if len(routeMap) != 0 {
132+
el = append(el, Route{
133+
ComponentID: RouteApplicationLogs,
134+
Inputs: helpers.MakeInputs(logging.InputNameApplication),
135+
Routes: routeMap,
136+
})
137+
}
136138

137139
return el
138140
}

0 commit comments

Comments
 (0)