Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mansikulkarni96
Copy link
Member

@mansikulkarni96 mansikulkarni96 commented Oct 18, 2024

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 18, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 18, 2024

@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.

Copy link
Contributor

openshift-ci bot commented Oct 18, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 18, 2024
@mansikulkarni96
Copy link
Member Author

/test aws-e2e-operator

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 18, 2024
@mansikulkarni96
Copy link
Member Author

/approve cancel

Copy link
Contributor

openshift-ci bot commented Oct 21, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sebsoto for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2024
@mansikulkarni96
Copy link
Member Author

/test aws-e2e-operator

@mansikulkarni96
Copy link
Member Author

/test aws-e2e-operator

@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 24, 2024

@mansikulkarni96: This pull request references WINC-545 which is a valid jira issue.

In response to this:

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.

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.

@mansikulkarni96
Copy link
Member Author

/test aws-e2e-operator

Copy link
Contributor

openshift-ci bot commented Oct 28, 2024

@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.

Copy link
Contributor

@sebsoto sebsoto left a 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
Copy link
Contributor

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
Copy link
Contributor

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?

Comment on lines 19 to 20
monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
monclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
Copy link
Contributor

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

Endpoints: []monv1.Endpoint{
{
HonorLabels: true,
Interval: "30s",
Path: "/metrics",
Port: "metrics",
Port: "https-metrics",
Copy link
Contributor

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?

TargetLabel: "instance",
SourceLabels: []monv1.LabelName{
"__meta_kubernetes_endpoint_address_target_name",
},
},
{
Copy link
Contributor

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.

Copy link
Contributor

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

Comment on lines 3 to 7
//+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=*
Copy link
Contributor

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?

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"
Copy link
Contributor

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants