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

Add error condition when notification replica is greater than 1 #1642

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Rizwana777
Copy link
Contributor

if argocd.Spec.Notifications.Replicas != nil && *argocd.Spec.Notifications.Replicas > 1 {
message := "Argo CD Notification controller does not support multiple replicas. Notification replicas cannot be greater than 1."
reqLogger.Info(message)
return reconcile.Result{}, argocd, fmt.Errorf("%s", message)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this stop the reconciliation completely if there is problem with notifications configurations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Collaborator

@svghadi svghadi Jan 22, 2025

Choose a reason for hiding this comment

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

What do you think about ignoring the replica field value for notifications and throwing a warning message instead of stopping the entire reconciliation process due to a single unsupported configuration? Since this is not yet supported upstream, we could inform users through a warning message and maybe also update our documentation accordingly to reflect this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i agree, but in ticket they mentioned to report an error and stop the reconciliation

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I see. I think we have the flexibility to decide the behavior here. Personally, I don't think it’s appropriate to stop reconciliation entirely for a minor non-critical misconfiguration. Ignoring the unsupported config and notifying the user should be enough, I feel.

Additionally, if upstream has no plans to support replicas, we could also consider deprecating the field in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, then I will just log the error and move forward

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool. Lets also ignore the value if set.

Copy link
Contributor Author

@Rizwana777 Rizwana777 Jan 24, 2025

Choose a reason for hiding this comment

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

if we are just giving the warning , then there is no need to update the condition field of ArgoCD with error type ErrorOccurred as we will not return any error here https://github.com/argoproj-labs/argocd-operator/pull/1642/files#diff-2fe0a2bb5baaf6170a23a7c08adc70117adfa25b7d481923aa8626a38cefd447R137?

@svghadi
Copy link
Collaborator

svghadi commented Jan 30, 2025

I think we also need to ignore the value set in replica field here

if replicas := getArgoCDNotificationsControllerReplicas(cr); replicas != nil {
desiredDeployment.Spec.Replicas = replicas
}

Maybe, log the message in this if condition and remove the assignment statement to ignore the value. WDYT?

@Rizwana777
Copy link
Contributor Author

I think we also need to ignore the value set in replica field here

if replicas := getArgoCDNotificationsControllerReplicas(cr); replicas != nil {
desiredDeployment.Spec.Replicas = replicas
}

Maybe, log the message in this if condition and remove the assignment statement to ignore the value. WDYT?

I think we can remove or ignore this function itself getArgoCDNotificationsControllerReplicas if we are removing assignment statement to ignore the value, it will be of no use calling this function if we are not using the value returned by it right? and I see this function not used in any other place as well?

@svghadi
Copy link
Collaborator

svghadi commented Jan 31, 2025

Yes. Sounds good.

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