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

make local metrics configurable #4337

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KPostOffice
Copy link
Contributor

add a singleton localQueueMetrics config which can be enabled and changed by KueueConfig

What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

#1833
https://github.com/kubernetes-sigs/kueue/tree/main/keps/1833-metrics-for-local-queue#api-changes

Which issue(s) this PR fixes:

Fixes #1833

Special notes for your reviewer:

There are three changes of note that I'm uncertain about:

  1. I've added a client to the internal clusterQueue representation. There was one already available as part of the TAS cache.
  2. I've added a reference to the lq object as part of the internal lq representation. The LocalQueue (or at least its metadata) is required when checking the truth value of the label selectors
  3. I've added ctx to many functions so that it can trickle down to the ShouldReportLocalMetricsFunction

Does this PR introduce a user-facing change?

New KueueConfiguration variable available to expose LocalQueueMetrics and LabelSelectors for which LocalQueues and Namespaces these metrics should be exposed for

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Feb 20, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: KPostOffice
Once this PR has been reviewed and has the lgtm label, please assign mimowo for approval. For more information see the 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 20, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @KPostOffice. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 20, 2025
Copy link

netlify bot commented Feb 20, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit f672c3f
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/67bf66009ac5d8000802ea72

@kannon92
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 20, 2025
@@ -162,6 +162,14 @@ func main() {
kubeConfig.UserAgent = useragent.Default()
}

if cfg.Metrics.LocalQueueMetrics != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this feature is not GA we should have this guarded by a feature gate also.

c.Lock()
defer c.Unlock()
_, ok := c.hm.ClusterQueues[cq.Name]
if !ok {
return
}
if features.Enabled(features.LocalQueueMetrics) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you still want the feature gate here as long as this feature is alpha/beta.

Also, you should make sure to bump the feature gate to beta if you are intending to bump this to beta.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 24, 2025
@KPostOffice KPostOffice force-pushed the lq-metrics-as-knob branch 5 times, most recently from f0ceb78 to 9ad1776 Compare February 26, 2025 18:14
add a singleton localQueueMetrics config which can be enabled
and changed by KueueConfig

Signed-off-by: Kevin <[email protected]>
@k8s-ci-robot
Copy link
Contributor

@KPostOffice: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-integration-multikueue-main f672c3f link true /test pull-kueue-test-integration-multikueue-main
pull-kueue-test-integration-main f672c3f link true /test pull-kueue-test-integration-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@kannon92
Copy link
Contributor

Integration tests seem to say you are hitting a data race.

@@ -488,18 +488,22 @@ func (s *Scheduler) admit(ctx context.Context, e *entry, cq *cache.ClusterQueueS
waitTime := workload.QueuedWaitTime(newWorkload)
s.recorder.Eventf(newWorkload, corev1.EventTypeNormal, "QuotaReserved", "Quota reserved in ClusterQueue %v, wait time since queued was %.0fs", admission.ClusterQueue, waitTime.Seconds())
metrics.QuotaReservedWorkload(admission.ClusterQueue, waitTime)
if features.Enabled(features.LocalQueueMetrics) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that if the feature gate is disabled we want to avoid checking for local queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local queues prometheus metrics
3 participants