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

new multi-source app diff cli feature: no diff when it should #18013

Open
3 tasks done
thomas-riccardi opened this issue Apr 29, 2024 · 4 comments
Open
3 tasks done

new multi-source app diff cli feature: no diff when it should #18013

thomas-riccardi opened this issue Apr 29, 2024 · 4 comments
Labels
bug Something isn't working component:cli Affects the Argo CD CLI multi-source-apps Bugs or enhancements related to multi-source Applications.

Comments

@thomas-riccardi
Copy link

thomas-riccardi commented Apr 29, 2024

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

I tried the new multi-source app diff feature from #17650, and the diff is unexpectedly empty with --revisions and --source-positions, whereas we do have the correct diff with --revision.

On a private App with 3 sources, the diff is even stranger: as if it completely removed the resources for the first source (it's a helm release with value.yaml file from the 3rd source, using ref).

To Reproduce

setup:

  • argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
  • (argocd app diff guestbook shows the full manifest to add, because not yet sync: OK)
  • argocd app sync guestbook
  • (argocd app diff guestbook shows empty diff: OK)

tests: with an older revision:

$ argocd app diff guestbook  --revision fd70f16a43d8f14626329a4f687bc8f8f689e9f6

===== apps/Deployment default/guestbook-ui ======
--- /tmp/argocd-diff3285957672/guestbook-ui-live.yaml   2024-04-29 13:53:09.561992217 +0200
+++ /tmp/argocd-diff3285957672/guestbook-ui     2024-04-29 13:53:09.561992217 +0200
@@ -1,4 +1,4 @@
-apiVersion: apps/v1
+apiVersion: apps/v1beta2
 kind: Deployment
 metadata:
   annotations:

=> expected

$ argocd app diff guestbook  --revisions fd70f16a43d8f14626329a4f687bc8f8f689e9f6 --source-positions 1
$

=> empty diff

Expected behavior

  • I expect to get the same output with --revision xxx vs --revisions xxx --source-positions 1 for mono-source app.
  • I expect diff on multi-source app to work as intended: proper diff

side note:

  • I expect --revisions xxx --source-positions 2 to raise an error when there is only one source
  • argocd app manifests guestbook --revisions fd70f16a43d8f14626329a4f687bc8f8f689e9f6 --source-positions 1 returns the wrong manifest: same as live/HEAD

Version

argocd: v2.11.0-rc2+24ef777
  BuildDate: 2024-04-15T20:05:04Z
  GitCommit: 24ef7775e79a6ec20b441544aacf8d9d727a676f
  GitTreeState: clean
  GoVersion: go1.21.9
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.11.0-rc2+24ef777
  BuildDate: 2024-04-15T19:43:50Z
  GitCommit: 24ef7775e79a6ec20b441544aacf8d9d727a676f
  GitTreeState: clean
  GoVersion: go1.21.9
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.14.3+gf03cc04
  Kubectl Version: v0.26.11
  Jsonnet Version: v0.20.0
@thomas-riccardi thomas-riccardi added the bug Something isn't working label Apr 29, 2024
@thomas-riccardi
Copy link
Author

I reproduce the issue with the new rc3:

argocd: v2.11.0-rc3+20fd621
  BuildDate: 2024-04-29T20:18:11Z
  GitCommit: 20fd621aa20d546378d4643862054307773a1dd0
  GitTreeState: clean
  GoVersion: go1.21.9
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.11.0-rc3+20fd621
  BuildDate: 2024-04-29T19:57:20Z
  GitCommit: 20fd621aa20d546378d4643862054307773a1dd0
  GitTreeState: clean
  GoVersion: go1.21.9
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.14.3+gf03cc04
  Kubectl Version: v0.26.11
  Jsonnet Version: v0.20.0

@ishitasequeira
Copy link
Member

@thomas-riccardi , I am curious to see the app spec you are creating. Based on the step mentioned in setup, the command
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default would create a single source app and not a multi-source app.

I also just tried the command on release 2.11.0-rc3 locally and below is what I see the diff as post sync:

 % ./dist/argocd app diff guestbook --revisions 4171e73dec711bde9a130398d3cfc93363b16339 --source-positions 1

===== apps/Deployment default/guestbook-helm-guestbook ======
133c133
<   replicas: 4
---
>   replicas: 3

Can you share an example of the application that I could use to see the issue?

@ishitasequeira ishitasequeira added multi-source-apps Bugs or enhancements related to multi-source Applications. component:cli Affects the Argo CD CLI labels May 1, 2024
@thomas-riccardi
Copy link
Author

@ishitasequeira

I am curious to see the app spec you are creating

Indeed my reproduction here came after my initial issue with private app. My hope is that fixing the issue with mono-source apps would also fix my issue with multi-source app.

Here is an anonymized version of my private multi-source app:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo
  namespace: argocd
  ownerReferences:
  - apiVersion: argoproj.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: ApplicationSet
    name: foo-appset
spec:
  destination:
    namespace: foo
    server: https://kubernetes.default.svc
  project: myproject
  sources:
  - helm:
      releaseName: my-helm-release
      valueFiles:
      - $values/some/path/to/value.yaml
      values: |
        more: values
    path: charts/some-chart/
    repoURL: https://github.com/bar/foo-helm-charts
    targetRevision: main
  - path: /baz
    repoURL: https://github.com/bar/other-resources-to-load
    targetRevision: main
  - ref: values
    repoURL: https://github.com/bar/foo-values
    targetRevision: main
  syncPolicy:
    syncOptions:
    - CreateNamespace=true

I also just tried the command on release 2.11.0-rc3 locally and below is what I see the diff as post sync:

Maybe it's related to the way we deploy our argocd? (with the helm chart); so I tried with kind locally:

$ kind version
kind v0.22.0 go1.20.13 linux/amd64
$ kind create cluster
$ kubectl get node
NAME                 STATUS   ROLES           AGE   VERSION
kind-control-plane   Ready    control-plane   22s   v1.29.2
$ kubectl apply -n argocd -f https://github.com/argoproj/argo-cd/raw/master/manifests/install.yaml
$ kubectl port-forward svc/argocd-server -n argocd 8080:443 &
$ argocd admin initial-password -n argocd
$ argocd login localhost:8080
# I then saw it was not the rc3, so I (down?)graded to 2.11.0-rc3:
$ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.11.0-rc3/manifests/install.yaml
# wait pod ready

=> Then I reproduce as in my initial comment: result: I still get the bug: no diff with the new options.

@jon-rei
Copy link

jon-rei commented May 13, 2024

On a private App with 3 sources, the diff is even stranger: as if it completely removed the resources for the first source (it's a helm release with value.yaml file from the 3rd source, using ref).

I just upgraded to ArgoCD v2.11 and wanted to try out this new feature and I'm facing the same problem. In ArgoCD I have several apps with two sources, one a helm chart and the other values in a git repository. When I run argocd app diff my-app --revisions 1234 --source-positions 1 --revisions 1234 --source-positions 2 the diff shows me that everything is removed (the revisions I tested against where some where no changes should be expected).

My application spec is basically looking the same as the one posted by @thomas-riccardi, except I only use one additional repoURL source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:cli Affects the Argo CD CLI multi-source-apps Bugs or enhancements related to multi-source Applications.
Projects
None yet
Development

No branches or pull requests

3 participants