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

discovery/kubernetes: Fix valid label selector causing config error #8285

Merged
merged 1 commit into from Dec 28, 2020

Conversation

ashumkin
Copy link
Contributor

Label selector can be
"set-based"(https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
but such a selector causes Prometheus start failure with the "unexpected
error: parsing YAML file ...: invalid selector: 'foo in (bar,baz)';
can't understand 'baz)'"-like error.

This is caused by the fields.ParseSelector(string) function that
simply splits an expression as a CSV-list, so a comma confuses such a
parsing method and lead to the error.

Use labels.Parse(string) to use a valid lexer to parse a selector
expression.

Closes #8284.

Signed-off-by: Alexey Shumkin Alex.Crezoff@gmail.com

@brian-brazil
Copy link
Contributor

@brancz does this look right to you?

Label selector can be
"set-based"(https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
but such a selector causes Prometheus start failure with the "unexpected
error: parsing YAML file ...: invalid selector: 'foo in (bar,baz)';
can't understand 'baz)'"-like error.

This is caused by the `fields.ParseSelector(string)` function that
simply splits an expression as a CSV-list, so a comma confuses such a
parsing method and lead to the error.

Use `labels.Parse(string)` to use a valid lexer to parse a selector
expression.

Closes prometheus#8284.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
@ashumkin
Copy link
Contributor Author

any feedback?

@roidelapluie
Copy link
Member

Sorry, it is a bit quiet due to the holidays period.

cc @olagacek does this look fine to you? thanks!

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

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

Thanks for catching! This looks right.

@brancz brancz merged commit 611fa96 into prometheus:master Dec 28, 2020
@ashumkin ashumkin deleted the label-selector branch December 29, 2020 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

K8s SD: valid label selector causes "incorrect config" error
4 participants