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

Introduce a mechanism to scheduler to actively trigger rescheduling #4848

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

chaosi-zju
Copy link
Member

@chaosi-zju chaosi-zju commented Apr 18, 2024

What type of PR is this?

/kind api-change
/kind feature

What this PR does / why we need it:

Introduce a mechanism to scheduler to actively trigger rescheduling

Which issue(s) this PR fixes:

Fixes part of #4840

Special notes for your reviewer:

How to test it:

  1. create a deployment and policy like follows:
resource.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-test-1
  labels:
    app: test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: demo-test-1
  template:
    metadata:
      labels:
        app: demo-test-1
    spec:
      terminationGracePeriodSeconds: 0
      containers:
        - image: nginx
          name: demo-test-1
          resources:
            limits:
              cpu: 10m
              memory: 10Mi
---
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
  name: default-pp
spec:
  placement:
    clusterAffinity:
      clusterNames:
        - member1
        - member2
    replicaScheduling:
      replicaDivisionPreference: Weighted
      replicaSchedulingType: Divided
      weightPreference:
        dynamicWeight: AvailableReplicas
  resourceSelectors:
    - apiVersion: apps/v1
      kind: Deployment
      name: demo-test-1
      namespace: default
  1. when first schedule finished, update schedule result in bingding manually, like:
ka patch rb demo-test-1-deployment --type='json' -p '[{"op": "replace", "path": "/spec/clusters", "value": [{"name": "member2", "replicas": 3}]}]'
  1. add filed spec.rescheduleTriggeredAt binding manually, like:
ka patch rb demo-test-1-deployment --type='json' -p '[{"op": "replace", "path": "/spec/rescheduleTriggeredAt", "value": "2024-04-18T11:38:15Z"}]'

notes that the timestamp value can set to one second later than current status.lastScheduledTime.

  1. check whether reschedule executed by observing whether spec.cluster and status.lastScheduledTime updated.

Does this PR introduce a user-facing change?:

Introduce a mechanism to scheduler to actively trigger rescheduling

@karmada-bot karmada-bot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Apr 18, 2024
@karmada-bot karmada-bot added kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 18, 2024
@chaosi-zju chaosi-zju force-pushed the reschedule-sche branch 2 times, most recently from 0ab71dd to 17d792e Compare April 18, 2024 13:44
@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 18, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 26.31579% with 56 lines in your changes are missing coverage. Please review.

Project coverage is 52.97%. Comparing base (fdad87e) to head (0372cab).
Report is 14 commits behind head on master.

Files Patch % Lines
pkg/scheduler/scheduler.go 10.81% 33 Missing ⚠️
pkg/scheduler/core/division_algorithm.go 0.00% 14 Missing ⚠️
pkg/scheduler/core/assignment.go 46.15% 5 Missing and 2 partials ⚠️
pkg/scheduler/core/common.go 66.66% 1 Missing ⚠️
pkg/scheduler/core/generic_scheduler.go 66.66% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4848      +/-   ##
==========================================
- Coverage   53.11%   52.97%   -0.15%     
==========================================
  Files         250      250              
  Lines       20351    20420      +69     
==========================================
+ Hits        10810    10817       +7     
- Misses       8824     8883      +59     
- Partials      717      720       +3     
Flag Coverage Δ
unittests 52.97% <26.31%> (-0.15%) ⬇️

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.

@chaosi-zju
Copy link
Member Author

ready to review, already tested @RainbowMango

@RainbowMango
Copy link
Member

I tend to start with the proposal(#4698).

@chaosi-zju chaosi-zju force-pushed the reschedule-sche branch 3 times, most recently from d61affa to d028c18 Compare April 20, 2024 08:03
@RainbowMango
Copy link
Member

/assign @XiShanYongYe-Chang

pkg/util/binding.go Outdated Show resolved Hide resolved
pkg/util/binding.go Outdated Show resolved Hide resolved
pkg/scheduler/core/assignment.go Outdated Show resolved Hide resolved
@RainbowMango
Copy link
Member

/lgtm

@XiShanYongYe-Chang Do you have any further comments?

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2024
@XiShanYongYe-Chang
Copy link
Member

/LGTM

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.

/approve

@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 Apr 22, 2024
@karmada-bot karmada-bot merged commit aded7c0 into karmada-io:master Apr 22, 2024
13 checks passed
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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants