-
Notifications
You must be signed in to change notification settings - Fork 68
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
WINC-545: Improve handling of metrics configuration #2485
base: master
Are you sure you want to change the base?
Conversation
@mansikulkarni96: This pull request references WINC-545 which is a valid jira issue. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Skipping CI for Draft Pull Request. |
/test aws-e2e-operator |
621433f
to
b151bf7
Compare
/approve cancel |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test aws-e2e-operator |
34e5f29
to
ff5ff69
Compare
/test aws-e2e-operator |
@mansikulkarni96: This pull request references WINC-545 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
ff5ff69
to
9e728d5
Compare
/test aws-e2e-operator |
@mansikulkarni96: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
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 @mansikulkarni96, its good to see the amount of code this removes 😄
Made an initial review, PTAL at my comments
@@ -211,6 +211,8 @@ spec: | |||
- namespaces | |||
verbs: | |||
- get | |||
- list |
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.
Please squash this into the commit the kubebuilder directives are being added.
Else this will cause revert issues if one of the commits needs to be reverted
) | ||
|
||
//+kubebuilder:rbac:groups="",resources=services;services/finalizers,verbs=create;get;delete | ||
//+kubebuilder:rbac:groups="",resources=endpoints,verbs=create;get;delete;update;patch |
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 dont see this change reflected in the bundle. Is another file still making endpoint API calls?
pkg/metrics/metrics.go
Outdated
monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" | ||
monclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" |
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.
Sort imports. This will fail lint otherwise
pkg/metrics/metrics.go
Outdated
Endpoints: []monv1.Endpoint{ | ||
{ | ||
HonorLabels: true, | ||
Interval: "30s", | ||
Path: "/metrics", | ||
Port: "metrics", | ||
Port: "https-metrics", |
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.
Does this have a functionality change?
pkg/metrics/metrics.go
Outdated
TargetLabel: "instance", | ||
SourceLabels: []monv1.LabelName{ | ||
"__meta_kubernetes_endpoint_address_target_name", | ||
}, | ||
}, | ||
{ |
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 is a lot of 'magic' happening here, requiring maintainers to be familiar with these actions and what they may be doing. Please add a short comment for each explaining what they are doing and why they need to be done, if it is not too obvious.
884f8c9
to
375f4ec
Compare
pkg/metrics/metrics_test.go
Outdated
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.
this deletion would be better suited in the next commit
pkg/metrics/metrics.go
Outdated
//+kubebuilder:rbac:groups="",resources=services;services/finalizers,verbs=create;get;delete | ||
//+kubebuilder:rbac:groups="",resources=namespaces,verbs=get | ||
//+kubebuilder:rbac:groups="",resources=nodes,verbs=list | ||
//+kubebuilder:rbac:groups="monitoring.coreos.com",resources=servicemonitors,verbs=create;get;delete | ||
//+kubebuilder:rbac:groups="",resources=events,verbs=* |
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.
can we move the ones that are still relevant to metric controller?
pkg/metrics/metrics.go
Outdated
const ( | ||
// metricsPortName specifies the portname used for Prometheus monitoring | ||
// PortName specifies the portname used for Prometheus monitoring | ||
PortName = "metrics" | ||
// Host is the host address used by Windows metrics | ||
Host = "0.0.0.0" |
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.
is this used anywhere? if not we can delete
375f4ec
to
9356a60
Compare
This commit removes the code responsible for creating and managing metric endpoints object. There is an endpoint named kubelet in the kube-system namespace which contains all the node IP addresses. WMCO can rely on this endpoint and create the serviceMonitor which will change the port from 10250 to 9182 which is our desired metric port for the windows-exporter service
This commit adds a new metricController that watches the WMCO namespace to create service monitor when monitoring is enabled. Add namespace resource list and watch rbac.
9356a60
to
25bf04c
Compare
This PR adds a new metric controller that watches the WMCO namespace to create a service monitor when monitoring is enabled. This PR also removes the code where WMCO creates and manages endpoints object. An endpoint named kubelet in the kube-system namespace contains all the node IP addresses. WMCO can rely on this endpoint and create the serviceMonitor which will change the port from 10250 to 9182 which is our desired metric port for the windows-exporter service.