* fix(cherry-pick): regression on creationTimestamp with server-side diff
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* add diff test
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* format
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Using live obj to get the resource key if not nil
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Fixed failing unit tests
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Added test case for validating cluster scoped resources with ApplyOutOfSyncOnly=true
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Fixed gofumpt formatting errors
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Corrected unit tests for cluster scoped resources
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Removed unwanted code comments
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Added comments for explaining the reason why ns is set from live object
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Added comments in the unit test
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
---------
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* WIP fix: update normalization for ignoreDifferences on server-side diff
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix linter
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* refactor
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* skip pre-normalization for ssd
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* skip pre-normalization for ssd
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* docs
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* modify Normalize to skip ignoreDifferences conditionally
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* ignoreDifferences for SSD and test backwards compatible
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* rename flags for clarity
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* doc change
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Revert "Add option to skip the dryrun from the sync context (#708)"
This reverts commit 717b8bfd69.
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* format
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
* feat: auto migrate kubectl-client-side-apply fields for SSA
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix master version
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* run gofumpt
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Propagate sync error instead of logging
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* allow enable/disable of CSA migration using annotation
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix linting
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Refactor to allow for multiple managers and disable option
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* remove commentj
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* refactor
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix test
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Add docs for client side apply migration
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Edit comment
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* chore: wrap errors
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* report list result along with error
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fixes
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: Server-Side diff removed fields missing in diff
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* add unit test to cover deleted field
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix: go mod tidy is not working due to k8s.io/externaljwt dependency
Signed-off-by: pasha <pasha.k@fyxt.com>
* feat: Enable SkipDryRunOnMissingResource sync option on Application level
Signed-off-by: pasha <pasha.k@fyxt.com>
* feat: Enable SkipDryRunOnMissingResource sync option on Application level
* feat: add support for skipping dry run on missing resources in sync context
- Introduced a new option to skip dry run verification for missing resources at the application level.
- Updated the sync context to include a flag for this feature.
- Enhanced tests to cover scenarios where the skip dry run annotation is applied to all resources.
---------
Signed-off-by: pasha <pasha.k@fyxt.com>
Co-authored-by: pasha <pasha.k@fyxt.com>
* Add option to skip the dryrun from the sync context
Signed-off-by: Nick Heijmink <nick.heijmink@alliander.com>
* Fix test by mocking the discovery
Signed-off-by: Nick Heijmink <nick.heijmink@alliander.com>
* Fix linting errors
Signed-off-by: Nick Heijmink <nick.heijmink@alliander.com>
* Fix skip dryrun const
---------
Signed-off-by: Nick Heijmink <nick.heijmink@alliander.com>
* Add GetResourceImages
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Use require instead of assert
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Add test for empty images case
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Rename test function to match regex
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Add support for conjobs, refactor images implementation and add test for cronjobs
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Move missing images tests to single function
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Refactor test
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Add benchmark for sync
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
* Update comment on images
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
---------
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: properly check dryRun flag for server side apply
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Remove debug logging
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* fix: Server-side diff shows incorrect diffs for list related changes
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Update docs for removeWebHookMutation
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Update docs
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
* Update docs
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
---------
Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
map[] in error output exposes secret data in last-applied-annotation
& patch error
Invalid secrets with stringData exposes the secret values in diff. Attempt a
normalization to prevent it.
Refactor stringData to data conversion to eliminate code duplication
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* fix: Server side diff now works correctly with some fields removal
Helps with https://github.com/argoproj/argo-cd/issues/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 <andrii.korotkov@verkada.com>
* Use new version of structured merge diff with a new option
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
* Add DCO
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
* Try to fix sonar exclusions config
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
---------
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
* fix: Ability to disable Server Side Apply on individual resource level
Signed-off-by: pashakostohrys <pavel@codefresh.io>
* fix: Ability to disable Server Side Apply on individual resource level
Signed-off-by: pashakostohrys <pavel@codefresh.io>
---------
Signed-off-by: pashakostohrys <pavel@codefresh.io>