You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jsonMergePatch operations use Fabric8 JSON Patch semantics and can remove spec #3512
ResourceOperations.jsonMergePatch(...) and ResourceOperations.jsonMergePatchPrimary(...) are documented as applying RFC 7386 JSON Merge Patch, but they delegate to Fabric8's no-context .patch() method.
Fabric8's default .patch() intentionally fetches the current resource and computes an RFC 6902 JSON Patch diff. When the supplied resource is a partial metadata patch, the generated diff removes fields that are omitted from the partial object, including spec.
The status variants are not affected because Fabric8's patchStatus() explicitly selects PatchType.JSON_MERGE.
Versions verified
Java Operator SDK 5.3.5 with Fabric8 7.7.0
Java Operator SDK 5.5.0 with Fabric8 7.8.0
The behavior is still present in the current main branch.
For a CRD whose root spec is optional, the API server accepts the patch and permanently removes the spec. We encountered this in a real controller where subsequent reconciliation failed because getSpec() returned null.
Expected behavior
Methods named and documented as JSON Merge Patch should send application/merge-patch+json and preserve fields omitted from the partial resource.
Relevant implementation
JOSDK 5.5.0 delegates to .patch() without specifying a patch type:
Make the non-status JSON Merge Patch operations pass an explicit patch context, for example:
r -> context.getClient()
.resource(r)
.patch(PatchContext.of(PatchType.JSON_MERGE), r)
The cache and own-event filtering behavior can remain unchanged. Regression coverage should create a complete resource, apply a partial metadata merge patch, and assert that spec survives.
Activity
csviri commentedon Jul 23, 2026
Hi @brianzilliz , thank you for reporting this, would you care also to create a PR?