Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code-refactoring: add status reconciliation to ArgoCDReconciler #1211

Merged
merged 47 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1caabde
fix: don't set phase to available during host reconciliation (#918)
jaideepr97 Jul 20, 2023
4d09aca
update owners file (#953)
reginapizza Jul 26, 2023
45f3597
Move to only adding two roles for managed namespaces (#954)
selrahal Jul 26, 2023
c7cfa8c
feat: expose operator metrics (#928)
jaideepr97 Aug 1, 2023
89825db
add build.os config for readthedocs (#967)
reginapizza Aug 17, 2023
11299b7
setup 0.8.0 (#966)
reginapizza Aug 21, 2023
b25858d
feat: Add conversion webhook for ArgoCD v1alpha1 to v1beta1 migration…
svghadi Aug 21, 2023
c658019
chore(deps): bump pygments from 2.7.4 to 2.15.0 in /docs (#950)
dependabot[bot] Aug 22, 2023
e49612a
feat: upgrade RH-SSO from 7.5 to 7.6 (#977)
iam-veeramalla Aug 28, 2023
e624a26
refactor: Remove dead code (#979)
svghadi Aug 29, 2023
e928c0e
Replace ArgoCD v1alpha1 references with v1beta1 (#975)
svghadi Aug 29, 2023
380207e
refactor: Remove deprecated .spec.resourceCustomizations (#973)
svghadi Aug 30, 2023
f2f9fb4
upgrade ArgoCD version to 2.8.2 and update the CRDs (#984)
ishitasequeira Aug 30, 2023
8ddbce3
chore: Update ArgoCD v1alpha1 deprecation message (#988)
svghadi Sep 4, 2023
297702f
Add support for tls self signed certs in AppSet Gitlab SCM Provider (…
ishitasequeira Sep 6, 2023
64d5bb2
chore(deps): bump github.com/argoproj/argo-cd/v2 from 2.8.2 to 2.8.3 …
dependabot[bot] Sep 11, 2023
91bf131
feat: pick up argo cd v2.8.3 (#993)
iam-veeramalla Sep 11, 2023
cd7a54b
fix: replace deprecated syntax in kustomization.yaml (#1000)
minchao Sep 25, 2023
aa6ab4e
Missing syntax-highlighting, toggle button for screen mode in argocd-…
surajyadav1108 Sep 25, 2023
75d6cf4
fix: keycloak probes failure and intermittent perforamance issues (#1…
iam-veeramalla Sep 26, 2023
64aa268
bug: fix heathcheck subkey generation for resources with no group (#…
jaideepr97 Oct 3, 2023
6b3fbb6
chore(deps): bump golang.org/x/net from 0.11.0 to 0.17.0 (#1019)
dependabot[bot] Oct 13, 2023
5a2e6c4
Add labelSelector option to filter the ArgoCD instances for reconcili…
raghavi101 Oct 19, 2023
c8e4909
fix: address CVE-2023-39325 (#1022)
jaideepr97 Oct 26, 2023
fb27066
Add gcp cherry-pick bot config (#1023)
svghadi Oct 26, 2023
962f30f
Add .github/dependabot.yml to enable auto dependency version updates …
chengfang Oct 27, 2023
000c4a7
feat(dex): add optional env field (#1005)
rdeusser Oct 30, 2023
17064c9
fix: replace deprecated AddToScheme with Install, and deprecated Sche…
chengfang Nov 16, 2023
9a294a2
allow enabling ArgoCD workloads independently (#1021)
ishitasequeira Nov 16, 2023
18a0a8d
chore(deps): bump argoproj/argocd in /build/util (#1080)
dependabot[bot] Nov 24, 2023
a78a842
feat: upgrade Argo CD for release v.9.0 (#1082)
iam-veeramalla Nov 24, 2023
c238af6
fix the logic for applicationset resources reconcilation when spec.ap…
ishitasequeira Dec 1, 2023
5166a46
docs: enabling/disabling individual argocd core components (#1098)
ishitasequeira Dec 6, 2023
d424ebd
fix: Proper reference to where to find default admin password (#1094)
ikegentz Dec 13, 2023
acee651
adding applicationsets in server rbac policy rule (#1140)
Mangaal Jan 10, 2024
6a6847a
rebase against master
jaideepr97 Jan 14, 2024
d0f5fe3
remove extra argoutils
jaideepr97 Jan 14, 2024
c61d677
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Jan 15, 2024
816c053
fix logic to allow processor operation to be less than default value …
anandrkskd Jan 17, 2024
3c80cd2
Use correct repo-server address for notification controller (#1125)
svghadi Jan 17, 2024
a0d28f8
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Jan 18, 2024
7d93a60
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Jan 18, 2024
0a61db2
pull in changes from master
jaideepr97 Jan 18, 2024
e75bd95
remove notifs files
jaideepr97 Jan 18, 2024
d812697
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Jan 22, 2024
b623adb
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Jan 25, 2024
3325406
add status reconciliation fns for all components, reconcile statuses …
jaideepr97 Feb 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add status reconciliation fns for all components, reconcile statuses …
…at end of cycle

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
  • Loading branch information
jaideepr97 committed Feb 1, 2024
commit 33254065ade22aac746156d3aae3de09f326c68d
32 changes: 32 additions & 0 deletions controllers/argocd/appcontroller/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package appcontroller

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the app-controller status is updated for the given ArgoCD instance
func (acr *AppControllerReconciler) ReconcileStatus() error {

// TO DO

return acr.updateInstanceStatus()
}

func (acr *AppControllerReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := acr.Client.Status().Update(context.TODO(), acr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
32 changes: 32 additions & 0 deletions controllers/argocd/applicationset/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package applicationset

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the appset controller status is updated for the given ArgoCD instance
func (asr *ApplicationSetReconciler) ReconcileStatus() error {

// TO DO

return asr.updateInstanceStatus()
}

func (asr *ApplicationSetReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := asr.Client.Status().Update(context.TODO(), asr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
6 changes: 5 additions & 1 deletion controllers/argocd/argocd_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ func (r *ArgoCDReconciler) reconcileControllers() error {
r.Logger.Error(err, "failed to reconcile SSO controller")
}

if err := r.reconcileStatus(); err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -610,7 +614,7 @@ func (r *ArgoCDReconciler) InitializeControllerReconcilers() {
}

ssoController := &sso.SSOReconciler{
Client: &r.Client,
Client: r.Client,
Scheme: r.Scheme,
Instance: r.Instance,
}
Expand Down
32 changes: 32 additions & 0 deletions controllers/argocd/notifications/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package notifications

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the notifications controller status is updated for the given ArgoCD instance
func (nr *NotificationsReconciler) ReconcileStatus() error {

// TO DO

return nr.updateInstanceStatus()
}

func (nr *NotificationsReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := nr.Client.Status().Update(context.TODO(), nr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
32 changes: 32 additions & 0 deletions controllers/argocd/redis/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package redis

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatusRedis will ensure that the Redis status is updated for the given ArgoCD instance
func (rr *RedisReconciler) ReconcileStatus() error {

// TO DO

return rr.updateInstanceStatus()
}

func (rr *RedisReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := rr.Client.Status().Update(context.TODO(), rr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
32 changes: 32 additions & 0 deletions controllers/argocd/reposerver/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package reposerver

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the Repo-server status is updated for the given ArgoCD instance
func (rsr *RepoServerReconciler) ReconcileStatus() error {

// TO DO

return rsr.updateInstanceStatus()
}

func (rsr *RepoServerReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := rsr.Client.Status().Update(context.TODO(), rsr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
32 changes: 32 additions & 0 deletions controllers/argocd/server/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package server

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the server status is updated for the given ArgoCD instance
func (sr *ServerReconciler) ReconcileStatus() error {

// TO DO

return sr.updateInstanceStatus()
}

func (sr *ServerReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := sr.Client.Status().Update(context.TODO(), sr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
2 changes: 1 addition & 1 deletion controllers/argocd/sso/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

type SSOReconciler struct {
Client *client.Client
Client client.Client
Scheme *runtime.Scheme
Instance *argoproj.ArgoCD
Logger logr.Logger
Expand Down
32 changes: 32 additions & 0 deletions controllers/argocd/sso/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package sso

import (
"context"

"github.com/pkg/errors"
"k8s.io/client-go/util/retry"
)

// reconcileStatus will ensure that the sso status is updated for the given ArgoCD instance
func (sr *SSOReconciler) ReconcileStatus() error {

// TO DO

return sr.updateInstanceStatus()
}

func (sr *SSOReconciler) updateInstanceStatus() error {
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := sr.Client.Status().Update(context.TODO(), sr.Instance); err != nil {
return errors.Wrap(err, "UpdateInstanceStatus: failed to update instance status")
}
return nil
})

if err != nil {
// May be conflict if max retries were hit, or may be something unrelated
// like permissions or a network error
return err
}
return nil
}
53 changes: 53 additions & 0 deletions controllers/argocd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,61 @@ import (

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/pkg/argoutil"
"github.com/argoproj-labs/argocd-operator/pkg/util"
)

// reconcileStatus will ensure that all of the Status properties are updated for the given ArgoCD.
func (r *ArgoCDReconciler) reconcileStatus() error {
var statusErr util.MultiError

if err := r.AppController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.ServerController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.RedisController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.ReposerverController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.AppsetController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.NotificationsController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

if err := r.SSOController.ReconcileStatus(); err != nil {
r.Logger.Error(err, "reconcileStatus")
statusErr.Append(err)
}

// TO DO

// if err := r.reconcileStatusHost(cr); err != nil {
// return err
// }

// if err := r.reconcileStatusPhase(cr); err != nil {
// return err
// }

return statusErr.ErrOrNil()
}

// reconcileStatus will ensure that all of the Status properties are updated for the given ArgoCD.
func (r *ReconcileArgoCD) reconcileStatus(cr *argoproj.ArgoCD) error {
if err := r.reconcileStatusApplicationController(cr); err != nil {
Expand Down
Loading