From 00a3bb11c413d14c81cc8b1fbec05589e28e99ff Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Fri, 14 Nov 2025 14:32:07 -0500 Subject: [PATCH] improved comment wording Signed-off-by: Austin Abro --- pkg/kube/client.go | 4 ++-- pkg/kube/client_test.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index a3c731249..d383ef5fc 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -1101,8 +1101,8 @@ func patchResourceServerSide(target *resource.Info, dryRun bool, forceConflicts WithFieldManager(getManagedFieldsManager()). WithFieldValidation(string(fieldValidationDirective)) - // Kubernetes looks at the server side state when evaluating conflicts in field manager rather than the field manager field in the request - // therefore when using the Apply operation you cannot define managedFields in the body of the request that you submit + // Kubernetes looks at the state of the object in the cluster when evaluating conflicts in field manager rather than the object in the request + // therefore when using the Apply operation we cannot define managedFields in the body of the request that we submit // This is according to https://kubernetes.io/docs/reference/using-api/server-side-apply/#apply-and-update if u, ok := target.Object.(*unstructured.Unstructured); ok { u.SetManagedFields(nil) diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index d14000e4f..a2aad1c5d 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -2244,10 +2244,9 @@ func TestPatchResourceServerSide_ClearsManagedFields(t *testing.T) { Client: fakeClient, } - // Call patchResourceServerSide err := patchResourceServerSide(target, false, false, FieldValidationDirectiveStrict) require.NoError(t, err) - // Verify the patched data doesn't contain managedFields - assert.NotContains(t, string(patchedData), "managedFields", "patched data should not contain managedFields") + // Verify the data that the fake client received did not container managedFields + assert.NotContains(t, string(patchedData), "managedFields") }