fix: PodCliqueSet webhook crashes on unknown scheduler name#613
Merged
Conversation
shayasoolin
reviewed
May 14, 2026
sanjaychatterjee
left a comment
Collaborator
There was a problem hiding this comment.
@kangclzjc can you please review this PR? Please ensure the validations are correct.
kangclzjc
reviewed
May 18, 2026
Contributor
|
@weizhoublue it's a good catch, I left some comments here. And could you also create an issue, and link it in |
Signed-off-by: weizhoublue <weizhou.lan@daocloud.io> fix: rename test and fix formatting for CI fix Signed-off-by: weizhou.lan@daocloud.io <weizhou.lan@daocloud.io>
Contributor
Author
sure, #619 was created |
kangclzjc
approved these changes
May 18, 2026
sanjaychatterjee
approved these changes
May 18, 2026
sanjaychatterjee
left a comment
Collaborator
There was a problem hiding this comment.
Approved. Thanks for the contribution @weizhoublue!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / why we need it:
In a PodCliqueSet YAML, users set spec.template.cliques[].spec.podSpec.schedulerName to choose the scheduler backend. Valid values are "default-scheduler" and "kai-scheduler".
This field is plain corev1.PodSpec.SchedulerName (a string) — it has no CRD-level enum constraint, so the API server does not reject unknown values like "volcano" at the schema layer.
If a user mistakenly sets this to an unsupported value or typo , the validating webhook runs validateSchedulerNames, which detects the mismatch and records a validation error. However, validateSchedulerNames only accumulates errors into a field.ErrorList; it does not return early or prevent the handler from continuing. validatePodCliqueSetWithBackend is called
unconditionally immediately after.
Inside that function, GetOrDefault("kaikai-scheduler") or GetOrDefault("volcano") returns nil because the name is non-empty but not in the registry, and the subsequent backend.ValidatePodCliqueSet() dereferences nil, panicking the webhook process before it can return the recorded validation error to the user.
In short: the webhook does validate the name, but that validation does not stop the code from reaching the nil-deref site.
Which issue(s) this PR fixes:
Fixes #619
Special notes for your reviewer:
Does this PR introduce a API change?
Additional documentation e.g., enhancement proposals, usage docs, etc.: