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

feat: implement preemption between propagation policies #3845

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

whitewindmills
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
implement preemption between propagation policies

Which issue(s) this PR fixes:
part of feature

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 27, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 27, 2023
@whitewindmills
Copy link
Member Author

test result

  1. create configmap test-cm.
apiVersion: v1
data:
  a: b
kind: ConfigMap
metadata:
  creationTimestamp: "2023-07-27T03:36:57Z"
  labels:
    propagationpolicy.karmada.io/name: test-pp
    propagationpolicy.karmada.io/namespace: default
  name: test-cm
  namespace: default
  resourceVersion: "4121865"
  uid: 962cf2d0-55f1-4ab7-9286-50499fefe3b1
  1. create cpp test-cpp.
apiVersion: policy.karmada.io/v1alpha1
kind: ClusterPropagationPolicy
metadata:
  creationTimestamp: "2023-07-27T03:39:34Z"
  generation: 2
  name: test-cpp
  resourceVersion: "4116922"
  uid: fc1f2c80-8ba0-4f65-bb91-7240d26a1c5a
spec:
  conflictResolution: Abort
  placement:
    clusterTolerations:
    - effect: NoExecute
      key: cluster.karmada.io/not-ready
      operator: Exists
      tolerationSeconds: 300
    - effect: NoExecute
      key: cluster.karmada.io/unreachable
      operator: Exists
      tolerationSeconds: 300
    replicaScheduling:
      replicaSchedulingType: Duplicated
  preemption: Never
  priority: 10
  resourceSelectors:
  - apiVersion: v1
    kind: ConfigMap
    name: test-cm
    namespace: default
  schedulerName: default-scheduler
  1. configmap test-cm was bound to cpp test-cpp.
    0880c4c80710bee1fd12
  2. create pp test-pp which priority is lower than cpp test-cpp.
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
  creationTimestamp: "2023-07-27T03:46:48Z"
  generation: 1
  name: test-pp
  namespace: default
  resourceVersion: "4121864"
  uid: 4b8cbbe2-ba23-40f1-8a17-d23b0f29711a
spec:
  conflictResolution: Abort
  placement:
    clusterTolerations:
    - effect: NoExecute
      key: cluster.karmada.io/not-ready
      operator: Exists
      tolerationSeconds: 300
    - effect: NoExecute
      key: cluster.karmada.io/unreachable
      operator: Exists
      tolerationSeconds: 300
    replicaScheduling:
      replicaDivisionPreference: Aggregated
      replicaSchedulingType: Divided
  preemption: Always
  priority: 0
  resourceSelectors:
  - apiVersion: v1
    kind: ConfigMap
    name: test-cm
    namespace: default
  schedulerName: default-scheduler
  1. pp test-pp preempts cpp test-cpp regardless of priority.
    image

related logs

0880c4c80710bea1af17

@whitewindmills
Copy link
Member Author

/cc @RainbowMango

@karmada-bot karmada-bot requested a review from RainbowMango July 27, 2023 04:47
@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2023

Codecov Report

Merging #3845 (1561cf9) into master (f160ea7) will decrease coverage by 0.10%.
Report is 14 commits behind head on master.
The diff coverage is 0.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3845      +/-   ##
==========================================
- Coverage   55.20%   55.11%   -0.10%     
==========================================
  Files         227      227              
  Lines       21647    21706      +59     
==========================================
+ Hits        11950    11963      +13     
- Misses       9061     9106      +45     
- Partials      636      637       +1     
Flag Coverage Δ
unittests 55.11% <0.00%> (-0.10%) ⬇️

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

Files Changed Coverage Δ
pkg/detector/detector.go 0.00% <0.00%> (ø)
pkg/detector/policy.go 0.00% <0.00%> (ø)
pkg/detector/preemption.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@Poor12
Copy link
Member

Poor12 commented Jul 27, 2023

/assign

@Poor12
Copy link
Member

Poor12 commented Jul 27, 2023

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2023
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/assign

@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 31, 2023
pp preempts cpp

Signed-off-by: whitewindmills <[email protected]>
@RainbowMango
Copy link
Member

Can you help to run the test again?
I just tested it on my side, seems it does not work as expected, I'll run again.

@whitewindmills
Copy link
Member Author

whitewindmills commented Jul 31, 2023

I just tested it on my side, seems it does not work as expected, I'll run again.

could you share your karmada-controller-manager logs? I only need logs of the detector.go and preemption.go, like this screenshot.
image

@RainbowMango
Copy link
Member

Sorry, I forgot to set the feature gate... I usually test PR by hack/local-up-karmada.sh.

W0731 11:48:38.771315       1 preemption.go:22] Cannot handle the preemption process because feature gate "PropagationPolicyPreemption" is not enabled.

It works fine~ Thanks.

Copy link
Member

@RainbowMango RainbowMango 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

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2023
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 31, 2023
@karmada-bot karmada-bot merged commit 71584bc into karmada-io:master Jul 31, 2023
@whitewindmills
Copy link
Member Author

thanks~

@whitewindmills whitewindmills deleted the policy-preemption branch July 31, 2023 12:02
zach593 pushed a commit to ctripcloud/karmada that referenced this pull request Oct 12, 2023
from karmada-io#3845

feat: implement preemption between propagation policies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants