feat: use server side apply for dry runs where possible
Hi, excited to say this is my first PR to the argoproj. This PR proposes a solution to issue https://github.com/argoproj/gitops-engine/issues/631. I am very happy to write up this proposal more formally in a design doc, comment to an existing issue or a new one if preferred - please let me know if any preference.
Proposal This PR proposes that Dry Run syncs leverage server side apply for rich validation and feedback in the spirit of shifting left. For us at least, this would be very useful to improve parity of feedback between pre merge and post merge CI builds - surfacing feedback from various validation webhooks and policies.
Notably server side apply dry runs and the auto-create namespace feature are not compatible - the server side dry run feedback would just fail that the namespace does not exist. Therefore this PR proposes that in this case we fall back to client side apply.
alternatives
I see 2 alternatives:
-
return an error to the user if a sync is performed where: server side apply is enabled, dry run is enabled, auto namespace creation is enabled. This approach would have the benefit of not being misleading (with the current proposal it is not obvious that a client side apply is being used as a fallback )
-
do nothing and stick with client side apply. I would like to advocate strongly against this route as server side apply has the potential to give much richer feedback to users. At least for us there is a lot of value in using server side apply for dry runs with the amount of validation policies and so forth we have.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 53.86%. Comparing base (
8849c3f) to head (bd6cd7c). Report is 46 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #725 +/- ##
==========================================
- Coverage 54.26% 53.86% -0.41%
==========================================
Files 64 64
Lines 6164 6500 +336
==========================================
+ Hits 3345 3501 +156
- Misses 2549 2726 +177
- Partials 270 273 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
The gitops-engine repository is migrating to https://github.com/argoproj/argo-cd.
Can you please update the PR by resolving the conflicts / If it's not relevant anymore, feel free to close it You can always re-open it when the migration is over