argoproj / argo-cd

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

Being selective with jsonnet file to render #3947

Open ghostsquad opened 4 years ago

ghostsquad commented 4 years ago

Summary

Per the documentation:

Any file matching *.jsonnet in a directory app is treated as a Jsonnet file. ArgoCD evaluates the Jsonnet and is able to parse a generated object or array.

https://argoproj.github.io/argo-cd/user-guide/jsonnet/

I would like to have multiple .jsonnet files in my repo but for different purposes, and I don't want ArgoCD to find/render all of them.

Motivation

I used jsonnet to render all sorts of configuration, not just kubernetes manifests.

Proposal

Declarative syntax or CLI flag to specific path(s) or pattern of jsonnet files to look for. Alternatively, each jsonnet file may have different TLA's, so this should be flexible in that regard too.

alexmt commented 4 years ago

Hello @ghostsquad ,

In Argo CD v1.8 we've added exclude settings to directory-based application sources. E.g.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
spec:
  source:
    directory:
      recurse: true
      exclude: 'glob-expression'

So in v1.8 you can exclude all files except the required one. This is not perfect though. I think we just need to add include. Do you agree it will cover your use case?

ghostsquad commented 4 years ago

does exclude work like .gitignore? such that I can do something like:

*
!/kubernetes/*.jsonnet

?

ghostsquad commented 4 years ago

I do agree that it would be nice to have an include as well. Though * + ! is essentially "exclude everything except"