argoproj / argo-cd

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

Allow config management plugins to output a directory #2294

Open taharah opened 5 years ago

taharah commented 5 years ago

Is your feature request related to a problem? Please describe.

Currently, the generate command for config management plugins must output all manifests to STDOUT. In order to operate better with tools like Kapitan, plugins should be able to output and/or just modify a directory of manifests that Argo CD can utilize for deployment.

Describe the solution you'd like

Allow the generate command for configuration management plugins to be configured in such a way Argo CD knows it will output a directory of manifests rather than only allowing them to send the manifests to STDOUT.

Have you thought about contributing yourself?

Yes, I am more than happy to take a look at making the necessary changes myself.

alexec commented 5 years ago

Could you have a script that runs your plugin, and then does find . -type f -name '*.yaml' | xargs cat?

taharah commented 5 years ago

Yeah, I was going to do something like that for the time being, but it would be nice if it was available as a first-class feature to read in a set of files and/or directories.

alexec commented 5 years ago

ok, nice idea

augustfengd commented 2 years ago

Holy moly, leaving this here for posterity. find takes a special level of parsing and escaping:

---
generate:
  command:
  - find
  args:
  - "${REPLACEME}"
  - "-type" # predicates need to be by themselves.
  - "f"
  - "-exec"
  - "cat"
  - "{}"    # gfind: In ‘-exec ... {} +’ the ‘{}’ must appear by itself, but you specified ‘cat {}’ (gfind / 'foobar' -exec 'cat {}' +)
  - ";"     # "\;" wouldn't work. see alternatives: https://stackoverflow.com/a/26439638
  - "-exec"
  - "echo"
  - "---"
  - ";"

EDIT: In retrospect, it's probably less headache to just let the shell handle the parsing. e.g: ["/bin/sh", "-c", "find ..."]