Skip to content

Conversation

@AdheipSingh
Copy link

@AdheipSingh AdheipSingh commented Jan 7, 2026

Description

Summary of Working Validation:

  1. CREATE: Child queues cannot exceed parent quotas
  2. UPDATE: Warnings when parent quota is reduced below children
  3. DELETE: Parent queues cannot be deleted if they have children

Related Issues

Fixes #81

Checklist

Note: Ensure your PR title follows the Conventional Commits format (e.g., feat(scheduler): add new feature)

  • Self-reviewed
  • Added/updated tests (if needed)
  • Updated documentation (if needed)

Breaking Changes

Additional Notes

Screenshot 2026-01-08 at 3 37 49 AM
  1. test-parent-queue.yaml
apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
  name: parent-queue
spec:
  resources:
    cpu:
      quota: 2000
    gpu:
      quota: 2
    memory:
      quota: 4096
  1. test-valid-child.yaml
apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
name: valid-child-queue
spec:
parentQueue: parent-queue
resources:
  cpu:
    quota: 1000
  gpu:
    quota: 1
  memory:
    quota: 2048
  1. test-invalid-child.yaml
apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
name: invalid-child-queue
spec:
parentQueue: parent-queue
resources:
  cpu:
    quota: 3000  # This exceeds parent's 2000
  gpu:
    quota: 1
  memory:
    quota: 2048

cc @enoodle

@AdheipSingh AdheipSingh requested a review from itsomri January 8, 2026 19:41
@AdheipSingh AdheipSingh requested a review from enoodle January 13, 2026 21:50
@enoodle
Copy link
Collaborator

enoodle commented Jan 15, 2026

@AdheipSingh The CI fails on the validation stage.
You can test is locally by running make validate and later make test

@AdheipSingh
Copy link
Author

@enoodle i have made the fixes. Locally the tests passed. I have also tested this by running on k8s.

@github-actions
Copy link

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app 0.00% (ø)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks 0.00% (ø)
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/app.go 0.00% (ø) 31 0 31
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/options.go 0.00% (ø) 13 (+1) 0 13 (+1)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks/queue_validator.go 0.00% (ø) 90 (+90) 0 90 (+90)
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/queue_webhook.go 0.00% (ø) 0 (-20) 0 0 (-20)
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/zz_generated.deepcopy.go 0.00% (ø) 104 0 104

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@enoodle enoodle changed the title feat ( queue ) : add queue validator feat(queue-controller): add queue validator Jan 17, 2026
@enoodle
Copy link
Collaborator

enoodle commented Jan 17, 2026

@AdheipSingh Looks Good. Could you add a test file for queue validator and also a changelog entry about this change?

@AdheipSingh
Copy link
Author

@AdheipSingh Looks Good. Could you add a test file for queue validator and also a changelog entry about this change?

done. Please check.

@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app 0.00% (ø)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks 14.44% (+14.44%) 🎉
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/app.go 0.00% (ø) 31 0 31
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/options.go 0.00% (ø) 13 (+1) 0 13 (+1)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks/queue_validator.go 14.44% (+14.44%) 90 (+90) 13 (+13) 77 (+77) 🎉
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/queue_webhook.go 0.00% (ø) 0 (-20) 0 0 (-20)
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/zz_generated.deepcopy.go 0.00% (ø) 104 0 104

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks/queue_validator_test.go

@enoodle
Copy link
Collaborator

enoodle commented Jan 19, 2026

@AdheipSingh Sorry, one small last request ^^ :-)
Thank you for this contribution!

@AdheipSingh
Copy link
Author

@AdheipSingh Sorry, one small last request ^^ :-) Thank you for this contribution!

done.

@AdheipSingh AdheipSingh requested a review from enoodle January 19, 2026 13:20
@AdheipSingh
Copy link
Author

@enoodle @itsomri - anything pending on this one ?

@enoodle
Copy link
Collaborator

enoodle commented Jan 22, 2026

I have another question about this change:
Today there is no validation on parentQueue field, so someone can have a cluster with broken queue hierarchies. What will happen to them if they upgrade KAI to a version with this change?

@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app 0.00% (ø)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks 14.29% (+14.29%) 🎉
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/app.go 0.00% (ø) 31 0 31
github.com/NVIDIA/KAI-scheduler/cmd/queuecontroller/app/options.go 0.00% (ø) 13 (+1) 0 13 (+1)
github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks/queue_validator.go 14.29% (+14.29%) 91 (+91) 13 (+13) 78 (+78) 🎉
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/queue_webhook.go 0.00% (ø) 0 (-20) 0 0 (-20)
github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v2/zz_generated.deepcopy.go 0.00% (ø) 104 0 104

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/NVIDIA/KAI-scheduler/pkg/admission/webhook/queuehooks/queue_validator_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When the CPU value in the test queue is larger than that in the default queue, the queue can be created normally.

3 participants