Skip to content

ManagedFieldsObjectTracker: Reload scheme#132004

Merged
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
alvaroaleman:fix-fasf
May 29, 2025
Merged

ManagedFieldsObjectTracker: Reload scheme#132004
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
alvaroaleman:fix-fasf

Conversation

@alvaroaleman
Copy link
Member

@alvaroaleman alvaroaleman commented May 28, 2025

In controller-runtime it is generally not expected to do any sort of scheme registration if unstructured.Unstructured is used. To make this work in the fakeclient, the fakeclient will register unstructured to the scheme if the scheme doesn't recognize the GVK.

This currently doesn't work with the ManagedFieldsObjectTracker as it never reloads the scheme. This change makes it reload the scheme in an inefficient but simple manner, which should be good enough for unit tests.

This change is required in order for controller-runtime to support SSA in the fakeclient, ref kubernetes-sigs/controller-runtime#2981

/sig api-machinery
/assign @jpbetz @sttts

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


In controller-runtime it is generally not expected to do any sort of
scheme registration if unstructured.Unstructured is used. To make this
work in the fakeclient, the fakeclient will register unstructured to
scheme if the scheme doesn't recognize the GVK.

This currently doesn't work with the `ManagedFieldsObjectTracker` as it
never reloads the scheme. This change makes it reload the scheme in an
inefficient but simple manner, which should be good enough for unit
tests.
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 28, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label May 28, 2025
@k8s-ci-robot k8s-ci-robot requested review from soltysh and yliaog May 28, 2025 15:28
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 28, 2025
@jpbetz
Copy link
Contributor

jpbetz commented May 29, 2025

/lgtm
/approve

Thanks @alvaroaleman !

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

LGTM label has been added.

DetailsGit tree hash: 70ebd4c00a3477ea1999db5fcb41b43890b6eb5d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, jpbetz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 May 29, 2025
@alvaroaleman
Copy link
Member Author

/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels May 29, 2025
@k8s-ci-robot k8s-ci-robot merged commit c5c87bd into kubernetes:master May 29, 2025
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.34 milestone May 29, 2025
@alvaroaleman alvaroaleman deleted the fix-fasf branch May 29, 2025 23:59
@howardjohn
Copy link
Contributor

Even though this is primarily used for testing, the performance with this change is poor enough that its actually impacting our tests.

We have a test that creates 5000 objects.

Before: TestLargeCollection (1.41s)
With this PR: TestLargeCollection (11.72s)

is there some compromise we can come to here on this?

@alvaroaleman
Copy link
Member Author

We could update this to allow configuring a mapper constructor func

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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants