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

pkg/prometheus/promcfg*.go: Validate EnforcedBodySizeLimit #4285

Merged

Conversation

slashpai
Copy link
Contributor

@slashpai slashpai commented Sep 27, 2021

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.

Added the input validation for EnforcedBodySizeLimit

Related to #4282

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.)

Changelog entry

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

Added the input validation for EnforcedBodySizeLimit

cc: @simonpasquier

@simonpasquier
Copy link
Contributor

I think that the operator should be more explicit and fail the reconciliation if the provided parameter is invalid.

@slashpai slashpai force-pushed the string_validations branch 2 times, most recently from 64ff3f3 to 04e21ed Compare September 27, 2021 11:15
@slashpai
Copy link
Contributor Author

I think that the operator should be more explicit and fail the reconciliation if the provided parameter is invalid.

I propagated the error from validation that should fail sync

@slashpai
Copy link
Contributor Author

@fpetkovski @simonpasquier Can you review again?

@fpetkovski
Copy link
Contributor

Nice work, this LGMT!

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.

IMHO the check should happen near the top of *ConfigGenerator.GenerateConfig() since it's a PrometheusSpec field?

func (cg *ConfigGenerator) GenerateConfig(

@slashpai
Copy link
Contributor Author

IMHO the check should happen near the top of *ConfigGenerator.GenerateConfig() since it's a PrometheusSpec field?

func (cg *ConfigGenerator) GenerateConfig(

Good point. I added a func for validating the fields at prometheus crd level. Added the func call in operator.go before calling GenerateConfig

@simonpasquier Can you take a look?

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 base your change against release-0.51 so it can be part of v0.51.2?

pkg/prometheus/operator.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
@slashpai slashpai changed the base branch from master to release-0.51 September 28, 2021 10:10
@slashpai
Copy link
Contributor Author

@simonpasquier I updated with changed and changed the base for PR

@slashpai
Copy link
Contributor Author

@simonpasquier I updated with changed and changed the base for PR
just realized I didn't update error string, updating soon

@slashpai
Copy link
Contributor Author

Done

@slashpai
Copy link
Contributor Author

@simonpasquier Take a look when you get chance

pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
pkg/prometheus/promcfg.go Outdated Show resolved Hide resolved
@slashpai
Copy link
Contributor Author

@simonpasquier Thank you for the review. I updated the PR. Hope its good now :)

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.

lgtm

@simonpasquier simonpasquier merged commit e44bca6 into prometheus-operator:release-0.51 Sep 29, 2021
@simonpasquier
Copy link
Contributor

thanks!

@slashpai
Copy link
Contributor Author

@simonpasquier Curious to know would this change be synced with master only before release of 0.51.2?

@slashpai slashpai mentioned this pull request Oct 4, 2021
5 tasks
@simonpasquier
Copy link
Contributor

@slashpai yes this is the process.

@slashpai slashpai deleted the string_validations branch October 13, 2022 17:01
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.

None yet

3 participants