-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🌱 Avoid using deprecated client.Patch method #12737
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR is currently missing an area label, which is used to identify the modified component when generating release notes. Area labels can be added by org members by writing Please see the labels list for possible areas. 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. |
Only need to update the methods in managedfields_test.go file like
Is it recommended to convert structured to unstructured before using Apply? |
@@ -410,9 +410,9 @@ func (r *CRDMigrator) reconcileStorageVersionMigration(ctx context.Context, crd | |||
log.V(4).Info("Migrating to new storage version", gvk.Kind, klog.KObj(u)) | |||
var err error | |||
if migrationConfig.UseStatusForStorageVersionMigration { | |||
err = r.Client.Status().Patch(ctx, u, client.Apply, client.FieldOwner("crdmigrator")) | |||
err = r.Client.Status().Patch(ctx, u, client.Apply, client.FieldOwner("crdmigrator")) //nolint:staticcheck // currently client.Client.Apply() does not support updating Status subresource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the only way to update status via a deprecated method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what I thought by reading this kubernetes-sigs/controller-runtime#3307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to link to the c-r ticket and leave a TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, Added the CR issue link.
@@ -673,7 +673,6 @@ func TestMachineDeploymentReconciler_CleanUpManagedFieldsForSSAAdoption(t *testi | |||
|
|||
// Create one using SSA. | |||
g.Expect(env.Patch(ctx, ssaManagerMS, client.Apply, client.FieldOwner(machineDeploymentManagerName), client.ForceOwnership)).To(Succeed()) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this whitespace change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake will revert back. Thanks.
fc4e1e6
to
2550538
Compare
What this PR does / why we need it:
This PR contains the changes remove usage of deprecated client.Patch method
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes # Part of 12695