Skip to content

Commit 99502b0

Browse files
committed
fix: add space trimming for label allowlist
Some developers prefer to write lists by adding spaces after commas, so add handling of spaces to increase code robustness
1 parent e9068e3 commit 99502b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/cadvisor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ func main() {
156156
containerLabelFunc := metrics.DefaultContainerLabels
157157
if !*storeContainerLabels {
158158
whitelistedLabels := strings.Split(*whitelistedContainerLabels, ",")
159+
// Trim spacing in labels
160+
for i := range whitelistedLabels {
161+
whitelistedLabels[i] = strings.TrimSpace(whitelistedLabels[i])
162+
}
159163
containerLabelFunc = metrics.BaseContainerLabels(whitelistedLabels)
160164
}
161165

0 commit comments

Comments
 (0)