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

fix: add proxyURL validation for smon,pmon and probe #6464

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

slashpai
Copy link
Contributor

@slashpai slashpai commented Apr 2, 2024

Description

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

If a user specify a non-parsable proxyUrl it was not validated/rejected but will break reloading and restarting of Prometheus due to possible invalid syntax. This commit adds validation and rejects the invalid ones

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Verification

Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

fix: add proxyURL validation for servicemonitor, podmonitor and probe

@slashpai
Copy link
Contributor Author

slashpai commented Apr 2, 2024

I see Prometheus is using url.Parse hence using same for validation here not to be too restrictive than that

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

can you add a validateProxyURL() utility function to reduce the duplication?

pkg/prometheus/resource_selector.go Outdated Show resolved Hide resolved
If a user specify a non-parsable proxyUrl it was not validated/rejected
but will break reloading and restarting of Prometheus due to possible invalid syntax.
This commit adds validation and rejects the invalid ones

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
@slashpai
Copy link
Contributor Author

slashpai commented Apr 3, 2024

@simonpasquier updated

@slashpai slashpai enabled auto-merge April 3, 2024 09:25
Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

We'll need a similar fix for the AlertmanagerConfig CRD.

@slashpai slashpai merged commit e5561af into prometheus-operator:main Apr 3, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants