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

scheduler: add Reservation restricted options to control allocatable resources #1894

Merged

Conversation

eahydra
Copy link
Member

@eahydra eahydra commented Feb 6, 2024

Ⅰ. Describe what this PR does

When a Pod uses a Reservation with an allocation policy of Restricted, the maximum amount of resources that can be used by intersecting resource requests cannot exceed the amount of resources in the Reservation. But in fact, some scenarios require that even intersecting resource requests should be allowed to break this limit. This PR introduces annotation scheduling.koordinator.sh/reservation-restricted-options to solve this problem.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

  1. Create Reservation with the annotation scheduling.koordinator.sh/reservation-restricted-options.
apiVersion: scheduling.koordinator.sh/v1alpha1
kind: Reservation
metadata:
  annotations:
    scheduling.koordinator.sh/reservation-restricted-options: |- 
      {"resources": ["cpu", "memory"]}
  name: test-reservation
spec:
  allocateOnce: false
  allocatePolicy: Restricted
  owners:
  - labelSelector:
      matchLabels:
        app: test
  template:
    metadata:
      creationTimestamp: null
    spec:
      schedulerName: koord-scheduler
      containers:
      - image: mock
        imagePullPolicy: IfNotPresent
        name: mock
        resources:
          limits:
            cpu: "4"
            memory: 8Gi
            fakeResources: "4"
          requests:
            cpu: "4"
            memory: 8Gi
            fakeResources: "4"
  ttl: 0s
  1. Create Pods that used the Reservation.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: test
    spec:
      containers:
      - command:
        - bash
        - -c
        - sleep 360000
        image: busybox:latest
        imagePullPolicy: Always
        name: main
        resources:
          limits:
            cpu: "1"
            fakeResources: "8"
            memory: 1Gi
      schedulerName: koord-scheduler
  1. Pod successfully scheduled.

Ⅳ. 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 eahydra requested review from hormes and FillZpp February 6, 2024 07:34
@koordinator-bot koordinator-bot bot requested a review from buptcozy February 6, 2024 07:35
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

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

Project coverage is 67.54%. Comparing base (b634779) to head (c8cb955).
Report is 8 commits behind head on main.

Files Patch % Lines
pkg/scheduler/frameworkext/reservation_info.go 35.71% 14 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1894   +/-   ##
=======================================
  Coverage   67.53%   67.54%           
=======================================
  Files         413      413           
  Lines       46229    46268   +39     
=======================================
+ Hits        31223    31253   +30     
  Misses      12742    12742           
- Partials     2264     2273    +9     
Flag Coverage Δ
unittests 67.54% <57.14%> (+<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.

…resources

Signed-off-by: Joseph <joseph.t.lee@outlook.com>
@eahydra eahydra force-pushed the improve_reservation_restriction branch from 2b95d6e to c8cb955 Compare February 22, 2024 03:48
@eahydra eahydra requested a review from hormes February 22, 2024 03:57
@hormes
Copy link
Member

hormes commented Feb 26, 2024

/lgtm

@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 f42fffb into koordinator-sh:main Feb 26, 2024
20 checks passed
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