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
feat: support Selectors field in kubernetes SD #6053
feat: support Selectors field in kubernetes SD #6053
Conversation
0d639a5
to
2d7874f
Compare
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.
SelectScrapeConfigs()
needs to validate the field and label selectors too.
Role string `json:"role"` | ||
Role K8SRole `json:"role"` | ||
// Selector to select objects. | ||
Selectors []K8SSelectorConfig `json:"selectors,omitempty"` |
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.
there can be only one item in the list for the same role.
Selectors []K8SSelectorConfig `json:"selectors,omitempty"` | |
// +optional | |
// +listType=map | |
// +listMapKey=role | |
Selectors []K8SSelectorConfig `json:"selectors,omitempty"` |
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.
@simonpasquier do we want to specify a default here since selectors is not required field?
main_test.go:184: initialize ScrapeConfig v1alpha1 CRD: create CRD scrapeconfigs on the apiserver: create CRD ScrapeConfig: CustomResourceDefinition.apiextensions.k8s.io "scrapeconfigs.monitoring.coreos.com" is invalid: spec.validation.openAPIV3Schema.properties[spec].properties[kubernetesSDConfigs].items.properties[selectors].items.properties[role].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property
2d7874f
to
d8c31d2
Compare
d8c31d2
to
1c3d873
Compare
@simonpasquier addressed review comments |
9854ef8
to
b82ed76
Compare
b82ed76
to
f0ce96a
Compare
Related-to prometheus-operator#5711 Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
f0ce96a
to
c2fe7a8
Compare
@simonpasquier addressed the issue. Could you please review again |
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.
Thanks!
Related-to #5711
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.
feat: support Selectors field in kubernetes SD
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.