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

webhook: fix priority admission conflict #1968

Merged

Conversation

j4ckstraw
Copy link
Contributor

@j4ckstraw j4ckstraw commented Mar 21, 2024

when we set priorityclass koord-xxx with preemptionPolicy=Never, priority admission refuse to create pod with error like this:

pods "test" is forbidden: the string value of PreemptionPolicy (Never)
must not be provided in pod spec; priority admission controller computed
PreemptLowerPriority from the given PriorityClass name

we overwrite PriorityClassName/Priority in cluster_colocation_profile, so as well PreemptionPolicy.

see
https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/priority/admission.go#L188

Ⅰ. Describe what this PR does

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

V. Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in make test

@koordinator-bot koordinator-bot bot requested review from eahydra and FillZpp March 21, 2024 12:18
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.55%. Comparing base (0448219) to head (21befaf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1968      +/-   ##
==========================================
+ Coverage   67.54%   67.55%   +0.01%     
==========================================
  Files         420      420              
  Lines       47058    47059       +1     
==========================================
+ Hits        31785    31792       +7     
  Misses      12960    12960              
+ Partials     2313     2307       -6     
Flag Coverage Δ
unittests 67.55% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

when we set priorityclass koord-xxx with preemptionPolicy=Never,
priority admission refuse to create pod with error like this:
```text
pods "test" is forbidden: the string value of PreemptionPolicy
(PreemptLowerPriority) must not be provided in pod spec; priority
admission controller computed Never from the given PriorityClass name
```

we overwrite PriorityClassName/Priority in cluster_colocation_profile,
so as well PreemptionPolicy.

see
https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/priority/admission.go#L188

Signed-off-by: j4ckstraw <j4ckstraw@foxmail.com>
@j4ckstraw j4ckstraw force-pushed the fix-preemption-policy-conflict branch from 8457454 to 21befaf Compare March 21, 2024 12:26
@j4ckstraw
Copy link
Contributor Author

We change priorityclass preemptionPolicy from PreemptLowerPriority to Never for some reason, then new pod refused by priority admission.

priority admission check if priority and preemptionPolicy is corresponding to priorityClass link

while koordinator only overwrite PriorityClassName and Priority in cluster colocation profile link, preemptionPolicy overwrite is also needed.

Copy link
Member

@eahydra eahydra left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eahydra

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eahydra eahydra changed the title fix priority admission conflict webhook: fix priority admission conflict Mar 22, 2024
@koordinator-bot koordinator-bot bot merged commit af5f951 into koordinator-sh:main Mar 22, 2024
20 checks passed
@j4ckstraw j4ckstraw deleted the fix-preemption-policy-conflict branch March 22, 2024 02:21
j4ckstraw added a commit to j4ckstraw/koordinator that referenced this pull request May 20, 2024
Signed-off-by: j4ckstraw <j4ckstraw@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants