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

colocationprofile: support mutating pod labels and annotations with mapping #1781

Conversation

saintube
Copy link
Member

@saintube saintube commented Dec 18, 2023

Ⅰ. Describe what this PR does

  • Colocation Profile: support mutating pod labels or annotations according to the mapping rules.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

It can be used to set the core scheduling group IDs (#1728) of the pods according to a given pod label.

e.g.

apiVersion: config.koordinator.sh/v1alpha1
kind: ClusterColocationProfile
metadata:
  name: colocation-profile-example
spec:
  namespaceSelector:
    matchLabels:
      koordinator.sh/enable-colocation: "true"
  selector:
    matchLabels:
      koordinator.sh/enable-colocation: "true"
  qosClass: BE
  priorityClassName: koord-batch
  koordinatorPriority: 1000
  schedulerName: koord-scheduler
  labels:
    koordinator.sh/mutated: "true"
  annotations: 
    koordinator.sh/intercepted: "true"
  labelsToLabels:
    # set the pod.labels["koordinator.sh/core-sched-group-id"] = pod.labels["app-user-id"],
    # make the SMT-isolation between pods with different `app-user-id`.
    app-user-id: koordinator.sh/core-sched-group-id
  patch:
    spec:
      terminationGracePeriodSeconds: 30

V. Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in make test

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (a404e7f) 66.42% compared to head (dff1b78) 66.42%.
Report is 1 commits behind head on main.

Files Patch % Lines
...webhook/pod/mutating/cluster_colocation_profile.go 57.14% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1781      +/-   ##
==========================================
- Coverage   66.42%   66.42%   -0.01%     
==========================================
  Files         396      396              
  Lines       43739    43753      +14     
==========================================
+ Hits        29053    29061       +8     
- Misses      12525    12532       +7     
+ Partials     2161     2160       -1     
Flag Coverage Δ
unittests 66.42% <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.

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

@zwzhang0107
Copy link
Contributor

why not set the pod.labels["koordinator.sh/core-sched-group-id"] = pod.labels["app-user-id"],

@saintube
Copy link
Member Author

why not set the pod.labels["koordinator.sh/core-sched-group-id"] = pod.labels["app-user-id"],

It is also supported in this PR.

@zwzhang0107
Copy link
Contributor

/lgtm

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.

/approve

@saintube saintube force-pushed the colocation-profile-support-label-annotation-mapping branch from 8f5ecf9 to 300a0f6 Compare December 25, 2023 08:50
@saintube
Copy link
Member Author

saintube commented Dec 25, 2023

As discussed offline, the field labelsToAnnotation is removed to make the API more concise.
/cc @hormes @zwzhang0107 @eahydra

@zwzhang0107
Copy link
Contributor

/lgtm

@koordinator-bot koordinator-bot bot added the lgtm label Dec 25, 2023
@eahydra
Copy link
Member

eahydra commented Dec 25, 2023

/lgtm
/approve

@saintube saintube force-pushed the colocation-profile-support-label-annotation-mapping branch from 300a0f6 to 97aa7e0 Compare December 26, 2023 10:41
@koordinator-bot koordinator-bot bot removed the lgtm label Dec 26, 2023
@saintube saintube force-pushed the colocation-profile-support-label-annotation-mapping branch from 97aa7e0 to dff1b78 Compare December 26, 2023 11:21
@hormes
Copy link
Member

hormes commented Dec 28, 2023

/approve

@hormes
Copy link
Member

hormes commented Dec 28, 2023

/lgtm
/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eahydra, 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 3b10d2a into koordinator-sh:main Dec 28, 2023
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.

4 participants