-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
querier: Add validation for querier address flags #4897
Conversation
Signed-off-by: Saswata Mukherjee <[email protected]>
Signed-off-by: Saswata Mukherjee <[email protected]>
Signed-off-by: Saswata Mukherjee <[email protected]>
68dde86
to
9a5d3f7
Compare
} | ||
|
||
set[s] = struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can also call https://pkg.go.dev/net#ParseIP here to check scratch that, it is probably tricky to check whether we were given a hostname or if we were given an IP addresshostAndPort[0]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that maybe instead of using Strings()
on these flags, we could define a custom parser (https://github.com/alecthomas/kingpin#custom-parsers) that automatically calls validateAddrs
? That way we wouldn't miss calling these functions on the provided values. What do you think? 🤔
This would be better! Let me try it out and push a commit. 🙂 |
Signed-off-by: Saswata Mukherjee <[email protected]>
I've changed this to custom kingpin parser which is defined in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changes
This PR adds validation for querier address flags.
Adds the
validateAddrs()
function which checks for duplicates, empty or invalid addresses provided using--endpoint
,--store
,--rule
,--metadata
,--exemplar
or--target
flags.Fixes #4894.
Verification
Tested locally.