-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
WIP[#5345]: RoleSelector field in ServiceMonitor (#5345) #6580
base: main
Are you sure you want to change the base?
Conversation
@@ -75,7 +75,12 @@ type ServiceMonitorSpec struct { | |||
Endpoints []Endpoint `json:"endpoints"` | |||
|
|||
// Label selector to select the Kubernetes `Endpoints` objects. | |||
Selector metav1.LabelSelector `json:"selector"` | |||
EndpointsSelector metav1.LabelSelector `json:"endpointsSelector"` |
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.
It's not possible to rename an existing field.
|
||
// Role specifies the role of the Kubernetes resources to be selected. | ||
// Possible values for Role are: "endpoints", "endpointslice", "service", "pod", "node", or "ingress". | ||
Role string `json:"role" protobuf:"bytes,1,opt,name=role"` |
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.
no need for the protobuf tag.
|
||
// Selector is a list of RoleSelector. | ||
// +optional | ||
Selector []RoleSelector `json:"selector"` |
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.
I expect label/field selectors to be defined in the Endpoint field.
type RoleSelector struct { | ||
|
||
// Role specifies the role of the Kubernetes resources to be selected. | ||
// Possible values for Role are: "endpoints", "endpointslice", "service", "pod", "node", or "ingress". |
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.
We can add validation markers.
Hey, I've read the linked issue but I couldn't understand why we would want different roles in ServiceMonitors that are not Endpoint or EndpointSlice. (Already being worked on in #6518) I.e., if we're already using the |
@ArthurSens, agree with you, actually, i have taken referenced from the prometheus doc https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config |
@ArthurSens @simonpasquier i have changed the things, can you look into the commit is I am going correct |
Description
If it fixes a bug or resolves a feature request, be sure to link to that issue. #5345
Be able to define selectors in kubernetes_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.)Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.