Skip to content

Long names for Argo CD CRs causes Argo CD application controller not to start #2181

@cjcocokrisp

Description

@cjcocokrisp

Describe the bug

When testing my PR for adding sharding algorithm as a field. I went and created a a test CR with the name argocd-sharding-algorithm-test which is 30 characters long. When the operator creates the statefulset for the argocd instance managed by this CR it appends -application-controller to the name bringing the character total to 53.

Kubernetes creates a controller revision resource for statefulsets. The name of the controller revision resource seems to get stored as a label in the statefulset. Controller revisions append 11 more characters onto the name of the statefulset (a '-' then a random string of 10 characters for uniqueness). So for example in my case it becomes argocd-sharding-algorithm-test-76fd497866. This is 64 characters so it is over the max length for a label name. This causes the statefulset to fail to create with the below error:

  Type     Reason        Age                   From                    Message
  ----     ------        ----                  ----                    -------
  Warning  FailedCreate  53s (x16 over 3m37s)  statefulset-controller  Create Pod argocd-sharding-algorithm-test-application-controller-0 in StatefulSet argocd-sharding-algorithm-test-application-controller failed error: Pod "argocd-sharding-algorithm-test-application-controller-0" is invalid: metadata.labels: Invalid value: "argocd-sharding-algorithm-test-application-controller-76fd497866": must be no more than 63 bytes

I also tried to create a argo cd resource with over 63 characters as a name and everything there failed. When doing one around 55 characters to make sure the other argo cd components were fine which they were (they get truncated with a hash).

To Reproduce
Steps to reproduce the behavior:

  1. Create a Argo CD CR with the following manifest (this one will cause the application controller stateful set to not even get created):
apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  name: this-name-will-push-the-char-limit
spec:
  {}
  1. Check to see if the statefulset for the application controller is created

Expected behavior

When the operator creates the stateful set for the application controller, if the name is more then 29 characters it will be truncated like the rest of the components.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions