-
Notifications
You must be signed in to change notification settings - Fork 270
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
fix: Server side diff now works correctly with some fields removal #640
fix: Server side diff now works correctly with some fields removal #640
Conversation
0f7c3cb
to
f761215
Compare
f761215
to
f171197
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open an Argo CD PR to test this? Is there a way to test the higher-level bug in Argo CD so we have coverage of both the gitops-engine behavior and of the user-facing bug?
I'll do the testing. |
f171197
to
d6cc3eb
Compare
ArgoCD PR argoproj/argo-cd#20842, tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check my comment.
d6cc3eb
to
d4b29ea
Compare
@crenshaw-dev, I've addressed your comments. Code Analysis complains that configs are not perfect, but that's okay since they aren't deployed anywhere. |
@andrii-korotkov-verkada wanna try adding this to a new sonar-project.properties file in the root of the repo? # Exclude test manifests from analysis
sonar.kubernetes.exclusions=pkg/diff/testdata/** |
Per discussion with @leoluz, I'd spend more time to understand why the Structured Merge Diff library's Merge doesn't derive key fields from paths, since the info is available. I may submit a ticket to their community with a request to update the library. |
I've filed kubernetes-sigs/structured-merge-diff#273 |
d4b29ea
to
e881697
Compare
Structured-merge-diff PR with the fix is now merged: |
Helps with argoproj/argo-cd#20792 Removed and modified sets may only contain the fields that changed, not including key fields like "name". This can cause merge to fail, since it expects those fields to be present if they are present in the predicted live. Fortunately, we can inspect the set and derive the key fields necessary. Then they can be added to the set and used during a merge. Also, have a new test which fails before the fix, but passes now. Failure of the new test before the fix ``` Error: Received unexpected error: error removing non config mutations for resource Deployment/nginx-deployment: error reverting webhook removed fields in predicted live resource: .spec.template.spec.containers: element 0: associative list with keys has an element that omits key field "name" (and doesn't have default value) Test: TestServerSideDiff/will_test_removing_some_field_with_undoing_changes_done_by_webhook ``` Signed-off-by: Andrii Korotkov <[email protected]>
Signed-off-by: Andrii Korotkov <[email protected]>
Signed-off-by: Andrii Korotkov <[email protected]>
4add644
to
91c72b1
Compare
sonar-project.properties
Outdated
@@ -0,0 +1,2 @@ | |||
# Exclude test manifests from analysis | |||
sonar.kubernetes.exclusions=pkg/diff/testdata/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Andrii Korotkov <[email protected]>
Quality Gate passedIssues Measures |
Confirmed with Michael over Slack
Helps with argoproj/argo-cd#20792
Removed and modified sets may only contain the fields that changed, not including key fields like "name". This can cause merge to fail, since it expects those fields to be present if they are present in the predicted live. Fortunately, structured merge diff folks have added an option to extracting items to add key fields, and we are going to use that.
Failure of the new test before the fix