Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Enhancement - Conditional plugin support #168

Open
rbkaspr opened this issue Mar 24, 2021 · 3 comments
Open

Enhancement - Conditional plugin support #168

rbkaspr opened this issue Mar 24, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@rbkaspr
Copy link

rbkaspr commented Mar 24, 2021

What's the issue?

For some organizations, a monorepo of application manifests can contain a mix of different deployment mechanisms, especially when different teams with different preferences for things like Helm/Kustomize/etc are handling different deployments. If each of those deployments uses a standard structure that Argo natively understands, ApplicationSets can handle that with no issue.

However, if some of those manifests require special deployment logic (kustomized-helm, for example), the current ApplicationSet generators are basically all-or-nothing deals, mainly because of the fact that pluginSpec is a map and an ApplicationSpec can't just contain a name field with an empty string (otherwise this could be handled by setting or not setting a plugin value in settings file if we were using the git file generator.

(Potential) Solution: Allow maps to be substituted

The current git file generator only seems to support substituting values as strings, adding map support could address this use case (and potentially others down the line)

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: sample
spec:
  generators:
  - git:
      repoURL: https://github.com/argoproj-labs/applicationset.git
      revision: HEAD
      files:
      - path: "examples/git-generator-files-discovery/cluster-config/**/config.json"
  template:
    metadata:
      name: '{{cluster.name}}-guestbook'
    spec:
      project: default
      source:
        repoURL: https://github.com/argoproj-labs/applicationset.git
        targetRevision: HEAD
        path: "examples/git-generator-files-discovery/apps/guestbook"
      destination:
        server: https://kubernetes.default.svc
        namespace: guestbook
        '{{ plugin }}'

If we want to include a plugin, we add this to our config.json for a given app

{
  "plugin": {
    "name": "kustomized-helm"
  }
}

If not, we either explicitly set plugin to be empty {}, or else omit the key, and the generator can just drop the plugin field from the generated ApplicationSpec

@gajus
Copy link

gajus commented Jan 31, 2022

@rbkaspr Did you ever a figure out a workaround for this?

I am in a similar boat where the entire cluster is deployed using a single ApplicationSet utilizing Helm. However, one of the deployments requires Kustomize and that means I need to either deploy it separately or add kustomization.yaml for every project. Neither is ideal.

@martijnvdp
Copy link

martijnvdp commented May 22, 2023

anyone found a workaround maybe with the latest changes as the gotemplate sprig functions https://github.com/Masterminds/sprig ?
Or another workaround that allows applications with or without plugins from the same application set?

also noticed plugin: {} does not work the whole key should be ommited

else this would work as this results in 'plugin

spec:
  goTemplate: true      
  source:
    path: mypath
    plugin:
      name: '{{default "" .pluginName}}'	

with a json

{
  pluginName: "myplugin"
}

if no pluginName var is specified it wil result in plugin: {}
but that still gives an error in argocd

rpc error: code = Unknown desc = Manifest generation error (cached): plugin sidecar failed. could not find plugin supporting the given repository

@amrap030
Copy link

amrap030 commented Sep 25, 2023

Hello, is there already a solution to this problem available? I have the same requirement. Otherwise, I am not able to use the ApplicationSet Git Generator pattern when I have helm and kustomize applications in my repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants