-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feature: Add podgroups statistics #3751
Conversation
a91a112
to
9315036
Compare
cmd/controller-manager/app/server.go
Outdated
@@ -177,3 +188,10 @@ func isControllerEnabled(name string, controllers []string) bool { | |||
// if we get here, there was no explicit inclusion or exclusion | |||
return hasStar | |||
} | |||
|
|||
func promHandler() http.Handler { |
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 is duplicated with the func in scheduler.
@@ -58,7 +58,7 @@ rules: | |||
verbs: ["get", "create", "delete", "update"] | |||
- apiGroups: ["scheduling.incubator.k8s.io", "scheduling.volcano.sh"] | |||
resources: ["podgroups", "queues", "queues/status"] | |||
verbs: ["get", "list", "watch", "create", "delete", "update"] | |||
verbs: ["get", "list", "watch", "create", "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.
Is update still need?
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 there something I'm missing? Where is the logic for deleting the update queue status
@@ -37,6 +37,7 @@ const ( | |||
defaultMaxRequeueNum = 15 | |||
defaultSchedulerName = "volcano" | |||
defaultHealthzAddress = ":11251" | |||
defaultListenAddress = ":8080" |
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.
Would a different port be better?
- Make a distinction with the scheduler port.
- Port 8080 is too common and prone to conflicts.
Sorry I don't get the point, you mean that when the queue is deleted, the metrics need also be deleted, right? |
Sorry I didn't express myself clearly. |
Oh yes now the pending/running/unknown/inqueue/completed pg statistics won't be persisted into etcd, see here:
You can see above that the data called |
8b51344
to
996a0de
Compare
b8d8998
to
f0bddff
Compare
pkg/cli/queue/util.go
Outdated
Completed int | ||
} | ||
|
||
func (pgStats *PodGroupStatistics) StatPodGroupCountsForQueue(pg *v1beta1.PodGroup) { |
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 a pg resource but in cli/queue pkg.
@@ -19,6 +19,7 @@ package queue | |||
import ( | |||
"k8s.io/client-go/tools/cache" | |||
"k8s.io/klog/v2" | |||
"volcano.sh/volcano/pkg/controllers/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.
Please sort import.
} | ||
} | ||
|
||
// Update the 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.
Can wrap a func.
39756cb
to
6e7924f
Compare
@@ -38,3 +43,11 @@ func IsQueueReference(ref *metav1.OwnerReference) bool { | |||
|
|||
return true | |||
} | |||
|
|||
func UpdateQueueMetrics(queueName string, queueStatus *schedulingv1beta1.QueueStatus) { |
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.
Put these to metrics pkg is better.
klog.V(4).Infof("Begin to sync queue %s.", queue.Name) | ||
defer klog.V(4).Infof("End sync queue %s.", queue.Name) | ||
|
||
podGroups := c.getPodGroups(queue.Name) | ||
queueStatus := schedulingv1beta1.QueueStatus{} | ||
newQueueStatus := schedulingv1beta1.QueueStatus{} |
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.
Do we need deepCopy from old queue or we may miss some fields?
/ok-to-test |
59ce875
to
626cae3
Compare
40e1f3f
to
ddd1d8f
Compare
…up to vc-controller Signed-off-by: JesseStutler <[email protected]>
ddd1d8f
to
f14999c
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.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Monokaix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fix #3597, related proposal pr: #3750
Implementation
syncQueue
of queue controller, concurrently usingUpdateStatus
will cause conflict, useApplyStatus
instead, and need to add patch permission of vc-controller forpatch/status
. And we record the statistics of podgroups in each state in queue as metrics to be exported outside, we don't update the statistics of podgroups in queue's status now.vcctl get -n [name]
andvcctl list
display the statistics of podgroups in each state from queue's status directly, instead we do one more step, query the podgroups owend in the queue, stat the counts of podgroups in each state at the vcctl side, and then display them.Verification