-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add Admitted Workloads Field to LocalQueueStatus #382
Add Admitted Workloads Field to LocalQueueStatus #382
Conversation
Hi @kannon92. 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 Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
/assign |
@@ -84,6 +84,13 @@ func (r *LocalQueueReconciler) Reconcile(ctx context.Context, req ctrl.Request) | |||
} | |||
|
|||
queueObj.Status.PendingWorkloads = pending | |||
admitted, errAdmitted := r.cache.AdmittedWorkloadsLocalQueue(&queueObj) |
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.
Looks good, but this needs to be tested.
You can add checks to the existing integration tests in test/integration
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.
Thank you! I was having some trouble running those on my setup.
I had some failures in unrelated code and some stuff to do with certs. I'll look more into it and add some tests in test/integration also.
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.
Did you try make test-integration
?
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.
Yea, I'll try it again.
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.
Alright. There is a regression caused by this code so I'll look into it, fix it and add some tests here.
I am unable to run make test-integration
on my Mac M1. it says architecture not supported and then fails every test.
I get failures when I get a test failure but it seems to be caused by the controller test detecting an error.
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.
@kannon92 Hi.
We will fix make test-integration
for M1 Mac in #362. If you want to run test-integration
on your local now, please check this comment.
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.
@tenzen-y Thank you for that suggestion! Applied that fix locally and I was able to deduce where my test failure was. Pushed up a fix for that.
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 looks like existing tests in the controller do verify status so I just added a new field for AdmittedWorkloads in the test. I think this is fine.
pkg/cache/cache_test.go
Outdated
if diff := cmp.Diff(tc.wantQueueCounts[key], queueAdmitted); diff != "" { | ||
t.Errorf("Wrong active workload counters for queues from AdmittedWorkloadsLocalQueue:\n%s", diff) | ||
} |
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.
You can either do a single comparison after the loop ends, or you can add the key somewhere in the Error message. Otherwise we can't tell which queue counters didn't match
Please fix the latest comment and squash |
pkg/cache/cache.go
Outdated
@@ -148,6 +148,17 @@ func (c *Cache) newClusterQueue(cq *kueue.ClusterQueue) (*ClusterQueue, error) { | |||
return cqImpl, nil | |||
} | |||
|
|||
func (c *Cache) AdmittedWorkloadsLocalQueue(localQueue *kueue.LocalQueue) int32 { |
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.
AdmittedWorkloadsInLocalQueue?
defer c.Unlock() | ||
cq, ok := c.clusterQueues[string(localQueue.Spec.ClusterQueue)] | ||
if !ok { | ||
return 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.
Maybe we should also return error 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.
Actually, the ClusterQueue might be created after the LocalQueue.
During that time, there can't be any admitted workloads. So 0 is the right value.
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.
Ah yes, that's the case. Another approach is
queueObj.Status.AdmittedWorkloads, _ = r.cache.AdmittedWorkloadsLocalQueue(&queueObj)
But remaining the same also makes sense to me.
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.
if there are no cases of error, I would not add error to the return values
/ok-to-test |
Update apis/kueue/v1alpha2/localqueue_types.go Co-authored-by: Aldo Culquicondor <1299064+alculquicondor@users.noreply.github.com> Update pkg/cache/cache.go Co-authored-by: Aldo Culquicondor <1299064+alculquicondor@users.noreply.github.com> Update pkg/cache/cache_test.go Co-authored-by: Aldo Culquicondor <1299064+alculquicondor@users.noreply.github.com> pr changes Updating localqueue_controller_test to refect AdmittedWorkload add Pending comment fix cache flattened use flattened map with just ns and name Change function name and cleanup test code
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: alculquicondor, kannon92 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 |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
Add AdmittedWorkloads to LocalQueueStatus API and update it in the LocalQueueController.
Which issue(s) this PR fixes:
Fixes #259
Special notes for your reviewer:
Sorry for the silliness with opening up multiple repos. I have my laptop setup with CLA and github commits but I committed from another instance. I didn't realize that if 1 commit doesn't have my email, it will fail the check.