argoproj / argo-cd

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

Perform a diff against the live state and a particular revision of a helm app with new values #6942

Open GagarinX opened 3 years ago

GagarinX commented 3 years ago

Summary

There should be a possibility to perform a diff against the live state and a particular revision of a helm app using new values.

For example, I have the following Application deployed:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp
spec:
  destination:
    namespace: myapp
    server: 'https://kubernetes.default.svc'
  source:
    repoURL: 'https://helm.example.com'
    targetRevision: 0.9.0
    chart: myapp
    helm:
     values: |
       configmap:
         foo: bar
  project: default

Say I want to update the values and see what difference will it make, without pushing the updated Application manifest to the git branch that ArgoCD is tracking (e.g. main). So I push the updated manifest to a branch, changing the values like this:

source:
    helm:
     values: |
       configmap:
         key1: value1
         key2: value2

AFAIK I have no way to perform a diff against the manifest in the branch, because there is no such option for argocd app diff command. I can only pass another helm chart version in the --revision option, and it will not take in consideration the new values from the updated manifest in the branch.

Motivation

This feature is crucial to the deployment pipeline that we currently try to make:

Proposal

When using argocd app diff --revision on a helm Application, we should pass a git commit SHA to a --revision option instead of helm chart version (just like we do when the app type is kustomize). ArgoCD then should checkout the Application manifest from the given commit, and perform a diff using the targetRevision AND values from this manifest.

musabmasood commented 3 years ago

Why not just push the new values you want to that branch in a values file and simply pass --revision=<your-new-branch> in argocd app diff ?

GagarinX commented 3 years ago

@musabmasood If an Application's source is helm repository, I can't pass my-new-branch in --revision, it only accepts chart version.