feat: (PoC) Applications outside argocd namespace#6537
feat: (PoC) Applications outside argocd namespace#6537jannfis wants to merge 5 commits intoargoproj:masterfrom
Conversation
Signed-off-by: jannfis <jann@mistrust.net>
Signed-off-by: jannfis <jann@mistrust.net>
Signed-off-by: jannfis <jann@mistrust.net>
Signed-off-by: jannfis <jann@mistrust.net>
Codecov Report
@@ Coverage Diff @@
## master #6537 +/- ##
==========================================
+ Coverage 41.11% 41.13% +0.02%
==========================================
Files 153 153
Lines 20304 20378 +74
==========================================
+ Hits 8348 8383 +35
- Misses 10798 10829 +31
- Partials 1158 1166 +8
Continue to review full report at Codecov.
|
Signed-off-by: jannfis <jann@mistrust.net>
|
"The limitation is that it is a namespace on the Argo CD's control plane cluster. Application controller and API server must have access to these namespaces" I wouldn't call it a limitation, rather it's a constraint. |
|
What is the status here, @jannfis? Do you consider implementing something similar soon? |
|
@Ziphone My plan is to bring the PoC into a ready state and have it integrated with Argo CD. But we had some discussions about this, and had no final conclusion yet. /cc @alexmt @jessesuen |
|
This is superseded by #9755 |
PoC for apps outside argocd namespace
Description
This PR is a PoC to prove that the proposal created at #6409 actually can be implemented with changes that are not too intrusive.
Despite the PR looks big (>=48 files changes), most of the changes are about how things (e.g. application names) are referenced (e.g. application name). There's not much changes to complexity imho.
This shall not be merged. It serves merely as a demonstration.
Major changes
Applicationscan now be created and managed in every namespaceThe limitation is that it is a namespace on the Argo CD's control plane cluster. Application controller and API server must have access to these namespaces.
AppProjectrestricts the namespacesThe
AppProjectCRD has been extended by.spec.sourceNamespaces, which is a list of namespaces whereApplicationsmay exist and are allowed to associate to theAppProject.If an
Applicationis created in namespacesome-nsand sets.spec.projecttosome-project, thensome-projectmust specifysome-nsin the.spec.sourceNamespaceslist. This is a safeguard against applications associating to any project to elevate their privileges.If the installation namespace of the
Applicationis not in the.spec.sourceNamespaceslist of theAppProjectit references,Applicationresource still may be created, but the application controller will not reconcile it.To keep backward compatibility, the Argo CD control plane's namespace (e.g.
argocd) is implicitly allowed and does not need to be specified in.spec.sourceNamespaces, because it is assumed that only Argo CD administrators have access to this namespace (and also can controlAppProjectresources).Referencing
Applicationson the CLI and APIThe CLI and API have been changed to accept application names in the format
<namespace>/<name>to allow working with applications in different namespaces. For backwards compatibilityApplicationsin the control plane's namespace (e.g.argocd), can be referenced in a non namespaced way (e.g. just<name>).For example, consider the following two applications:
some-appin theargocdnamespacesome-appin theother-nsnamespace.Both applications have the same name (
some-app) but can be referenced to independently:argocd app get some-appandargocd app get argocd/some-appare semantically the same and would retrieve information about the applicationsome-appin theargocdnamespaceargocd app get other-ns/some-appwould retrieve information about the applicationsome-appin theother-nsnamespaceThis syntax is valid for all CLI commands that work with
Applicationresources exceptargocd app create. To create an application using the CLI, the--app-namespaceparameter can be specified to denote in which namespace theApplicationresource should be created:Also, if
argocd app createis used in conjunction with the-fparameter to create the application from a manifest, the.metadata.namespacevalue in the manifest is considered for being the namespace in which to create the application.Change of instance label value on resources
In order to uniquely identify applications with the same name in different namespaces, the value of the instance label (
app.kubernetes.io/instance) has been changed from<appname>to<namespace>_<appName>. As a consequence, in this PoC the length of<namespace>and<appName>combined may not exceed 62 characters (plus one for the underscore).This may be overcome with changes as proposed in #6425.
Also, if you test this change with an existing Argo CD installation, all of your Applications will become out of sync and need to be re-synced to reflect the new value.
Unsupported in this PoC
Web UI
The web UI has not seen any changes and also was not tested. Most likely, it will not work.
Documentation
Nothing has been documented yet ¯_(ツ)_/¯
Limiting the namespaces to watch
Currently, all namespaces are being watched on the cluster for
Applicationresources and there's no way to limit that. This may change in a future incarnation of this change.Insufficient permissions for API server
I have not included any manifest changes. If you build an image from this, and install to a cluster, you may give
argocd-serveradditional permissions toapplications.argoproj.ioin all namespaces.Testing
End-to-End tests
There are no dedicated end-to-end tests yet for this. However, current end-to-end tests run successfully.
The PoC has adapted the end-to-end test suite to also run the existing end-to-end tests with all
Applicationresources installed to a dedicated namespace different than the control plane's namespace. In order to run these tests withApplicationsmanaged in another namespace, do the following:Start end-to-end test server components (Argo CD will use
argocd-e2enamespace for control plane):In another shell, create dedicated namespace for
Applicationresources and run the tests, instructing the test framework to useargocd-e2e-srcas application namespace: