Skip to content

📖 chore: Add explanatory comment for continuing to use json-patch v4 in the fake client #3118

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

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pkg/client/fake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ import (
"sync"
"time"

// Using v4 to match upstream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did upsream switch to v5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is meant by upstream?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see the comment in go.mod

// Using v4 to match upstream

Maybe we should add more details like linking #2643

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would definitely help. First I thought just asking a question about what upstream means. Also I would like to get e deeper understanding in upstream how the old v4 could be replaced.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. That's a question for k/k. I'm pretty sure there already were discussions about this. I just don't know where

/*
Stick with gopkg.in/evanphx/json-patch.v4 here to match
upstream Kubernetes code and avoid breaking changes introduced in v5.
- Kubernetes itself remains on json-patch v4 to avoid compatibility issues
tied to v5’s stricter RFC6902 compliance.
- The fake client code is adapted from client-go’s testing fixture, which also
relies on json-patch v4.
See:
https://github.com/kubernetes/kubernetes/pull/91622 (discussion of why K8s
stays on v4)
https://github.com/kubernetes/kubernetes/pull/120326 (v5.6.0+incompatible
missing a critical fix)
*/
jsonpatch "gopkg.in/evanphx/json-patch.v4"
appsv1 "k8s.io/api/apps/v1"
authenticationv1 "k8s.io/api/authentication/v1"
Expand Down Expand Up @@ -1138,7 +1150,7 @@ func (c *fakeClient) deleteObjectLocked(gvr schema.GroupVersionResource, accesso
}
}

//TODO: implement propagation
// TODO: implement propagation
return c.tracker.Delete(gvr, accessor.GetNamespace(), accessor.GetName())
}

Expand Down
Loading