* 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>
* 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: 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: 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>
* sync.Reconcile: guard against incomplete discovery
When Reconcile performs its logic to compare the desired state (target
objects) against the actual state (live objects), it looks up each live
object based on a key comprised of data from the target object: API
group, API kind, namespace, and name. While group, kind, and name will
always be accurate, there is a chance that the value for namespace is
not. If a cluster-scoped target object has a namespace (because it
incorrectly has a namespace from its source) or the namespace parameter
passed into the Reconcile method has a non-empty value (indicating a
default value to use on namespace-scoped objects that don't have it set
in the source), AND the resInfo ResourceInfoProvider has incomplete or
missing API discovery data, the call to IsNamespacedOrUnknown will
return true when the information is unknown. This leads to the key being
incorrect - it will have a value for namespace when it shouldn't. As a
result, indexing into liveObjByKey will fail. This failure results in
the reconciliation containing incorrect data: there will be a nil entry
appended to targetObjs when there shouldn't be.
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
* Address code review comments
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
---------
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
* Prune resources in reverse of sync wave order
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* Use waveOverride var instead of directly patching live obj
Directly patching live objs results into incorrect wave ordering
as the new wave value from live obj is used to perform reordering during next sync
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
---------
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* Revert "feat: retry with client side dry run if server one was failed (#548)"
This reverts commit c0c2dd1f6f.
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Revert "fix(server): use server side dry run in case if it is server side apply (#546)"
This reverts commit 4a5648ee41.
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Fixed the logic to disable server side apply if it is a dry run
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Added more values in the log message for better debugging
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Fixed compilation error
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Written an inline fn to get string value of dry-run strategy
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* Added comment as requested with reference to the issue number
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
---------
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Co-authored-by: Leonardo Luz Almeida <leoluz@users.noreply.github.com>
* feat: retry with client side dry run if server one was failed
Signed-off-by: pashakostohrys <pavel@codefresh.io>
* feat: retry with client side dry run if server one was failed
Signed-off-by: pashakostohrys <pavel@codefresh.io>
* feat: retry with client side dry run if server one was failed
Signed-off-by: pashakostohrys <pavel@codefresh.io>
---------
Signed-off-by: pashakostohrys <pavel@codefresh.io>
* fix: use server side dry run in case if it is server side apply
Signed-off-by: pashakostohrys <pavel@codefresh.io>
* fix: use server side dry run in case if it is server side apply
Signed-off-by: pashakostohrys <pavel@codefresh.io>
---------
Signed-off-by: pashakostohrys <pavel@codefresh.io>
When doing `kubectl replace`, namespaces should not be affected. Fixes
argoproj/argo-cd#12810 and argoproj/argo-cd#12539.
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* Revert "Revert "feat: Ability to create custom labels for namespaces created … (#455)"
This reverts commit ce2fb703a6.
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* feat: enable namespace to be updated
Rename `WithNamespaceCreation` to `WithNamespaceModifier`, since this
method is also used for modifying existing namespaces. This method
takes a single argument for the actual updating, and unless this method
gets invoked by its caller no updating will take place (fulfilling what
the `createNamespace` argument used to do).
Within `autoCreateNamespace`, everywhere where we previously added tasks
we'll now need to check whether the namespace should be created (or
modified), which is now delegated to the `appendNsTask` and
`appendFailedNsTask` methods.
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: Only consider resources which supports appropriate verb for any given operation
Signed-off-by: jannfis <jann@mistrust.net>
* Fix unit tests
Signed-off-by: jannfis <jann@mistrust.net>
* Return MethodNotSupported and add some tests
Signed-off-by: jannfis <jann@mistrust.net>