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

kood-scheduler: fix Reservation Score divide by zero #564

Conversation

eahydra
Copy link
Member

@eahydra eahydra commented Aug 31, 2022

Signed-off-by: Joseph joseph.t.lee@outlook.com

Ⅰ. Describe what this PR does

fix Reservation Score divide by zero.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

  1. create a reservation with empty resources as the following:
apiVersion: scheduling.koordinator.sh/v1alpha1
kind: Reservation
metadata:
  name: test
spec:
  allocateOnce: true
  owners:
  - labelSelector:
      matchLabels:
        app: test
  template:
    metadata:
      name: test-55859d896f-8dx9c
      namespace: default
    spec:
      containers:
      - resources:
          limits:
            cpu: "0"
            memory: "0"
          requests:
            cpu: "0"
            memory: "0"
      priority: 9000
      priorityClassName: koord-prod
      restartPolicy: Always
      schedulerName: koord-scheduler
      tolerations:
      - effect: NoExecute
        key: node.kubernetes.io/not-ready
        operator: Exists
        tolerationSeconds: 300
      - effect: NoExecute
        key: node.kubernetes.io/unreachable
        operator: Exists
        tolerationSeconds: 300
  ttl: 30m0s
  1. wait the Reservation scheduled by koord-scheduler
  2. create a pod with label app=test and pod resources requests defines as the following:
spec:
  containers:
  - resources:
      limits:
        cpu: "0"
        memory: "0"
      requests:
        cpu: "0"
        memory: "0"
  1. the koord-scheduler panic

apply the PR, the koord-scheduler schedule successfully.

Ⅳ. 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

@eahydra
Copy link
Member Author

eahydra commented Aug 31, 2022

/hold
I need to add UT for the case.

@eahydra
Copy link
Member Author

eahydra commented Aug 31, 2022

/hold cancel

Signed-off-by: Joseph <joseph.t.lee@outlook.com>
@eahydra eahydra force-pushed the fix_reservation_score_divide_by_zero branch from cde6d1a to 0bd66e5 Compare August 31, 2022 08:22
@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #564 (0bd66e5) into main (330680b) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #564      +/-   ##
==========================================
+ Coverage   67.14%   67.18%   +0.03%     
==========================================
  Files         164      164              
  Lines       17760    17762       +2     
==========================================
+ Hits        11925    11933       +8     
+ Misses       4950     4946       -4     
+ Partials      885      883       -2     
Flag Coverage Δ
unittests 67.18% <100.00%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
pkg/scheduler/plugins/reservation/rcache.go 89.07% <100.00%> (+0.09%) ⬆️
pkg/scheduler/plugins/reservation/plugin.go 80.21% <0.00%> (+0.63%) ⬆️
pkg/util/httputil/reverseproxy.go 85.10% <0.00%> (+0.79%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hormes
Copy link
Member

hormes commented Aug 31, 2022

/lgtm
/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hormes

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

@koordinator-bot koordinator-bot bot merged commit c849440 into koordinator-sh:main Aug 31, 2022
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.

None yet

2 participants