* chore: simplify sync status comparison
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* add tests
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* more tests, some docs
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* add lastTransitionTime to health status
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* address first feedback
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* set transition time if health status is unknown
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* extend health improvement tests
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* add apoplication controller test
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* use require for NoError
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* more extensive tests for health state changes
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* Apply suggestions from code review
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Manuel Kieweg <2939765+mkieweg@users.noreply.github.com>
* Code review suggestions
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* remove obsolete assert
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
* Change LastTransitionTime field to pointer type
Due to implementation limitations, setting LastTransitionTime at the resource level is challenging.
Converting it to a pointer type allows it to be skipped at the resource level and prevents it from appearing
in .status.resources of the Application CR. Additionally, it doesn’t provide much value or have a known
use case right now.
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* Resolve rebase conflicts
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* Address review comment
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* Trigger CI
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
---------
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
Signed-off-by: Manuel Kieweg <2939765+mkieweg@users.noreply.github.com>
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Siddhesh Ghadi <sghadi1203@gmail.com>
* fixed doc comments and added unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added comments for the newly added unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Refactored method name to deriveServiceAccountToImpersonate
Signed-off-by: anandf <anjoseph@redhat.com>
* Using const name in return value
Signed-off-by: anandf <anjoseph@redhat.com>
* Added unit tests for argocd proj add-destination-service-accounts
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failing e2e tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Fix linting errors
Signed-off-by: anandf <anjoseph@redhat.com>
* Using require package instead of assert and fixed code generation
Signed-off-by: anandf <anjoseph@redhat.com>
* Removed parallel execution of tests for sync with impersonate
Signed-off-by: anandf <anjoseph@redhat.com>
* Added err checks for glob validations
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed e2e tests for sync impersonation
Signed-off-by: anandf <anjoseph@redhat.com>
* Using consistently based expects in E2E tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added more unit tests and fixed go generate
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failed lint errors, unit and e2e test failures
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed goimports linter issue
Signed-off-by: anandf <anjoseph@redhat.com>
* Added code comments and added few missing unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added missing unit test for GetDestinationServiceAccounts method
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed goimports formatting with local for project_test.go
Signed-off-by: anandf <anjoseph@redhat.com>
* Corrected typo in a field name additionalObjs
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failing unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
---------
Signed-off-by: anandf <anjoseph@redhat.com>
* feat: option to disable writing k8s events
optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
* feat: option to disable writing k8s events
fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
* rebase
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
---------
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
Closes#13096
Implement a new metric exposing Applications conditions.
This is particularly useful for SRE teams to be able
to setup alerts on issues that aren't displayed via
"health_status" and "sync_status" in the metric "argocd_app_info".
Signed-off-by: Foyer Unix <foyerunix@foyer.lu>
Co-authored-by: Foyer Unix <foyerunix@foyer.lu>
* fix(controller): selfHeal respected in multi-source apps
when there is object change in cluster
Signed-off-by: Eric Lin <38420555+Ezzahhh@users.noreply.github.com>
* fix: tests for multi source selfheal
Signed-off-by: Ezzahhh <38420555+Ezzahhh@users.noreply.github.com>
---------
Signed-off-by: Eric Lin <38420555+Ezzahhh@users.noreply.github.com>
Signed-off-by: Ezzahhh <38420555+Ezzahhh@users.noreply.github.com>
Closes#18929
Helps with #18500
Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic.
Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
* fix: status.sync.comparedTo should use replace patch strategy
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
* add e2e tests
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
---------
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
* feat(sharding): use a cache
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
* cluster cmd
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
* - Assign shard 0 to in-cluster cluster and nil check updates
- Caching clusters while sharding: Fixing unit tests
- Update generated docs
- Debug e2e tests
- Default the shardNumber to the number of replicas if it is calculated to a higher value
- defered Unlock only when a lock is set
- Disabling temporarly other versions of k3s to check if e2e passes
- Do not fail if hostname format is not abc-n
- Fix unit test and skip some e2e
- Skip TestGitSubmoduleHTTPSSupport test
- Remove breaking defer c.lock.Unlock()
- Reverting testing all k3s version
- Default sharding fix
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* fixes related to code review: renaming structure param, moving db initialisation
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Code review
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Set default shard to 0
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Set different default value for Sts and Deployment mode
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Expose ClusterShardingCache
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Removing use of argoDB.db for DistributionFunction
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Update generated documentation
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Fix comment about NoShardingDistributionFunction and NoShardingAlgorithm
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
---------
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Co-authored-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
* feat: PostDelete hooks support
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
---------
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
* fix(controller): log failed attempts to update operation state
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* new package name
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* Update controller/appcontroller_test.go
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: trigger refresh on changed ignoreDifferences
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* make the tests mean things
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: retain order of revisions for multi source apps (#14108)
Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
* fix: retain revision for multi source app with ref-repos
Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
* calculate commitSHA before quitting manifest generation
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: Extraction of DistributionFunction to allow passing different type of functions to filter clusters by shard
- Adding unit tests for sharding
- Refresh clusters list on DistributionFunction call
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
* fix: Incorrect conversion of an integer with architecture-dependent bit size from [strconv.Atoi](1) to a lower bit size type uint32 without an upper bound check.
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Added config to switch to round-robin sharding
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Documenting sharding more, adding shuffling tests (skipped), re-enable sharding algo env var
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* Allow configuration through argocd-cmd-params-cm configMap and key: controller.sharding.algorithm
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
* De-duplicate code, remove reflection for default case, shorten distribution methods name, ran codegen on manifests
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
---------
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Co-authored-by: Raghavi Shirur <raghaviss11@gmail.com>
Signed-off-by: Kevin Huber <kevin.huber@hotmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: update managed namespace metadata
This commit fixes an issue where a namespace does not get updated
unless a sync is performed. Since the `managedNamespaceMetadata` is not
a part of the Application Git state, we need a way to force a sync once
the metadata has changed. In order to do that, we need to add state
to compare with.
Once a sync is performed, the `ManagedNamespaceMetadata` gets copied
to `SyncResult`, which will then be compared with on subsequent syncs.
If there's a mismatch between
`app.Spec.SyncPolicy.ManagedNamespaceMetadata` and
`app.Status.OperationState.SyncResult.ManagedNamespaceMetadata` we mark
the Application as `OutOfSync`.
Fixes#12661.
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: nil check
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: allow empty apps to be updated
If an app is empty but still differs in terms of
`managedNamespaceMetadata`, it should still be kept up to date.
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* test: add unit tests in appcontroller
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* fix: rebase
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* refactor: extract method
Consolidate checks to `app.HasChangedManagedNamespaceMetadata()`
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
* chore: make codegen
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
---------
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
At the time of making this commit, the package `github.com/ghodss/yaml`
is no longer actively maintained.
`sigs.k8s.io/yaml` is a permanent fork of `ghodss/yaml` and is actively
maintained by Kubernetes SIG.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* fix: evaluate all possible refresh reasons for multi-source apps (#12379)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* remove redundant parentheses
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* tests
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* don't auto-sync, it makes tests flaky
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* auto-sync because sync CLI doesn't work for multi-source apps
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* don't require out-of-sync - app may sync quickly
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* timeout 60
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix timeout
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: ChangZhuo Chen (陳昌倬) <czchen@czchen.org>
add test
Signed-off-by: CI <350466+crenshaw-dev@users.noreply.github.com>
better comment
Signed-off-by: CI <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: CI <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>