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

ArgoCD CLI diff shows installationID annotations when there is a diff on all resources #22409

Open
3 tasks done
afarbos opened this issue Mar 19, 2025 · 0 comments
Open
3 tasks done
Labels
bug Something isn't working component:cli Affects the Argo CD CLI component:diffing

Comments

@afarbos
Copy link
Contributor

afarbos commented Mar 19, 2025

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

When argocd diff app CLI return a difference, if the resource tracking is annotation+label and installationID is set, the diff will include a diff on all resource showing a removal of the instanceID annotation.

To Reproduce

$ kind create cluster
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.32.2) 🖼
 ✓ Preparing nodes 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
$ helm upgrade --install argocd argo/argo-cd  -n argocd --create-namespace --set configs.cm.application\\.resourceTrackingMethod=annotation+label --set configs.cm.installationID=local-argocd
$ Release "argocd" does not exist. Installing it now.
NAME: argocd
LAST DEPLOYED: Wed Mar 19 08:34:50 2025
NAMESPACE: argocd
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
In order to access the server UI you have the following options:

1. kubectl port-forward service/argocd-server -n argocd 8080:443

    and then open the browser on http://localhost:8080 and accept the certificate

2. enable ingress in the values file `server.ingress.enabled` and either
      - Add the annotation for ssl passthrough: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-1-ssl-passthrough
      - Set the `configs.params."server.insecure"` in the values file and terminate SSL at your ingress: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-2-multiple-ingress-objects-and-hosts


After reaching the UI the first time you can login with username: admin and the random password generated during the installation. You can find the password by running:

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

(You should delete the initial secret afterwards as suggested by the Getting Started Guide: https://argo-cd.readthedocs.io/en/stable/getting_started/#4-login-using-the-cli)
$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d | pbcopy
$ kubectl port-forward service/argocd-server -n argocd 8080:443                                                                                                                                                                                                                                                                   Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
Handling connection for 8080
...
$ argocd login localhost:8080
WARNING: server certificate had error: tls: failed to verify certificate: x509: certificate signed by unknown authority. Proceed insecurely (y/n)? y
Username: admin
Password:
'admin:login' logged in successfully
Context 'localhost:8080' updated
$ kubectl apply -f - <<EOF
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: guestbook
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
EOF
$ argocd app sync guestbook
TIMESTAMP                  GROUP        KIND   NAMESPACE                  NAME    STATUS    HEALTH        HOOK  MESSAGE
2025-03-19T08:38:44-07:00            Service   guestbook          guestbook-ui  OutOfSync  Missing
2025-03-19T08:38:44-07:00   apps  Deployment   guestbook          guestbook-ui  OutOfSync  Missing
2025-03-19T08:38:46-07:00          Namespace                         guestbook   Running   Synced              namespace/guestbook created
2025-03-19T08:38:46-07:00            Service   guestbook          guestbook-ui    Synced  Healthy
2025-03-19T08:38:46-07:00            Service   guestbook          guestbook-ui    Synced   Healthy              service/guestbook-ui created
2025-03-19T08:38:46-07:00   apps  Deployment   guestbook          guestbook-ui  OutOfSync  Missing              deployment.apps/guestbook-ui created
2025-03-19T08:38:46-07:00   apps  Deployment   guestbook          guestbook-ui    Synced  Progressing              deployment.apps/guestbook-ui created

Name:               argocd/guestbook
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          guestbook
URL:                https://argocd.example.com/applications/guestbook
Source:
- Repo:             https://github.com/argoproj/argocd-example-apps.git
  Target:           HEAD
  Path:             guestbook
SyncWindow:         Sync Allowed
Sync Policy:        Manual
Sync Status:        Synced to HEAD (4773b9f)
Health Status:      Progressing

Operation:          Sync
Sync Revision:      4773b9f1f8fd425f84174c338012771c4e9a989c
Phase:              Succeeded
Start:              2025-03-19 08:38:44 -0700 PDT
Finished:           2025-03-19 08:38:46 -0700 PDT
Duration:           2s
Message:            successfully synced (all tasks run)

GROUP  KIND        NAMESPACE  NAME          STATUS   HEALTH       HOOK  MESSAGE
       Namespace              guestbook     Running  Synced             namespace/guestbook created
       Service     guestbook  guestbook-ui  Synced   Healthy            service/guestbook-ui created
apps   Deployment  guestbook  guestbook-ui  Synced   Progressing        deployment.apps/guestbook-ui created
$ argocd app diff guestbook --revision fd70f16a43d8f14626329a4f687bc8f8f689e9f6
===== /Service guestbook/guestbook-ui ======
--- /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff1349009795/guestbook-ui-live.yaml	2025-03-19 08:39:04
+++ /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff1349009795/guestbook-ui	2025-03-19 08:39:04
@@ -2,7 +2,6 @@
 kind: Service
 metadata:
   annotations:
-    argocd.argoproj.io/installation-id: local-argocd
     argocd.argoproj.io/tracking-id: guestbook:/Service:guestbook/guestbook-ui
     kubectl.kubernetes.io/last-applied-configuration: |
       {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"argocd.argoproj.io/installation-id":"local-argocd","argocd.argoproj.io/tracking-id":"guestbook:/Service:guestbook/guestbook-ui"},"labels":{"argocd.argoproj.io/instance":"guestbook"},"name":"guestbook-ui","namespace":"guestbook"},"spec":{"ports":[{"port":80,"targetPort":80}],"selector":{"app":"guestbook-ui"}}}

