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
When I using CreateThreeWayMergePatch to genernate patch, I found a strange behaviors
// original
{
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "test",
"namespace": "ns",
"annotations": null
}
}
// modified // same as original
{
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "test",
"namespace": "ns",
"annotations": null
}
}
// current // do some change based on original
{
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "test",
"namespace": "ns",
"annotations": {
"a": "a1"
}
}
}
after invoke CreateThreeWayMergePatch, it will generate a patch like that {"metadata":{"annotations":null}}, just not preserve the change on annotations.
My Question is: "why does it not preserve annotations changes? is this expected?"
This seems to easily lead to the following conflicts
controller 1: reconcile resources as expected (same as original)
controller 2: add some annotations
controller 1: reconcile resources as expected (same as original) : clean all annotations.
when expected annotations is nil: patch: {"metadata":{"annotations":null}}
when expected annotations is empty: patch: {}
The text was updated successfully, but these errors were encountered:
chengjingtao
changed the title
why does it not preserve changes when invoke CreateThreeWayMergePatch function with nil annotations
[Question] why does it not preserve changes when invoke CreateThreeWayMergePatch function with nil annotations
Mar 29, 2024
When I using CreateThreeWayMergePatch to genernate patch, I found a strange behaviors
after invoke
CreateThreeWayMergePatch
, it will generate a patch like that{"metadata":{"annotations":null}}
, just not preserve the change on annotations.My Question is: "why does it not preserve annotations changes? is this expected?"
This seems to easily lead to the following conflicts
the code is here
result is :
The text was updated successfully, but these errors were encountered: