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

feat: update PodGroup label key #521

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

nayihz
Copy link
Contributor

@nayihz nayihz commented Feb 21, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes ##440

Special notes for your reviewer:

Does this PR introduce a user-facing change?

using new pod label key `scheduling.x-k8s.io/pod-group` to define a PodGroup. 

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 21, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @cmssczy!

It looks like this is your first PR to kubernetes-sigs/scheduler-plugins 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/scheduler-plugins has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @cmssczy. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 21, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 21, 2023
@nayihz
Copy link
Contributor Author

nayihz commented Feb 22, 2023

@denkensk PTAL

Copy link
Member

@zwpaper zwpaper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denkensk I have 2 more questions,

  1. Should we handle the case that a Pod has both the new and deprecated key?
  2. Should we add docs in README noticing the key changes?

@@ -47,9 +47,12 @@ func CreateMergePatch(original, new interface{}) ([]byte, error) {
return patch, nil
}

// GetPodGroupLabel get pod group from pod annotations
// GetPodGroupLabel get pod group name from pod annotations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// GetPodGroupLabel get pod group name from pod annotations
// GetPodGroupLabel get pod group name from pod labels

@@ -99,7 +99,20 @@ func (r *PodGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
log.Error(err, "List pods for group failed")
return ctrl.Result{}, err
}
pods := podList.Items
pods := podList.DeepCopy().Items
// use deprecated label key if cannot list pod by new label.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// use deprecated label key if cannot list pod by new label.
// also list pods by the deprecated key for compatibility

@@ -310,6 +326,20 @@ func makePods(podNames []string, pgName string, phase v1.PodPhase, reference []m
return pds
}

func makePodsWithDeprecatedLabel(podNames []string, pgName string, phase v1.PodPhase, reference []metav1.OwnerReference) []*v1.Pod {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding an args for makePods instead of a new function?

@denkensk
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 23, 2023
@denkensk
Copy link
Member

Should we handle the case that a Pod has both the new and deprecated key?

If so, the new key first

Should we add docs in README noticing the key changes?

Yes. It's essential and necessary.

@nayihz
Copy link
Contributor Author

nayihz commented Feb 24, 2023

Should we handle the case that a Pod has both the new and deprecated key?

If so, the new key first

Having implement this in function GetPodGroupLabel.

Should we add docs in README noticing the key changes?

Yes. It's essential and necessary.

Added a notice in pkg/coscheduling/README.md. Please let me know if it is not suitable

@@ -99,7 +99,20 @@ func (r *PodGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
log.Error(err, "List pods for group failed")
return ctrl.Result{}, err
}
pods := podList.Items
pods := podList.DeepCopy().Items
// also list pods by the deprecated key for compatibility.
Copy link
Contributor

@Huang-Wei Huang-Wei Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to actually, given the version is alpha.

Also I'm planning to standardize the group name (to x-k8s.io #525 ) in this release. So it's a breaking change anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denkensk WDYT?

@@ -15,8 +15,9 @@ This folder holds the coscheduling plugin implementations based on [Coscheduling
## Tutorial

### PodGroup
>❗We have changed this label from `pod-group.scheduling.sigs.k8s.io` to `scheduling.sigs.k8s.io/pod-group` in new version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once #526 gets merged, update it to scheduling.x-k8s.io/pod-group

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 1, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 1, 2023
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 1, 2023
@nayihz nayihz requested review from Huang-Wei and removed request for seanmalloy and yuanchen8911 March 1, 2023 13:43
Copy link
Contributor

@Huang-Wei Huang-Wei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a nit.

@@ -281,7 +281,6 @@ func setUp(ctx context.Context,
objs := []runtime.Object{pg}
if len(podNames) != 0 {
ps := makePods(podNames, pgName, podPhase, podOwnerReference)
// s.AddKnownTypes(clientgoscheme.SchemeGroupVersion, ps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment had been removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still there :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I misunderstanding you? This line had been remove in this pr already.
Did you mean remove this line or uncomment this line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad... somehow I always perceived this line was newly introduced...

@Huang-Wei
Copy link
Contributor

/lgtm
/approve

Thanks @czybjtu !

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 3, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: czybjtu, Huang-Wei

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2023
@nayihz
Copy link
Contributor Author

nayihz commented Mar 3, 2023

/retest

@k8s-ci-robot k8s-ci-robot merged commit 95751be into kubernetes-sigs:master Mar 3, 2023
@nayihz nayihz deleted the feat_podgroup_label branch March 3, 2023 07:30
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants