Skip to content

Allow applications to be deployed in a namespace if a label is present on the namespace #28594

Description

@cjcocokrisp

Summary

Add a label that can be put on namespaces to allow applications to be deployed in them.

Motivation

Currently the apps in any namespaces feature requires two conditions to be true to allow for an application to be deployed in the namespace.

  1. The namespaces name must be present in list for the CLI flag --application-namespaces.
  2. The namespace must be present in the .spec.sourceNamespaces field of the application's app project.

At the current moment namespaces can be listed with shell-style wildcards and regexes. However both of these options require the namespaces that are planned to be used for application deployments to follow a specific pattern.

In environments where the namespace naming scheme is not consistent it can be tedious to add new namespaces to the list. Each new namespace added to the --application-namespaces list requires a restart of the application controller as well.

Proposal

To allow for namespaces that do not follow a specific naming scheme to be automatically included. A new label could be provided on the namespace to mark it as a source namespace. So if a namespace like the following example was deployed:

apiVersion: v1
kind: Namespace
metadata:
  name: namespace
  labels:
    argocd.argoproj.io/source-namespace: "true" 

Applications would then be able to be reconciled in that namespace.

Because this addition would not be easy to check in the .spec.sourceNamespaces a new field in the app project will also be needed to keep the role that the app project plays in apps in any namespaces. It could be something like .spec.allowAnnotatedSourceNamespaces. When this field is set to true it will allow for applications apart of this app project to deploy to annotated namespaces.

Another consideration is if a namespace has the label but is not listed in the --application-namespaces parameter and is used in the .spec.sourceNamespaces it should still be considered valid for more fine control if needed.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfeature:apps-in-any-namespaceIssues related to the "Apps in any namespace" feature introduced in 2.5triage/pendingThis issue needs further triage to be correctly classified

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions