argoproj / argo-cd

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

Support of --set-file during the Helm install/upgrade process #11372

Closed sysarch-repo closed 2 years ago

sysarch-repo commented 2 years ago

Summary

Deployment specific artifacts (e.g. config files, kestores) are linked into the Helm install/upgrade task using the --set-file parameter that associates a values parameter with the external text file, e.g. --set-file global.cfgFile=myCfg.json

Such option does not exist in ArgoCD that only provides for one or more values.yaml files. With this, the config file must be embedded in (one of) the values.yaml files, e.g:

global:
  cfgFile: |
    <file content>

This is problematic because of the overhead for creating the envelope. Config files and keystores are delivered as content-only and the values.yaml envelope needs a time-consuming indentation of the file content.

Motivation

Argo CD shall support adding deployment artifacts to the already deployed system without the need to do manual work. Once the new deployment artifact shows up on the repo, Argo CD shall automatically trigger the upgrade task with the added files considered.

Proposal

The proposal is adding a new object in source.helm of the application CR, e.g. source.helm.files that sources the set-file stringArray during the Helm task as it is the case for valueFiles supported today. Note, even the valueFiles is an array in the CR, it supports items containing multiple strings separated by comma. This shall be supported also for the new source.helm.files parameter. Example:

GIT - rollout.json

{
  "namespace": "ns1",
  "releaseName": "r1",
  "valueFiles": "value1.yaml,values2.yaml,values3.yaml",
  "files": "par1=path1,par2=path2,par3=path3"
}

Application set:

  generators:
  - git:
      repoURL: https://github.com/sysarch-repo/cd
      revision: HEAD
      files:
      - path: "rollout.json"
  template:
    spec:
      source:  
        helm:
          releaseName: '{{releaseName}}'
          valueFiles:
          - '{{valueFiles}}'
          files:  <<--- the add on
          - '{{files}}'  

Any other implementation proposal is welcome to remove the manual work associated with this use case. Thank you.

sysarch-repo commented 2 years ago

Withdrawn - addressed using helm.fileParameters