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

FakeClient patch on any subresource other than status is not working #2503

Closed
acumino opened this issue Sep 19, 2023 · 4 comments · Fixed by #2508
Closed

FakeClient patch on any subresource other than status is not working #2503

acumino opened this issue Sep 19, 2023 · 4 comments · Fixed by #2508
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@acumino
Copy link
Contributor

acumino commented Sep 19, 2023

FakeClient patch on any subresource other than status is not working.

For identifying if the last patch call was to update the status sub resource here we check if the stack trace has sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeSubResourceClient).Patch, and if true only allow to update status.
This is wrong as sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeSubResourceClient).Patch will be present in the stack trace if a patch is done on any subresource.

For ex, Patching scale subresource in deployment will also have sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeSubResourceClient).Patch in the stack trace because of which the code above will identify it as a status subresource update call and will not allow spec(replica) change in deployment.

Issues introduced with #2259
controller-runtime version - v0.16.2

@acumino
Copy link
Contributor Author

acumino commented Sep 19, 2023

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 19, 2023
@acumino
Copy link
Contributor Author

acumino commented Sep 22, 2023

/cc @alvaroaleman

@alvaroaleman
Copy link
Member

Feel free to take a stab at it

@acumino
Copy link
Contributor Author

acumino commented Sep 22, 2023

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants