Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diff command option for application path #7770

Open
devholic77 opened this issue Nov 23, 2021 · 1 comment
Open

Add diff command option for application path #7770

devholic77 opened this issue Nov 23, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@devholic77
Copy link

devholic77 commented Nov 23, 2021

Summary

I'm using argocd app diff command to verify argocd manifest in jenkins pipeline.
I checked the argocd app diff documentation, but there is no option for diff the live state and a helm app using new values.

For example, this application is in live state.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp
  namespace: argocd
spec:
  destination:
    namespace: myapp
    server: https://kubernetes.default.svc
  project: default
  source:
    repoURL: 'https://my-repo.com'
    targetRevision: v0.0.1
    helm:
      parameters:
      - name: externalUrl
        value: http://example.com
  project: default

when changed as follows, argocd app diff command didn't catch the changes

    helm:
      parameters:
      - name: externalUrl
-      value: http://example.com
+      value: http://other-exmaple.com

Motivation

I added the code referring to this code for test, It worked what I want. : )

if local != "" {
conn, clusterIf := clientset.NewClusterClientOrDie()
defer argoio.Close(conn)
cluster, err := clusterIf.Get(context.Background(), &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
errors.CheckError(err)
localObjs := groupObjsByKey(getLocalObjects(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins), liveObjs, app.Spec.Destination.Namespace)
items = groupObjsForDiff(resources, localObjs, items, argoSettings, appName)
} else if revision != "" {

			if local != "" {
+ 	                        newApp, err := cmdutil.ConstructApps( {{ application_manifest_path }} , appName, labels, annotations, args, appOpts, nil)
				conn, clusterIf := clientset.NewClusterClientOrDie()
				defer argoio.Close(conn)
				cluster, err := clusterIf.Get(context.Background(), &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
				errors.CheckError(err)
-				localObjs := groupObjsByKey(getLocalObjects(app, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins, argoSettings.TrackingMethod), liveObjs, app.Spec.Destination.Namespace)
+                               localObjs := groupObjsByKey(getLocalObjects(newApp, local, localRepoRoot, argoSettings.AppLabelKey, cluster.ServerVersion, argoSettings.KustomizeOptions, argoSettings.ConfigManagementPlugins, argoSettings.TrackingMethod), liveObjs, app.Spec.Destination.Namespace)
				items = groupObjsForDiff(resources, localObjs, items, argoSettings, appName)
			} else if revision != "" {

Proposal

through the previous test, I think we need an option for this.
What if options like --local-appare added?

@devholic77 devholic77 added the enhancement New feature or request label Nov 23, 2021
@devholic77 devholic77 changed the title Add diff command option for application path WIP: Add diff command option for application path Nov 23, 2021
@devholic77 devholic77 changed the title WIP: Add diff command option for application path Add diff command option for application path Nov 23, 2021
@devholic77 devholic77 reopened this Nov 23, 2021
@gw0
Copy link

gw0 commented Feb 11, 2022

If I understand correctly, many argocd app diff issues are seem to be related (#4706, #4703, #7770, #6942, #6167, #5532).

Basically, we need an option to provide the whole App manifest (not just an option to update the revision). You are proposing that this is done client-side that looks like a trivial change, the PR #6247 does some magic on server-side, some others are also proposing server-side due to binary version incompatibilities.

I managed to pull together a manual workaround that basically renders on server-side, but does the diff client-side, see #4706 (comment).

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

No branches or pull requests

2 participants