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

fix: hierarchical queue webhook validation use listing podgroups instead #3913

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

Conversation

JesseStutler
Copy link
Member

fix #3911

validation

Steps:

  1. Create a queue parent-queue
  2. Create a running job in parent-queue
  3. Create a queue child-queue as the child of parent-queue
  4. Check whether the create request in step-3 will be rejected by the webhook

The screenshot shows that create a child queue under parent queue which contains podgroups will be rejected:
image

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign monokaix
You can assign the PR to them by writing /assign @monokaix in a comment when ready.

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

@volcano-sh-bot volcano-sh-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 23, 2024
@JesseStutler
Copy link
Member Author

@JesseStutler
Copy link
Member Author

/area webhooks

@hwdef
Copy link
Member

hwdef commented Jan 1, 2025

Please make the CI happy :)

return fmt.Errorf("queue %s cannot be the parent queue of queue %s because it has PodGroups (pending: %d, running: %d, unknown: %d, inqueue: %d)",
parentQueue.Name, queue.Name, parentQueue.Status.Pending,
parentQueue.Status.Running, parentQueue.Status.Unknown, parentQueue.Status.Inqueue)
pgList, err := config.VolcanoClient.SchedulingV1beta1().PodGroups("").List(context.Background(), metav1.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

How about use informer list

Copy link
Member Author

Choose a reason for hiding this comment

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

Informer will list/watch all podgroups, which increases webhook memory consumption. I don’t really want to sacrifice memory for a verification.

Copy link
Member

Choose a reason for hiding this comment

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

But not using the informer will put more pressure on the apiserver.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I'll solve it

Copy link
Member

Choose a reason for hiding this comment

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

Just a suggestion, we can look at other people's opinions

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We can check queue.status.allocated.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated, I have verified, it works

@JesseStutler JesseStutler requested a review from hwdef January 7, 2025 07:02
@JesseStutler JesseStutler force-pushed the czc_dev branch 2 times, most recently from 37f0dd4 to 9ecf734 Compare January 7, 2025 09:24
@volcano-sh-bot volcano-sh-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 7, 2025
@hwdef
Copy link
Member

hwdef commented Jan 7, 2025

/lgtm
/ok-to-test

@volcano-sh-bot volcano-sh-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm Indicates that a PR is ready to be merged. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/webhooks lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

queue.status.Running do not increased when create vcjob and pod is running successed.
4 participants