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

feat: report ArgoCD errors via .status.conditions field #1608

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

jparsai
Copy link
Collaborator

@jparsai jparsai commented Nov 26, 2024

What type of PR is this?
/kind enhancement

What does this PR do / why we need it:
This PR is to add a new Conditions field in Status of ArgoCD CR which would contain a single condition of 'Type: Reconciled' for any error that occurs.

Which issue(s) this PR fixes:
Red Hat issue tracker :- https://issues.redhat.com/browse/GITOPS-5876

How to test changes / Special notes to the reviewer:

  • Create ArgoCD CR.
  • After reconciliation .status.conditions field should be updated based on error or success.

@jparsai jparsai marked this pull request as ready for review November 27, 2024 06:12
Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @jparsai, one additional request in addition to what is described below.

Part of this story is ensuring that the error messages that we are setting are user friendly.

AFAICT if you search for the following strings in the code, you will find cases where we are creating new errors:
errors.New
fmt.Errorf

I did that, and one thing I noticed is there are cases where there are error log statement are very user-friendly, and then below them is an error which is very user unfriendly:

  • reqLogger.Info(fmt.Sprintf("the ArgoCD instance '%s' does not match the label selector '%s' and skipping for reconciliation", request.NamespacedName, r.LabelSelector))
  • log.Error(err, fmt.Sprintf("Arg %s is already part of the default command arguments", arg))

    In these cases, I think we should make the error returned just as 'friendly' as the log statement logging the error case. AFAICT there is no reason to not have the error message be the same as the logged error message, as the logger error message provided much more datail.

It would also be beneficial to look at the error messages in general, by searching for the strings mentioned above. See if you can decide if they can be improved to provide better context for what the Argo CD operator was doing when the error occurred. (where possible)

api/v1alpha1/argocd_types.go Show resolved Hide resolved
controllers/argocd/argocd_controller.go Outdated Show resolved Hide resolved
tests/k8s/1-001_validate_basic/01-assert.yaml Show resolved Hide resolved
controllers/argocd/argocd_controller_test.go Show resolved Hide resolved
controllers/argocd/util.go Show resolved Hide resolved
@jparsai jparsai force-pushed the conditions branch 4 times, most recently from e1224cb to fbe8398 Compare December 16, 2024 16:15
controllers/argocd/argocd_controller.go Outdated Show resolved Hide resolved
controllers/argocd/argocd_controller.go Show resolved Hide resolved
@jparsai jparsai force-pushed the conditions branch 2 times, most recently from f26a551 to 7ae34e4 Compare December 19, 2024 04:30
Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jparsai! As mentioned, I've been very much looking forward to this feature 😄.

@jgwest jgwest merged commit 31af195 into argoproj-labs:master Dec 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants