Skip to content
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: calculate SSA diffs with smd.merge.Updater #467

Merged
merged 8 commits into from
Oct 4, 2022

Conversation

leoluz
Copy link
Contributor

@leoluz leoluz commented Sep 28, 2022

This PR introduces a different strategy to calculate diffs while using server-side apply.
The new approach will delegate all diff calculation logic to the merge.Updater.Apply function in the structured-merge-diff k8s library.

The previous implementation was naive and was missing many edge cases already addressed by merge.Updater.Apply.

However, merge.Updater.Apply has a hard to solve dependencies requirements. In order to provide the necessary dependencies, this PR borrows code from the k8s api-server which is properly documented in the pkg.diff.internal.fieldmanager package (see doc.go).

Fix argoproj/argo-cd#10627

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Base: 55.40% // Head: 55.46% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (6a5b081) compared to base (3951079).
Patch coverage: 64.15% of modified lines in pull request are covered.

❗ Current head 6a5b081 differs from pull request most recent head b585433. Consider uploading reports for the commit b585433 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #467      +/-   ##
==========================================
+ Coverage   55.40%   55.46%   +0.06%     
==========================================
  Files          41       41              
  Lines        4480     4504      +24     
==========================================
+ Hits         2482     2498      +16     
- Misses       1807     1813       +6     
- Partials      191      193       +2     
Impacted Files Coverage Δ
pkg/diff/diff.go 61.09% <64.15%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

k8s

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

lgtm! Gonna ask @alexmt for a review, mostly for awareness.

@crenshaw-dev
Copy link
Member

Leo spoke with Alex about this change at ArgoCon, so I'm comfortable merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using master and server-side-apply I get a inline-diff for resources: {} for all my apps
4 participants