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

Multi-source application stuck in "Unknown" status when sourceRepo is not whitelisted #16216

Closed
3 tasks done
sym-stiller opened this issue Nov 2, 2023 · 5 comments
Closed
3 tasks done
Labels
bug Something isn't working multi-source-apps Bugs or enhancements related to multi-source Applications.

Comments

@sym-stiller
Copy link

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When deploying a multi-source application that is referencing a repository that was not whitelisted in the AppProject (sourceRepos setting does not include the referenced repository), the application enters an Unknown status and the underlying error is not really visible in the UI. It would be nice if the UI could provide a meaningful error message for this case, because the root cause is known. Also, when selecting the application in the UI while it is in this Unkown state, the UI crashes, displays a stacktrace, and will cease to work until I reload the page.

You can currently dig into the Application's manifest and search for such errors in its status, but that is not obvious to non-experienced users of ArgoCD/K8s.

To Reproduce

Deploy a multi-source Application that references a repository that is not whitelisted in the respective AppProject. After ArgoCD has synced, the Application will be displayed with an "Unknown" status in the UI. When you select this application in the UI, the UI will crash.

Expected behavior

ArgoCD should display a meaningful error message telling the user that the referenced repository is not whitelisted in the AppProject. The UI also shouldn't crash when selecting such a (arguably misconfigured) Application.

Version

argocd: v2.8.6+6f7af53
  BuildDate: 2023-11-01T17:06:09Z
  GitCommit: 6f7af53bea9ebc9e9eadd47fc43b671ef91c0586
  GitTreeState: clean
  GoVersion: go1.20.10
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.8.3+77556d9
@sym-stiller sym-stiller added the bug Something isn't working label Nov 2, 2023
@crenshaw-dev crenshaw-dev added the multi-source-apps Bugs or enhancements related to multi-source Applications. label Nov 2, 2023
@ishitasequeira
Copy link
Member

ishitasequeira commented Mar 5, 2024

@sym-stiller can you share a sample application for reproducing the issue? The complete UI/ CLI is still not supported for multi-source applications. But, UI crashing surely needs to be fixed.

@sym-stiller
Copy link
Author

Hi @ishitasequeira ! Sure, this is a simple setup to reproduce this issue:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foobar-service
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: mycoolargocdproject
  sources:
    # Helm chart values source
    - repoURL: https://organizationName@dev.azure.com/organizationName/projectID/_git/gitops-repo-name
      targetRevision: HEAD
      ref: helmvalues
    # Helm chart
    - chart: chart-name
      repoURL: registryname.azurecr.io
      targetRevision: 0.1.0
      helm:
        releaseName: foobar
        valueFiles:
          - $helmvalues/foobar/helm/values.yaml
  destination:
    server: https://kubernetes.default.svc
    namespace: foobar
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
---
apiVersion: v1
kind: Namespace
metadata:
  name: foobar
---
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: mycoolargocdproject
  namespace: argocd
spec:
  description: My cool ArgoCD project
  sourceRepos:
    - 'https://organizationName@dev.azure.com/organizationName/projectID/_git/gitops-repo-name' # Git repo (for values.yaml)
    - 'registryname.azurecr.io' # Container registry (for Helm chart OCI artifact)
  destinations:
    - namespace: '*'
      server: https://kubernetes.default.svc
  clusterResourceWhitelist:
    - group: '*'
      kind: '*'
  orphanedResources:
    warn: false

This setup should work correctly (given that the authentication for the referenced repositories/registries is correctly configured). If you remove one of the sourceRepos in the AppProject (doesn't matter which one) and try to deploy the same Application, you will run into the described issue.

@raghavi101
Copy link
Contributor

raghavi101 commented Apr 15, 2024

Hi @sym-stiller I tried recreating your error. I tried to remove this entry 'https://organizationName@dev.azure.com/organizationName/projectID/_git/gitops-repo-name' from sourceRepos in AppProject through UI as we as CLI.

Removing it through UI gave me this error :
Screenshot 2024-04-15 at 4 40 41 PM

Removing it through CLI gave me this error :
Screenshot 2024-04-15 at 4 42 06 PM

The below thing did not happen for me, I was able to select the application multiple times, my UI was stable, did not crash & I didn't have to reload anything. Although the application DID go into an Unknown state due to the InvalidSpecError.

Also, when selecting the application in the UI while it is in this Unkown state, the UI crashes, displays a stacktrace, and will cease to work until I reload the page.

@ishitasequeira
Copy link
Member

It looks like the error messages are available in at least releases 2.9 and above. Please feel free to reopen the ticket if you see the issue.

@sym-stiller
Copy link
Author

Thanks for looking into this! 👍
I can confirm that the UI does not crash anymore, and that the error messages were greatly improved. Multi-source apps are growing more useful with each release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multi-source-apps Bugs or enhancements related to multi-source Applications.
Projects
None yet
Development

No branches or pull requests

4 participants