-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Concurrent updates on annotations and labels in Kubernetes Dashboard cause unintended data loss #9516
Comments
You are right. We are preparing data for the three-way merge patch incorrectly. We also need to fetch the original resource from the API that matches the resource version of the object coming in the request. This way we will have the original, latest, and changed resource so that the three-way merge patch will know if the data added in between should be removed or not. |
@floreks I think only the two-way mege patch is needed. Original: front-end page data, Edited: the user modified data, the two make a Diff, and then send the patches to apiserver.
|
@floreks If in your way, assuming that the user A deletes the field Results derived according to the following code:
original: foo+, hello-
addition-and-change patch between current and modified: |
EDIT: oh wait, scratch that. They are doing addition between current and modified. This can cause issues then. |
@floreks Yes, look at the following code: ![]() |
What happened?
Description:
We encountered an issue when multiple users make concurrent updates to the same resource in Kubernetes Dashboard, specifically when one user modifies the
annotations
and another modifies thelabels
without refreshing the dashboard or re-fetching the latest resource version.Actual behavior:
After User B submits the changes, only the label (
hello: world
) is reflected in the final YAML. The annotation (foo: bar
) added by User A is lost, leading to unintended data loss.Root Cause:
This appears to be a classic case of a "last writer wins" issue. When User B submits their changes, the YAML they are editing does not contain the latest version of the resource, which leads to the annotation added by User A being overwritten.
Impact:
This issue can cause critical changes (such as annotations used for configurations, selectors, or application metadata) to be unintentionally lost, leading to potential operational problems.
What did you expect to happen?
Both users' changes should be merged, with the final YAML containing both the updated
annotations
andlabels
. In this case:foo: bar
hello: world
How can we reproduce it (as minimally and precisely as possible)?
foo: bar
, and submits the change.label
(e.g.,hello: world
) based on the outdated YAML (which doesn't include A's changes).Anything else we need to know?
No response
What browsers are you seeing the problem on?
Chrome
Kubernetes Dashboard version
dashboard-api:1.7.0,dashboard-auth:1.1.3,dashboard-metrics-scraper:1.1.1,dashboard-web:1.4.0,kong:3.6
Kubernetes version
v1.22.15
Dev environment
No response
The text was updated successfully, but these errors were encountered: