Add support argoproj application names of more than 63 chars. It already works pre-sync, but when argocd injects this label it is limited by the k8s label spec of 63 char max.
Argocd requires unique application names to function. If you try to deploy the same app on multiple clusters and namespaces, we need to add metadata on the end so that it works (we use: {applicationname}.{ns}.{cluster} ).
The problem comes from the use of "application.instanceLabelKey", which is limited by the k8s label spec. Argocd uses the application name as it's value.
This is a known limitation of our use of labels as a way of tracking resources.
use an annotation in stead of a label for the instanceLabelKey
This is technically possible, but would require some surgery to support.
how hard do you estimate the fix @jessesuen ?
replacing simply the value of the label with a fix hash of 63character is not possible without changing everything ?
Potentially, since you guys already use : "crypto/sha256"
In GetAppInstanceLabelKey we could check the len of the label and if it's greater than 63, set it to something like :
label := sha256.Sum224([]byte(label)) which is a subset of sha256 and should be enough to avoid collisions.
We can even add : sha224- in front of the hash to make it clear that it's the hash of a name (which by coincidence, makes it a 63 chars label).
I've made a draft PR here : https://github.com/argoproj/argo-cd/pull/4051
Most helpful comment
Potentially, since you guys already use : "crypto/sha256"
In GetAppInstanceLabelKey we could check the len of the label and if it's greater than 63, set it to something like :
label := sha256.Sum224([]byte(label))which is a subset of sha256 and should be enough to avoid collisions.We can even add : sha224- in front of the hash to make it clear that it's the hash of a name (which by coincidence, makes it a 63 chars label).