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

koord-manager: fix the validating and mutating logic of Pod resources #921

Merged

Conversation

hormes
Copy link
Member

@hormes hormes commented Jan 3, 2023

fix the validating and mutating logic of webhook for Pod resources

Signed-off-by: Fansong Zeng fanster.z@gmail.com

Ⅰ. Describe what this PR does

There are some unreasonable constraints on Pod resource descriptions:

  1. must set batch-cpu/batch-memory limits
  2. must set batch-cpu/batch-memory requests
  3. the memory limits and requests must be equal for LS Pods

This PR will fix these unreasonable restrictions and make Koordinator's resource description fit the kubernetes resource semantics. And fix a panic when limits are set but requests are not set.

Ⅱ. Does this pull request fix one issue?

none

Ⅲ. Describe how to verify it

You could create pod like this:

apiVersion: v1
kind: Pod
metadata:
  name: test
  labels:
    koordinator.sh/qosClass: LS
spec:
  priorityClassName: koord-prod
  containers:
  - name: test
    resources:
      limits:
        memory: 1Gi
      requests:
        memory: 256Mi
apiVersion: v1
kind: Pod
metadata:
  name: test
  labels:
    koordinator.sh/qosClass: BE
spec:
  priorityClassName: koord-batch
  containers:
  - name: test
    resources:
      requests:
        cpu: 500m
        memory: 256Mi
apiVersion: v1
kind: Pod
metadata:
  name: test
  labels:
    koordinator.sh/qosClass: BE
spec:
  priorityClassName: koord-batch
  containers:
  - name: test
    resources:
      limits:
        memory: 256Mi

… Pod resources

Signed-off-by: Fansong Zeng <fanster.z@gmail.com>
@hormes hormes force-pushed the fix_webhooks_of_pod_resources branch from 5f9edbc to b33bf1f Compare January 3, 2023 13:08
@hormes hormes self-assigned this Jan 3, 2023
@hormes hormes added this to the v1.2 milestone Jan 3, 2023
@hormes hormes changed the title koord-manager: fix the validating and mutating logic of webhook about… koord-manager: fix the validating and mutating logic of Pod resources Jan 3, 2023
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

@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Base: 66.63% // Head: 66.58% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (b33bf1f) compared to base (0a02d28).
Patch coverage: 91.30% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #921      +/-   ##
==========================================
- Coverage   66.63%   66.58%   -0.06%     
==========================================
  Files         238      240       +2     
  Lines       27675    27754      +79     
==========================================
+ Hits        18442    18479      +37     
- Misses       7965     8005      +40     
- Partials     1268     1270       +2     
Flag Coverage Δ
unittests 66.58% <91.30%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
.../webhook/pod/validating/request_limit_validator.go 71.84% <50.00%> (-23.20%) ⬇️
...webhook/pod/mutating/cluster_colocation_profile.go 59.49% <100.00%> (+3.51%) ⬆️
...bhook/pod/validating/cluster_colocation_profile.go 91.00% <100.00%> (+0.37%) ⬆️
pkg/koordlet/statesinformer/states_pods.go 51.65% <0.00%> (-1.99%) ⬇️
pkg/koordlet/metrics/common.go 67.85% <0.00%> (-1.11%) ⬇️
pkg/scheduler/plugins/reservation/utils.go 79.27% <0.00%> (-0.35%) ⬇️
pkg/koordlet/metricsadvisor/collector.go 43.79% <0.00%> (-0.12%) ⬇️
pkg/koordlet/metrics/cpu_suppress.go 53.84% <0.00%> (ø)
pkg/koordlet/metrics/cpu_burst.go 60.86% <0.00%> (ø)
... and 9 more

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@koordinator-bot koordinator-bot bot merged commit 3c6b1b8 into koordinator-sh:main Jan 3, 2023
FillZpp pushed a commit that referenced this pull request Jan 16, 2023
lucming pushed a commit to lucming/koordinator that referenced this pull request Feb 8, 2023
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