Skip to content

Refactor KumaSDConfigs #7203

@mviswanathsai

Description

@mviswanathsai

Component(s)

No response

What is missing? Please describe.

We want to refactor the ScrapeConfig API, at least for all the tier-1 and tier-2 Service Discoveries mentioned in #6634. Currently all of tier-1 stands refactored and some from the tier-2 are left incomplete and we want to work on them.

Some common rules of thumb for refactoring the API are:

The API needs to be restrictive wherever possible/sensible.
Fields that are unsupported for the current version of Prometheus are to be rejected at resource_selector.go
Arrays should not be empty if an empty array does not make sense in configuration. (empty arrays have some meaning in some cases, so be mindful of that)
String values (standalone, or part of a []string) should not be empty string. i.e, "".
Numerical values need to have a Min and Max value wherever possible.
Test cases for all the API behavior we expect needs to be written.
Keep an eye on the minimum Prometheus version required to configure certain fields, you will have to comment and also add test cases to ensure that the unsupported field is dealt with properly.
You will find that most (hopefully all) of the above rules are followed in prior refactoring PRs. You may take inspiration from the PRs that refactored different SDs before:
#6869
#6800
#6744

Especially test functions may be daunting to write at first, it's really useful to take reference from prior PRs.
I tried to cover as much as I can. This might not be a good first issue in the truest sense, but it is definitely something that is exciting to do as a newcomer. If you have any doubts, you can reach out to me or any of the other maintainers.

Describe alternatives you've considered.

No response

Environment Information.

Environment

Kubernetes Version:
Prometheus-Operator Version:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions