argoproj / argo-helm

ArgoProj Helm Charts
https://argoproj.github.io/argo-helm/
Apache License 2.0
1.72k stars 1.86k forks source link

Argo CD Helm chart: StatefulSet serviceName refers to missing service. #2302

Open harryw opened 1 year ago

harryw commented 1 year ago

Describe the bug

I found that the serviceName in the StatefulSet argocd-application-controller refers to a Service that doesn't exist.

Essentially this StatefulSet template points to a Service with the same name, but there's no matching Service template. I'm not familiar enough with Argo CD's setup to guess what the intention is, but it seems like an error.

This issue does not actually exhibit any symptoms for me. I discovered this while testing out K8sGPT, which highlighted the issue:

0 argocd/argocd-application-controller(argocd-application-controller)
- Error: StatefulSet uses the service argocd/argocd-application-controller which does not exist.
Error: The StatefulSet is using a service called argocd/argocd-application-controller which does not exist.

Solution: 

1. Verify that the service argocd/argocd-application-controller is actually missing.
2. If it is missing, create the service using the correct configuration.
3. Update the StatefulSet to use the newly created service.

At first I thought K8sGPT might be wrong but on investigation it seems to be telling the truth.

Related helm chart

argo-cd

Helm chart version

5.46.8

To Reproduce

Install the Argo CD helm chart with default values.

Examine the argocd-application-controller stateful set. The serviceName is argocd-application-controller.

There is no service named argocd-application-controller. There's one named argocd-applicationset-controller, and I didn't see the difference at first.

Expected behavior

serviceName should refer to a service that exists.

Screenshots

No response

Additional context

No response

DrFaust92 commented 11 months ago

FYI, While you are right and this is unused, it seems that its a breaking change to remove that field

pdrastil commented 11 months ago

Hi - this might be wrong and is caused by switch from Deployment to StatefulSet that happened in upstream a year ago. The manifest contains TODO that there are more things from that era that should be fixed when we do next breaking release. Anyway good catch - thank you.

ForbiddenEra commented 7 months ago

This confused the heck out of me since the k8s docs say:

StatefulSets currently require a [Headless Service](https://kubernetes.io/docs/concepts/services-networking/service/#headless-services) to be responsible for the network identity of the Pods. You are responsible for creating this Service.

Surprised it not broke-ing stuffs.

aleMaqueda commented 5 months ago

I inspected the statefulset and only create the service with the port defined in the statefulset (8082) kubectl get statefulset argocd-application-controller -n argocd -o yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/component: applicationset-controller
    app.kubernetes.io/name: argocd-application-controller
    app.kubernetes.io/part-of: argocd
  name: argocd-application-controller
  namespace: argocd
spec:
  ports:
  - port: 8082
    protocol: TCP
  selector:
    app.kubernetes.io/name: argocd-application-controller
  sessionAffinity: None
  type: ClusterIP