argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.01k stars 5.49k forks source link

App created via the UI doesn't respect App in any namespace settings #20820

Open OpenGuidou opened 1 week ago

OpenGuidou commented 1 week ago

Checklist:

Describe the bug

When creating an app from the UI, it is not possible to provide the namespace in which the app will be created. It's always created in argo-cd's namespace.

Even when going to the yaml view and setting the namespace, it's overrided and created in the argo-cd namespace anyway.

Furthermore, it is not checking the project settings to know if it's ok to deploy in Argo-cd namespace. I've set the spec.sourceNamespaces in the project to reference only the other namespace (not the argo-cd one), and the app is created without issue.

To Reproduce

  1. Create a namespace to store the argocd apps: not-argo-namespace
  2. Deploy Argo-CD with the app and appset in any namespace settings, with application-namespaces=not-argo-namespace preventing to use argo-cd namespace
  3. Set the spec.sourceNamespace in the default project to not-argo-namespace
  4. Create an app from the UI

Expected behavior

We should be able to select the authorized namespaces in which to create the App. If by any mean we set one not in the application-namespaces nor in the project sourceNamespace, it should be rejected.

Version

2.13

Logs

Mangaal commented 1 week ago

The behavior you are observing is actually due to the naming convention required when creating applications in a specific namespace via the UI. As per the documentation, the application name must follow the namespace/app format to indicate the target namespace explicitly. Please refer to this doc app-any-namespace .

OpenGuidou commented 1 week ago

Thanks for the info. It's not optimal in terms of user experience, but that works.

However, there should still be the check on the allowed namespaces in which the user can deploy the application.

Mangaal commented 1 week ago

I agree, the user experience could be better. Since this behaviour is working as intended, I suggest changing the label to feature instead of a bug and also updating the title. Adding a check for allowed namespaces would be a great enhancement!

OpenGuidou commented 1 week ago

I would rather fix the missing check as a bug, and provide a better user experience via an additional option to provide the application namespace in the UI and the CLI as a feature

Mangaal commented 1 week ago

for cli, you can use the flag --app-namespace. here is the doc https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd_app_create/