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

Application Sets using project parameter from cluster secret #18814

Closed
allevimi opened this issue Jun 25, 2024 · 1 comment · Fixed by #20338
Closed

Application Sets using project parameter from cluster secret #18814

allevimi opened this issue Jun 25, 2024 · 1 comment · Fixed by #20338
Labels
bug/enhancement component:application-sets Bulk application management related enhancement New feature or request type:enhancement

Comments

@allevimi
Copy link

Summary

As described on Application Sets Cluster Generator, some parameters from cluster secret definition could be used as AppSet definition like name, server, labels, but optional project parmater it is not avilable.

Motivation

In my case, I have 3 project that identifies 3 gcp environment, their respective gke cluster have project secret parameter set as respective project name; after that I have an AppSet definition that uses a cluster generator that deploys common manifests for all clusters, but Application spec needs project field. At the moment I inserted a project label field and use it.

apiVersion: v1
kind: Secret
type: Opaque
metadata:
  labels:
    argocd.argoproj.io/secret-type: cluster
    environment: dev
    project: project1
  name: argocd-cluster-cluster1
  namespace: argocd
stringData:
  config: <config>
  name: cluster1
  project: project1
  server: http://server.local
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: app-set
  namespace: argocd
spec:
  goTemplate: true
  goTemplateOptions:
  - missingkey=error
  generators:
  - clusters: {}
  template:
    metadata:
      name: '{{.name}}-app-set'
    spec:
      destination:
        name: '{{.name}}'
      project: '{{index .metadata.labels "project"}}'
      source:
        path: app-set
        repoURL: https://repo.git
        targetRevision: main

Proposal

My proposal is to make available also project parameter from cluster secret definition, in order to have an Application Set definition like this

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: app-set
  namespace: argocd
spec:
  goTemplate: true
  goTemplateOptions:
  - missingkey=error
  generators:
  - clusters: {}
  template:
    metadata:
      name: '{{.name}}-app-set'
    spec:
      project: '{{.project}}'
      source:
        path: app-set
        repoURL: https://repo.git
        targetRevision: main
      destination:
        name: '{{.name}}'
@allevimi allevimi added the enhancement New feature or request label Jun 25, 2024
@alexmt alexmt added component:application-sets Bulk application management related type:enhancement labels Jun 25, 2024
@christianh814
Copy link
Member

This is a +1 for me and would support a PR that implements this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/enhancement component:application-sets Bulk application management related enhancement New feature or request type:enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants