Skip to content

Commit

Permalink
code-refactoring: Add resource mutation enhancements (argoproj-labs#1161
Browse files Browse the repository at this point in the history
)

* fix: don't set phase to available during host reconciliation  (argoproj-labs#918)

* upgrade golangci-lint

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* fix phase reconciliation during host reconciliation

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* address review comment

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* set phase to pending if ingress not found

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* update owners file (argoproj-labs#953)

* Move to only adding two roles for managed namespaces (argoproj-labs#954)

* Move to only adding two roles for managed namespaces
---------

Signed-off-by: Salem Elrahal <selrahal@redhat.com>
Co-authored-by: Salem Elrahal <selrahal@redhat.com>

* feat: expose operator metrics  (argoproj-labs#928)

Track and expose custom operator performance metrics 
---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* add build.os config for readthedocs (argoproj-labs#967)

* setup 0.8.0 (argoproj-labs#966)

* feat: Add conversion webhook for ArgoCD v1alpha1 to v1beta1 migration (argoproj-labs#964)

* Add ArgoCD v1beta1 & deprecate v1alpha1

- Add new ArgoCD v1beta1 api
- Mark ArgoCD v1alpha1 as deprecated & add back the removed sso fields
- Use server side validation for "kubectl apply" as client side results into
  failure due to exceeding annotation size limit.

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add funcs for ArgoCD alpha to beta conversion

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add conversion webhook

- Create webhook & setup webhook server on 9443
- Disable operator namespaced install via OLM so that OLM can handle certs for webhook server
- For manual install, user needs to explicitly configure cert manager to inject certs and enable
  webhook server in operator by setting env ENABLE_CONVERSION_WEBHOOK="true"

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Resolve local build issues

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Tweak webhook configs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Update operator installation docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add e2e tests

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Minor updates

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Fix go-lint ci failure

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Update docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Remove webhook from 0.7.0 bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add spaces in bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* update 0.8.0 bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* chore(deps): bump pygments from 2.7.4 to 2.15.0 in /docs (argoproj-labs#950)

Bumps [pygments](https://github.com/pygments/pygments) from 2.7.4 to 2.15.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](pygments/pygments@2.7.4...2.15.0)

---
updated-dependencies:
- dependency-name: pygments
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: upgrade RH-SSO from 7.5 to 7.6 (argoproj-labs#977)

* upgrade RH-SSO from 7.5 to 7.6

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix: failing tests

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix: failing tests

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

---------

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* refactor: Remove dead code (argoproj-labs#979)

* Remove dead code

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix import

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix imports

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Replace ArgoCD v1alpha1 references with v1beta1 (argoproj-labs#975)

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* refactor: Remove deprecated .spec.resourceCustomizations (argoproj-labs#973)

* Remove .spec.resourceCustomizations code

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Update docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Update docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Address review comments

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix typo

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* upgrade ArgoCD version to 2.8.2 and update the CRDs (argoproj-labs#984)

* upgrade ArgoCD version to 2.8.2 and update the CRDs

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Update argocd image

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

---------

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* chore: Update ArgoCD v1alpha1 deprecation message (argoproj-labs#988)

* Update ArgoCD v1alpha1 deprecation message

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Run code gen

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Add support for tls self signed certs in AppSet Gitlab SCM Provider (argoproj-labs#985)

* add support for tls self signed certs in AppSet Gitlab SCM Provider

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* add e2e test

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* add unit tests

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* renamed field ScmRootCaPath to SCMRootCaPath

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Add documentation and address comments

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Address comments

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

---------

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* chore(deps): bump github.com/argoproj/argo-cd/v2 from 2.8.2 to 2.8.3 (argoproj-labs#992)

Bumps [github.com/argoproj/argo-cd/v2](https://github.com/argoproj/argo-cd) from 2.8.2 to 2.8.3.
- [Release notes](https://github.com/argoproj/argo-cd/releases)
- [Changelog](https://github.com/argoproj/argo-cd/blob/master/CHANGELOG.md)
- [Commits](argoproj/argo-cd@v2.8.2...v2.8.3)

---
updated-dependencies:
- dependency-name: github.com/argoproj/argo-cd/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: pick up argo cd v2.8.3 (argoproj-labs#993)

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix: replace deprecated syntax in kustomization.yaml (argoproj-labs#1000)

Signed-off-by: minchao <minchao.220@gmail.com>

* Missing syntax-highlighting, toggle button for screen mode in argocd-operator docs (argoproj-labs#1002)

* Update requirements.txt

added markdown= 3.3.7 and  markdown-include=0.6.0

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* Delete docs/assets/extra.css

deleted extra.css

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* Update mkdocs.yml

added markdown_extension  markdown_include with  codehighlight and toggle for screen mode

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* Update mkdocs.yml

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

---------

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* fix: keycloak probes failure and intermittent perforamance issues (argoproj-labs#1007)

* fix: keycloak probes failure results in pod crash

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix: use latest keycloak image to handle performance issue

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

---------

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* bug: fix heathcheck subkey generation for resources with no group  (argoproj-labs#1013)

* account for empty group during resource customization config subkey generation

---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* chore(deps): bump golang.org/x/net from 0.11.0 to 0.17.0 (argoproj-labs#1019)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.11.0 to 0.17.0.
- [Commits](golang/net@v0.11.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add labelSelector option to filter the ArgoCD instances for reconciliation (argoproj-labs#961)

* Added labelselector string to map conversion

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Changed data-type for labelSelector to parse string

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Added code to reconcile selected ArgoCD instances based on label selector

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* remove comments

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Updated argoCD label fetch, renamed env var

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Updated unit test and yaml

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Updated unit test

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Fix yaml env ValueFrom field

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Added comments and labelSelector check in main.go

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* removed label-selector option from manifest

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* updated label-selector format in manifests

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* added label selector logs

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* go mod tidy

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* added e2e tests for label-selector

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* restructured kuttl files and added operator patch file

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* go mod tidy

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* corrected kuttl tests for cm failure

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Added documentation for Environment Variable ARGOCD_LABEL_SELECTOR

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* cleanup

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* improved unit tests and some minor changes

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* kuttl rerun

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* removed env var

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* misc modifications

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* argocd-operator csv correction

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* fix bundle error

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* fix bundle error

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* fix manifests build

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Added more unit test cases

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* rebase

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* removed excess reconcilers

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* minor fix

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* removed extraneous test case and cleaned manager.yaml

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* cleaned manager.yaml

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* fix make bundle issue

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* fix make bundle issue

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

---------

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Co-authored-by: ishitasequeira <ishiseq29@gmail.com>

* fix: address CVE-2023-39325 (argoproj-labs#1022)

*address CVE-2023-39325
- upgrade to golang v1.20.10 
- disable http/2 for webhook and metrics server, use http/1.1 by default but make it a configurable flag
- upgarde k8s library packages to v0.28.3
- Add new structs for keycloak API that were previously part of the (now deprecated) keycloak-operator repo 
- upgrade to controller-runtime to v0.16.3
- refactor all unit tests 

---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* Add gcp cherry-pick bot config (argoproj-labs#1023)

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Add .github/dependabot.yml to enable auto dependency version updates (argoproj-labs#1025)

* feat(dex): add optional env field (argoproj-labs#1005)

* feat(dex): add optional env field

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

* fix: remove non-default configuration

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

* fix: v1alpha1 is deprecated

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

* fix: convert dex spec between api versions

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

* fix: ensure there is no diff in the bundle

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

---------

Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>

* fix: replace deprecated AddToScheme with Install, and deprecated SchemeGroupVersion with GroupVersion. (argoproj-labs#1066)

Signed-off-by: Cheng Fang <cfang@redhat.com>

* allow enabling ArgoCD workloads independently (argoproj-labs#1021)

* allow enabling ArgoCD core workloads independently

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix lint

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* check for dependent component urls if dependent components are disabled

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix build

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix make bundle

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix tests

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Update flags for each component

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Update configuration using remote flag

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix CI

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Address comments

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Addressed feedback

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* update conversion webhook

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix make build

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

---------

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* chore(deps): bump argoproj/argocd in /build/util (argoproj-labs#1080)

Bumps argoproj/argocd from `d40da8f` to `644c386`.

---
updated-dependencies:
- dependency-name: argoproj/argocd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: upgrade Argo CD for release v.9.0 (argoproj-labs#1082)

* feat: upgrade Argo CD for release v.9.0

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix: unit test failures

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

---------

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>

* fix the logic for applicationset resources reconcilation when spec.applicationset.enabled is false (argoproj-labs#1089)

* fix the logic for applicationset resources reconciliation when spec.applicationset.enabled is false

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix tests

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* delete repo server when repo.enabled is set to false

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Update status.Phase based on component enabled flag

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Added kuttl tests

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Added namespace creation step

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* delete services created for resources

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* delete server deployment when enabled flag set to false

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix e2e test

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix log message

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* revert kuttl test timeout

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Added test for reverse scenario

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Dir rename

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

* Added e2e test for ha mode

Signed-off-by: Raghavi Shirur <rshirur@redhat.com>

---------

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Co-authored-by: Raghavi Shirur <rshirur@redhat.com>

* docs: enabling/disabling individual argocd core components (argoproj-labs#1098)

* Add documentation for enabling/disabling argocd core components

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* rephrase doc

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* Address comments

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

---------

Signed-off-by: ishitasequeira <ishiseq29@gmail.com>

* fix: Proper reference to where to find default admin password (argoproj-labs#1094)

Signed-off-by: ikegentz <isaac.gentz@gmail.com>

* adding applicationsets in server rbac policy rule (argoproj-labs#1140)

Signed-off-by: Mangaal <angommeeteimangaal@gmail.com>

* remove extra argoutils

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* add mutation args, instance ref, openshift mutations

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* change references

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* port mutation changes from redis branch

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* port changes to common constants

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
Signed-off-by: Salem Elrahal <selrahal@redhat.com>
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
Signed-off-by: minchao <minchao.220@gmail.com>
Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
Signed-off-by: Raghavi Shirur <rshirur@redhat.com>
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Signed-off-by: Robert Deusser <robertjdeusser@gmail.com>
Signed-off-by: Cheng Fang <cfang@redhat.com>
Signed-off-by: ikegentz <isaac.gentz@gmail.com>
Signed-off-by: Mangaal <angommeeteimangaal@gmail.com>
Co-authored-by: Regina Scott <50851526+reginapizza@users.noreply.github.com>
Co-authored-by: Salem Elrahal <salemelrahal@gmail.com>
Co-authored-by: Salem Elrahal <selrahal@redhat.com>
Co-authored-by: Siddhesh Ghadi <61187612+svghadi@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Abhishek Veeramalla <abhishek.veeramalla@gmail.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Co-authored-by: Minchao <minchao.220@gmail.com>
Co-authored-by: Suraj yadav <harrypotter1108@gmail.com>
Co-authored-by: Raghavi <rshirur@redhat.com>
Co-authored-by: ishitasequeira <ishiseq29@gmail.com>
Co-authored-by: Cheng Fang <cfang@redhat.com>
Co-authored-by: Robert Deusser <5935071+rdeusser@users.noreply.github.com>
Co-authored-by: Isaac Gentz <isaac.gentz@gmail.com>
Co-authored-by: Mangaal <44372157+Mangaal@users.noreply.github.com>
  • Loading branch information
16 people authored and Julia Teslia committed Apr 24, 2024
1 parent 118b4d5 commit e3ed08f
Show file tree
Hide file tree
Showing 29 changed files with 372 additions and 103 deletions.
43 changes: 43 additions & 0 deletions common/TOBEREMOVED.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,49 @@ const (

// ArgoCDNotificationsControllerComponent is the name of the Notifications controller control plane component
ArgoCDNotificationsControllerComponent = "argocd-notifications-controller"

ArgoCDDefaultRedisSuffix = "redis"

// ArgoCDRedisComponent is the name of the Redis control plane component
ArgoCDRedisComponent = "argocd-redis"

// ArgoCDRedisHAComponent is the name of the Redis HA control plane component
ArgoCDRedisHAComponent = "argocd-redis-ha"

// ArgoCDDefaultRedisPort is the default listen port for Redis.
ArgoCDDefaultRedisPort = 6379

// ArgoCDDefaultRedisImage is the Redis container image to use when not specified.
ArgoCDDefaultRedisImage = "redis"

// ArgoCDDefaultRedisSentinelPort is the default listen port for Redis sentinel.
ArgoCDDefaultRedisSentinelPort = 26379

// ArgoCDDefaultRedisVersion is the Redis container image tag to use when not specified.
ArgoCDDefaultRedisVersion = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine

// ArgoCDDefaultRedisVersionHA is the Redis container image tag to use when not specified in HA mode.
ArgoCDDefaultRedisVersionHA = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine

// ArgoCDDefaultRedisConfigPath is the default Redis configuration directory when not specified.
ArgoCDDefaultRedisConfigPath = "/var/lib/redis"

// ArgoCDDefaultRedisHAReplicas is the defaul number of replicas for Redis when rinning in HA mode.
ArgoCDDefaultRedisHAReplicas = int32(3)

// ArgoCDDefaultRedisHAProxyImage is the default Redis HAProxy image to use when not specified.
ArgoCDDefaultRedisHAProxyImage = "haproxy"

// ArgoCDDefaultRedisHAProxyVersion is the default Redis HAProxy image tag to use when not specified.
ArgoCDDefaultRedisHAProxyVersion = "sha256:7392fbbbb53e9e063ca94891da6656e6062f9d021c0e514888a91535b9f73231" // 2.0.25-alpine

// ArgoCDRedisHAProxyImageEnvVar is the environment variable used to get the image
// to used for the Redis HA Proxy container.
ArgoCDRedisHAProxyImageEnvVar = "ARGOCD_REDIS_HA_PROXY_IMAGE"

// ArgoCDRedisHAImageEnvVar is the environment variable used to get the image
// to used for the the Redis container in HA mode.
ArgoCDRedisHAImageEnvVar = "ARGOCD_REDIS_HA_IMAGE"
)

// DefaultLabels returns the default set of labels for controllers.
Expand Down
12 changes: 0 additions & 12 deletions common/envVars.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ const (
// to used for the Dex container.
ArgoCDRepoImageEnvVar = "ARGOCD_REPOSERVER_IMAGE"

// ArgoCDRedisHAProxyImageEnvVar is the environment variable used to get the image
// to used for the Redis HA Proxy container.
ArgoCDRedisHAProxyImageEnvVar = "ARGOCD_REDIS_HA_PROXY_IMAGE"

// ArgoCDRedisHAImageEnvVar is the environment variable used to get the image
// to used for the the Redis container in HA mode.
ArgoCDRedisHAImageEnvVar = "ARGOCD_REDIS_HA_IMAGE"

// ArgoCDRedisImageEnvVar is the environment variable used to get the image
// to used for the Redis container.
ArgoCDRedisImageEnvVar = "ARGOCD_REDIS_IMAGE"

// ArgoCDGrafanaImageEnvVar is the environment variable used to get the image
// to used for the Grafana container.
ArgoCDGrafanaImageEnvVar = "ARGOCD_GRAFANA_IMAGE"
Expand Down
5 changes: 5 additions & 0 deletions common/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,8 @@ const (
ArgoCDArgoprojKeyManagedByClusterArgoCD = "argocd.argoproj.io/managed-by-cluster-argocd"
>>>>>>> 01632c3 (code-refactoring: organize & rename constants to follow uniform format (#974))
)

// misc
const (
TLSSecretNameKey = "tls-secret-name"
)
83 changes: 59 additions & 24 deletions common/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package common

// names
const (
// ArgoCDRedisComponent is the name of the Redis control plane component
ArgoCDRedisComponent = "argocd-redis"
RedisController = "redis-controller"

// ArgoCDRedisHAComponent is the name of the Redis HA control plane component
ArgoCDRedisHAComponent = "argocd-redis-ha"
// RedisComponentName is the Redis control plane component
RedisComponent = "redis"

//ArgoCDDefaultRedisSuffix is the default suffix to use for Redis resources.
ArgoCDDefaultRedisSuffix = "redis"
HAProxyName = "haproxy"

// ArgoCDRedisHAConfigMapName is the upstream ArgoCD Redis HA ConfigMap name.
ArgoCDRedisHAConfigMapName = "argocd-redis-ha-configmap"
Expand All @@ -24,33 +22,70 @@ const (
ArgoCDRedisServerTLSSecretName = "argocd-operator-redis-tls"
)

// deafults
// suffixes
const (
//RedisSuffix is the default suffix to use for Redis resources.
RedisSuffix = "redis"

// ArgoCDDefaultRedisConfigPath is the default Redis configuration directory when not specified.
ArgoCDDefaultRedisConfigPath = "/var/lib/redis"
RedisHASuffix = "redis-ha"

// ArgoCDDefaultRedisHAReplicas is the defaul number of replicas for Redis when rinning in HA mode.
ArgoCDDefaultRedisHAReplicas = int32(3)
RedisHAProxySuffix = "redis-ha-haproxy"

// ArgoCDDefaultRedisHAProxyImage is the default Redis HAProxy image to use when not specified.
ArgoCDDefaultRedisHAProxyImage = "haproxy"
RedisHAServerSuffix = "redis-ha-server"

// ArgoCDDefaultRedisHAProxyVersion is the default Redis HAProxy image tag to use when not specified.
ArgoCDDefaultRedisHAProxyVersion = "sha256:7392fbbbb53e9e063ca94891da6656e6062f9d021c0e514888a91535b9f73231" // 2.0.25-alpine
RedisHAAnnouceSuffix = "redis-ha-announce"
)

// defaults
const (

// DefaultRedisConfigPath is the default Redis configuration directory when not specified.
DefaultRedisConfigPath = "/var/lib/redis"

// DefaultRedisHAReplicas is the defaul number of replicas for Redis when rinning in HA mode.
DefaultRedisHAReplicas = int32(3)

// DefaultRedisHAProxyImage is the default Redis HAProxy image to use when not specified.
DefaultRedisHAProxyImage = "haproxy"

// DefaultRedisHAProxyVersion is the default Redis HAProxy image tag to use when not specified.
DefaultRedisHAProxyVersion = "sha256:7392fbbbb53e9e063ca94891da6656e6062f9d021c0e514888a91535b9f73231" // 2.0.25-alpine

// ArgoCDDefaultRedisImage is the Redis container image to use when not specified.
ArgoCDDefaultRedisImage = "redis"
DefaultRedisImage = "redis"

// DefaultRedisPort is the default listen port for Redis.
DefaultRedisPort = 6379

// ArgoCDDefaultRedisPort is the default listen port for Redis.
ArgoCDDefaultRedisPort = 6379
// DefaultRedisSentinelPort is the default listen port for Redis sentinel.
DefaultRedisSentinelPort = 26379

// ArgoCDDefaultRedisSentinelPort is the default listen port for Redis sentinel.
ArgoCDDefaultRedisSentinelPort = 26379
// DefaultRedisVersion is the Redis container image tag to use when not specified.
DefaultRedisVersion = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine

// ArgoCDDefaultRedisVersion is the Redis container image tag to use when not specified.
ArgoCDDefaultRedisVersion = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine
// DefaultRedisVersionHA is the Redis container image tag to use when not specified in HA mode.
DefaultRedisVersionHA = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine
)

// env vars
const (
// RedisHAProxyImageEnvVar is the environment variable used to get the image
// to used for the Redis HA Proxy container.
RedisHAProxyImageEnvVar = "ARGOCD_REDIS_HA_PROXY_IMAGE"

// RedisHAImageEnvVar is the environment variable used to get the image
// to used for the the Redis container in HA mode.
RedisHAImageEnvVar = "ARGOCD_REDIS_HA_IMAGE"

// ArgoCDDefaultRedisVersionHA is the Redis container image tag to use when not specified in HA mode.
ArgoCDDefaultRedisVersionHA = "sha256:8061ca607db2a0c80010aeb5fc9bed0253448bc68711eaa14253a392f6c48280" // 6.2.4-alpine
// RedisImageEnvVar is the environment variable used to get the image
// to used for the Redis container.
RedisImageEnvVar = "ARGOCD_REDIS_IMAGE"

// RedisConfigPathEnvVar is the environment variiable used to get the redis configuration templates
RedisConfigPathEnvVar = "REDIS_CONFIG_PATH"
)

// keys
const (
RedisTLSCertChangedKey = "redis.tls.cert.changed"
)
2 changes: 2 additions & 0 deletions common/reposerver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package common
const (
// ArgoCDRepoServerTLSSecretName is the name of the TLS secret for the repo-server
ArgoCDRepoServerTLSSecretName = "argocd-repo-server-tls"

RepoServerSuffix = "-repo-server"
)

// values
Expand Down
9 changes: 9 additions & 0 deletions common/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ const (
=======
// ArgoCDMetrics is the resource metrics key for labels.
ArgoCDMetrics = "metrics"

ArgoCDStatusUnknown = "Unknown"

ArgoCDStatusPending = "Pending"

ArgoCDStatusRunning = "Running"

ArgoCDStatusAvailable = "Available"
)
>>>>>>> ae37d0a (retain old and new constants. .github folder changes, fix errors (#1133))

Expand Down Expand Up @@ -121,6 +129,7 @@ const (
SecretKind = "Secret"
ServiceKind = "Service"
ServiceAccountKind = "ServiceAccount"
ArgoCDKind = "ArgoCD"
)

// Commnds
Expand Down
8 changes: 6 additions & 2 deletions pkg/cluster/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cntrlClient "sigs.k8s.io/controller-runtime/pkg/client"

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/pkg/argoutil"
"github.com/argoproj-labs/argocd-operator/pkg/mutation"
)
Expand All @@ -23,10 +24,13 @@ type EventRequest struct {
CreationTimestamp metav1.Time
FirstTimestamp metav1.Time
LastTimestamp metav1.Time
Instance *argoproj.ArgoCD

// array of functions to mutate event before returning to requester
Mutations []mutation.MutateFunc
Client cntrlClient.Client
// array of arguments to pass to the mutation funcs
MutationArgs []interface{}
Client cntrlClient.Client
}

func newEvent(objMeta metav1.ObjectMeta, typeMeta metav1.TypeMeta, eventType, action, message, reason string) *corev1.Event {
Expand Down Expand Up @@ -61,7 +65,7 @@ func RequestEvent(request EventRequest) (*corev1.Event, error) {

if len(request.Mutations) > 0 {
for _, mutation := range request.Mutations {
err := mutation(nil, event, request.Client)
err := mutation(request.Instance, event, request.Client, request.MutationArgs)
if err != nil {
mutationErr = err
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/cluster/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ import (
"github.com/argoproj-labs/argocd-operator/pkg/mutation"
"github.com/argoproj-labs/argocd-operator/pkg/resource"

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
cntrlClient "sigs.k8s.io/controller-runtime/pkg/client"
)

// NamespaceRequest objects contain all the required information to produce a namespace object in return
type NamespaceRequest struct {
ObjectMeta metav1.ObjectMeta
Spec corev1.NamespaceSpec
Instance *argoproj.ArgoCD

// array of functions to mutate role before returning to requester
// array of functions to mutate obj before returning to requester
Mutations []mutation.MutateFunc
Client cntrlClient.Client
// array of arguments to pass to the mutation funcs
MutationArgs []interface{}
Client cntrlClient.Client
}

func newNamespace(objMeta metav1.ObjectMeta, spec corev1.NamespaceSpec) *corev1.Namespace {
Expand All @@ -40,7 +44,7 @@ func RequestNamespace(request NamespaceRequest) (*corev1.Namespace, error) {

if len(request.Mutations) > 0 {
for _, mutation := range request.Mutations {
err := mutation(nil, namespace, request.Client)
err := mutation(request.Instance, namespace, request.Client, request.MutationArgs)
if err != nil {
mutationErr = err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ var (
}
)

func testMutationFuncFailed(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncFailed(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client, args ...interface{}) error {
return errors.New("test-mutation-error")
}

func testMutationFuncSuccessful(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncSuccessful(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client, args ...interface{}) error {
switch obj := resource.(type) {
case *corev1.Namespace:
if _, ok := obj.Labels[testKey]; ok {
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitoring/monitoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ var (
}
)

func testMutationFuncFailed(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncFailed(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client, args ...interface{}) error {
return errors.New("test-mutation-error")
}

func testMutationFuncSuccessful(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncSuccessful(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client, args ...interface{}) error {
switch obj := resource.(type) {
case *monitoringv1.PrometheusRule:
obj.Name = testPrometheusRuleNameMutated
Expand Down
11 changes: 8 additions & 3 deletions pkg/monitoring/prometheusRule.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cntrlClient "sigs.k8s.io/controller-runtime/pkg/client"

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/pkg/mutation"
"github.com/argoproj-labs/argocd-operator/pkg/resource"
)
Expand All @@ -17,9 +18,13 @@ type PrometheusRuleRequest struct {
ObjectMeta metav1.ObjectMeta
Spec monitoringv1.PrometheusRuleSpec

// array of functions to mutate role before returning to requester
Instance *argoproj.ArgoCD

// array of functions to mutate obj before returning to requester
Mutations []mutation.MutateFunc
Client cntrlClient.Client
// array of arguments to pass to the mutation funcs
MutationArgs []interface{}
Client cntrlClient.Client
}

// newPrometheusRule returns a new PrometheusRule instance for the given ArgoCD.
Expand All @@ -38,7 +43,7 @@ func RequestPrometheusRule(request PrometheusRuleRequest) (*monitoringv1.Prometh

if len(request.Mutations) > 0 {
for _, mutation := range request.Mutations {
err := mutation(nil, prometheusRule, request.Client)
err := mutation(request.Instance, prometheusRule, request.Client, request.MutationArgs)
if err != nil {
mutationErr = err
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/monitoring/serviceMonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cntrlClient "sigs.k8s.io/controller-runtime/pkg/client"

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/pkg/mutation"
"github.com/argoproj-labs/argocd-operator/pkg/resource"
)
Expand All @@ -16,10 +17,13 @@ import (
type ServiceMonitorRequest struct {
ObjectMeta metav1.ObjectMeta
Spec monitoringv1.ServiceMonitorSpec
Instance *argoproj.ArgoCD

// array of functions to mutate role before returning to requester
// array of functions to mutate obj before returning to requester
Mutations []mutation.MutateFunc
Client cntrlClient.Client
// array of arguments to pass to the mutation funcs
MutationArgs []interface{}
Client cntrlClient.Client
}

// newServiceMonitor returns a new ServiceMonitor instance for the given ArgoCD.
Expand All @@ -38,7 +42,7 @@ func RequestServiceMonitor(request ServiceMonitorRequest) (*monitoringv1.Service

if len(request.Mutations) > 0 {
for _, mutation := range request.Mutations {
err := mutation(nil, serviceMonitor, request.Client)
err := mutation(request.Instance, serviceMonitor, request.Client, request.MutationArgs)
if err != nil {
mutationErr = err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/mutation/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
)

// MutateFunc defines the function signature for any mutation functions that need to be executed by this package
type MutateFunc func(*argoproj.ArgoCD, interface{}, client.Client) error
type MutateFunc func(*argoproj.ArgoCD, interface{}, client.Client, ...interface{}) error

// Register adds a modifier for updating resources during reconciliation.
func Register(m ...MutateFunc) {
Expand All @@ -23,11 +23,11 @@ func Register(m ...MutateFunc) {
mutateFuncs = append(mutateFuncs, m...)
}

func ApplyReconcilerMutation(cr *argoproj.ArgoCD, resource interface{}, client client.Client) error {
func ApplyReconcilerMutation(cr *argoproj.ArgoCD, resource interface{}, client client.Client, args ...interface{}) error {
mutex.Lock()
defer mutex.Unlock()
for _, mutateFunc := range mutateFuncs {
if err := mutateFunc(cr, resource, client); err != nil {
if err := mutateFunc(cr, resource, client, args...); err != nil {
return err
}
}
Expand Down
Loading

0 comments on commit e3ed08f

Please sign in to comment.