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

When ServerSideDiff is enabled, modifying a service or container port number results in "duplicate" error. Diff cannot complete. #17717

Open
3 tasks done
avo-sepp opened this issue Apr 3, 2024 · 8 comments
Labels
bug Something isn't working component:core Syncing, diffing, cluster state cache server-side-diff version:2.14 Latest confirmed affected version is 2.14

Comments

@avo-sepp
Copy link
Contributor

avo-sepp commented Apr 3, 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

When ServerSideDiff BETA is enabled, changing the pod or service port number without changing the name of the port results in an error stating duplicate "port name". The expected behavior would be that the port is overwritten by apply.

To Reproduce

Deploy a pod and service with ArgoCD, enable ServerSideDiff beta for ArgoCD. Then try and change just the port number for the service + container without changing the name of the port/service.

Expected behavior

ArgoCD should rewrite the Pod/Container and Service with the updated pod number.

Version

argocd: v2.10.4+f5d63a5.dirty
BuildDate: 2024-03-18T09:28:41Z
GitCommit: f5d63a5
GitTreeState: dirty
GoVersion: go1.22.1
Compiler: gc
Platform: darwin/arm64
argocd-server: v2.10.5+335875d
BuildDate: 2024-03-28T15:02:45Z
GitCommit: 335875d
GitTreeState: clean
GoVersion: go1.21.3
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

Screenshots
Screenshot 2024-04-03 at 11 00 05

Logs

Failed to compare desired state to live state: failed to calculate diff: error calculating server side diff: serverSideDiff error: error running server side apply in dryrun mode for resource Deployment/workerservice-prod-uc-http-service: Deployment.apps "workerservice-prod-uc-http-service" is invalid: spec.template.spec.containers[0].ports[1].name: Duplicate value: "http"
@avo-sepp avo-sepp added the bug Something isn't working label Apr 3, 2024
@avo-sepp
Copy link
Contributor Author

avo-sepp commented Apr 3, 2024

Just for FYI, Force and Replace did not fix the issue in ArgoCD. I had to manually delete the service in Kubernetes. Not a possibility for production systems.

@jgwest jgwest added the component:core Syncing, diffing, cluster state cache label Apr 4, 2024
@klemmster
Copy link
Contributor

This also happens when changing the port name, not the number

@zswanson
Copy link

Verified having this issue. Moreover, deleting the 'conflicting' object is only a 1 time fix. It continues to happen on every sync.

@BarAshkenazi
Copy link
Contributor

BarAshkenazi commented Sep 29, 2024

Confirming that I was able to reproduce this issue as well on version 2.12.3, a fix will be beneficial

@NiklasRosenstein
Copy link

NiklasRosenstein commented Oct 16, 2024

Same here, I was about to update Immich on my server, they changed the port number. Instead of replacing the ports entirely, the new item is appended ...? I don't see how this would be intentional semantics.

image

image

image

I also have the same issue for a Deployment's container's ports list (also in Immich, same port number change).

@andrii-korotkov-verkada
Copy link
Contributor

ArgoCD versions 2.10 and below have reached EOL. Can you upgrade and tell us if the issue is still present, please?

@andrii-korotkov-verkada andrii-korotkov-verkada added the version:EOL Latest confirmed affected version has reached EOL label Nov 11, 2024
@BarAshkenazi
Copy link
Contributor

@andrii-korotkov-verkada
I was able to reproduce this issue as well on version 2.12.3

@andrii-korotkov-verkada andrii-korotkov-verkada added version:2.12 Latest confirmed affected version is 2.12 and removed version:EOL Latest confirmed affected version has reached EOL labels Nov 12, 2024
@n9
Copy link

n9 commented Feb 26, 2025

@andrii-korotkov-verkada Still not working in 2.14.2.

In my case it seems to be caused by the traefik/traefik-helm-chart#1239, which has changed the default port.

Failed to compare desired state to live state: failed to calculate diff: error calculating server side diff: serverSideDiff error: error running server side apply in dryrun mode for resource Deployment/traefik: Deployment.apps "traefik" is invalid: spec.template.spec.containers[0].ports[2].name: Duplicate value: "traefik"

(For others) The workaround is to temporarily change controller.diff.server.side to false in ConfigMap argocd-cmd-params-cm.

@andrii-korotkov-verkada andrii-korotkov-verkada added version:2.14 Latest confirmed affected version is 2.14 and removed version:2.12 Latest confirmed affected version is 2.12 labels Feb 26, 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:core Syncing, diffing, cluster state cache server-side-diff version:2.14 Latest confirmed affected version is 2.14
Projects
None yet
Development

No branches or pull requests

9 participants