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

Add indexer to fakeCilent when bumping k8s.io deps to v0.26.1 #588

Merged
merged 4 commits into from
Feb 22, 2023

Conversation

kerthcet
Copy link
Contributor

@kerthcet kerthcet commented Feb 20, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #586

Special notes for your reviewer:

The test error was introduced in kubernetes-sigs/controller-runtime#2025, for fakeClient will check the indexes but we didn't register any in unit tests.

But we can register these indexes when building the client.

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Feb 20, 2023
@netlify
Copy link

netlify bot commented Feb 20, 2023

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 644cbee
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/63f644ab20823e00083e21cd

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 20, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 20, 2023
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

/lgtm

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

can you bump all the k8s libraries together?

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 21, 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 Feb 21, 2023
@kerthcet
Copy link
Contributor Author

/retest

Signed-off-by: Kante Yin <kerthcet@gmail.com>
@kerthcet kerthcet changed the title Bump k8s.io/api to v0.26.1 Bump k8s.io deps to v0.26.1 Feb 22, 2023
@kerthcet
Copy link
Contributor Author

The test error was introduced in kubernetes-sigs/controller-runtime#2025, for fakeClient will check the indexes but we didn't register any in unit tests.

@kerthcet
Copy link
Contributor Author

But we can register these indexes when building the client.

@kerthcet kerthcet changed the title Bump k8s.io deps to v0.26.1 Add indexer when building fakeClient after bumping k8s.io deps to v0.26.1 Feb 22, 2023
@kerthcet kerthcet changed the title Add indexer when building fakeClient after bumping k8s.io deps to v0.26.1 Add indexer when building fakeClient Feb 22, 2023
@kerthcet kerthcet changed the title Add indexer when building fakeClient Add indexer to fakeCilent when bumping k8s.io deps to v0.26.1 Feb 22, 2023
Signed-off-by: Kante Yin <kerthcet@gmail.com>
Signed-off-by: Kante Yin <kerthcet@gmail.com>
pkg/util/testing/client.go Show resolved Hide resolved
)

var (
IndexQueueClusterQueue = func(obj client.Object) []string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These index functions both used in package cache and queue, so moved to util/indexer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should just have a single SetupIndexes function for the kueue APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean have only one setupIndexes() in main.go? Not separated into different packages like queue, cache, job.

Copy link
Contributor

Choose a reason for hiding this comment

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

probably not in main.go, because the tests need it. But yes, a single place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me make this cleanup tomorrow. We can leave this a follow up if that's ok with you.

Copy link
Contributor

Choose a reason for hiding this comment

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

sg

@kerthcet
Copy link
Contributor Author

Yes, the test error fixed.

pkg/util/testing/client.go Outdated Show resolved Hide resolved
pkg/util/indexer/indexer.go Outdated Show resolved Hide resolved
pkg/util/testing/client.go Outdated Show resolved Hide resolved
pkg/util/indexer/indexer.go Outdated Show resolved Hide resolved
pkg/constants/constants.go Outdated Show resolved Hide resolved
pkg/util/testing/client.go Outdated Show resolved Hide resolved
)

var (
IndexQueueClusterQueue = func(obj client.Object) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should just have a single SetupIndexes function for the kueue APIs.

pkg/util/testing/client.go Outdated Show resolved Hide resolved
Signed-off-by: Kante Yin <kerthcet@gmail.com>
@kerthcet
Copy link
Contributor Author

All addressed except #588 (comment).

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Thanks!
LGTM from my side.

return []string{string(q.Spec.ClusterQueue)}
}

IndexWorkloadQueue = func(obj client.Object) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
IndexWorkloadQueue = func(obj client.Object) []string {
func IndexWorkloadQueue(obj client.Object) []string {

why overcomplicate things :)

Copy link
Member

@tenzen-y tenzen-y Feb 22, 2023

Choose a reason for hiding this comment

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

I agree.
@kerthcet Can you follow up with another PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

The follow up PR will just move the entire SetupIndexes functions here.

Copy link
Member

Choose a reason for hiding this comment

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

sgtm.

Copy link
Contributor

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, kerthcet

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 Feb 22, 2023
@alculquicondor
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 22, 2023
@k8s-ci-robot k8s-ci-robot merged commit 58fc339 into kubernetes-sigs:main Feb 22, 2023
@alculquicondor
Copy link
Contributor

@kerthcet we can also get rid of checks like this:

// Checking queue name again because the field index is not available in tests.

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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants