Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dongjiang1989
Copy link
Member

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.

support OVHCloud xds
see: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ovhcloud_sd_config

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.

Add OVHcloud service discovery to the ScrapeConfig CRD

@dongjiang1989 dongjiang1989 requested a review from a team as a code owner June 18, 2024 08:58
Signed-off-by: dongjiang1989 <[email protected]>
Signed-off-by: dongjiang1989 <[email protected]>
@slashpai
Copy link
Contributor

@dongjiang1989 Currently we are still reviewing what all SDs we want to support you can take a look at the design proposal #6634

@dongjiang1989
Copy link
Member Author

@dongjiang1989 Currently we are still reviewing what all SDs we want to support you can take a look at the design proposal #6634

Got it. thanks

@slashpai
Copy link
Contributor

@mviswanathsai can you review? :)

if config.Service != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "service",
Value: config.Service,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Value: config.Service,
Value: strings.ToLower(config.Service),

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.
Is it more reasonable to maintain the user-defined capitalization specifications of CRD? 🤔️

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it more reasonable to maintain the user-defined capitalization specifications of CRD? 🤔️

Not sure to follow here, could you elaborate?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure to follow here, could you elaborate?

ref:
https://github.com/prometheus/prometheus/blob/5c417684f87f2e7f55b172b3e5e5c96ac9bc2e2c/discovery/ovhcloud/ovhcloud.go#L89-L94

For me, remove the enum limit. It's best to keep it vague.
/cc @simonpasquier @slashpai

Copy link
Contributor

@mviswanathsai mviswanathsai Jun 19, 2024

Choose a reason for hiding this comment

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

It's best to keep it vague.

Not sure what you mean but my opinion is, if we can add valuable validation at the operator its best we do that. I'd go a step further and say its best if we can add most of the validations at the API level (i.e, make the API restrictive) and only touch the application level validation when absolutely necessary. e.g, when fetching secrets, etc.

TLDR; If Prometheus is validating for something (at the application level or otherwise) it is best that the operator also validate for at least that. I think @simonpasquier and @slashpai will agree as well.

Signed-off-by: dongjiang1989 <[email protected]>
Signed-off-by: dongjiang1989 <[email protected]>
@dongjiang1989
Copy link
Member Author

@simonpasquier @mviswanathsai PTAL re-check

Comment on lines 968 to 970
// +kubebuilder:validation:Enum=VPS;DedicatedServer
// +optional
Service *OVHService `json:"service,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

If I read the Prometheus code properly, service is mandatory field.

Suggested change
// +kubebuilder:validation:Enum=VPS;DedicatedServer
// +optional
Service *OVHService `json:"service,omitempty"`
Service OVHService `json:"service"`

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad. Got it.
Done.

Signed-off-by: dongjiang1989 <[email protected]>
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.

Thanks!

@simonpasquier simonpasquier merged commit cb79b96 into prometheus-operator:main Jun 26, 2024
@dongjiang1989 dongjiang1989 deleted the add-ovhcloud branch June 26, 2024 12:17
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.

4 participants