improved comment wording

Signed-off-by: Austin Abro <austinabro321@gmail.com>
pull/31511/head
Austin Abro 11 months ago
parent fc15c11a08
commit 00a3bb11c4
No known key found for this signature in database
GPG Key ID: 533C18822161094C

@ -1101,8 +1101,8 @@ func patchResourceServerSide(target *resource.Info, dryRun bool, forceConflicts
WithFieldManager(getManagedFieldsManager()). WithFieldManager(getManagedFieldsManager()).
WithFieldValidation(string(fieldValidationDirective)) 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 // 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 you cannot define managedFields in the body of the request that you submit // 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 // 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 { if u, ok := target.Object.(*unstructured.Unstructured); ok {
u.SetManagedFields(nil) u.SetManagedFields(nil)

@ -2244,10 +2244,9 @@ func TestPatchResourceServerSide_ClearsManagedFields(t *testing.T) {
Client: fakeClient, Client: fakeClient,
} }
// Call patchResourceServerSide
err := patchResourceServerSide(target, false, false, FieldValidationDirectiveStrict) err := patchResourceServerSide(target, false, false, FieldValidationDirectiveStrict)
require.NoError(t, err) require.NoError(t, err)
// Verify the patched data doesn't contain managedFields // Verify the data that the fake client received did not container managedFields
assert.NotContains(t, string(patchedData), "managedFields", "patched data should not contain managedFields") assert.NotContains(t, string(patchedData), "managedFields")
} }

Loading…
Cancel
Save