===== apps/Deployment guestbook/guestbook-ui ======
--- /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff2998763614/guestbook-ui-live.yaml	2025-03-19 08:39:04
+++ /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff2998763614/guestbook-ui	2025-03-19 08:39:04
@@ -1,8 +1,7 @@
-apiVersion: apps/v1
+apiVersion: apps/v1beta2
 kind: Deployment
 metadata:
   annotations:
-    argocd.argoproj.io/installation-id: local-argocd
     argocd.argoproj.io/tracking-id: guestbook:apps/Deployment:guestbook/guestbook-ui
     deployment.kubernetes.io/revision: "1"
     kubectl.kubernetes.io/last-applied-configuration: |

Expected behavior

Here is the diff I would have expected:

$ argocd app diff guestbook --revision fd70f16a43d8f14626329a4f687bc8f8f689e9f6
===== apps/Deployment guestbook/guestbook-ui ======
--- /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff2998763614/guestbook-ui-live.yaml	2025-03-19 08:39:04
+++ /var/folders/qx/7sdk5qzj5vbg49s4vp71_pyh0000gp/T/argocd-diff2998763614/guestbook-ui	2025-03-19 08:39:04
@@ -1,8 +1,7 @@
-apiVersion: apps/v1
+apiVersion: apps/v1beta2
 kind: Deployment
 metadata:
   annotations:
     argocd.argoproj.io/installation-id: local-argocd
     argocd.argoproj.io/tracking-id: guestbook:apps/Deployment:guestbook/guestbook-ui
     deployment.kubernetes.io/revision: "1"
     kubectl.kubernetes.io/last-applied-configuration: |

Screenshots

See Expected behavior

Version

$ argocd version
argocd: v2.14.3+71fd4e5
  BuildDate: 2025-02-28T19:57:20Z
  GitCommit: 71fd4e501d0d688ab0d70cd649fbf5f909cff12b
  GitTreeState: clean
  GoVersion: go1.24.0
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.14.5+f463a94
  BuildDate: 2025-03-11T03:15:56Z
  GitCommit: f463a945d57267e9691cede37021d9ddc5994f36
  GitTreeState: clean
  GoVersion: go1.23.3
  Compiler: gc
  Platform: linux/arm64
  Kustomize Version: v5.4.3 2024-07-19T16:40:33Z
  Helm Version: v3.16.3+gcfd0749
  Kubectl Version: v0.31.0
  Jsonnet Version: v0.20.0

Logs

N/A

@afarbos afarbos added the bug Something isn't working label Mar 19, 2025
@agaudreault agaudreault added component:cli Affects the Argo CD CLI component:diffing labels Mar 21, 2025
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 component:diffing
Projects
None yet
Development

No branches or pull requests

2 participants