-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make it possible to set release name different from argcd app name. #1066
Comments
We briefly considered this, but I think there may have been issue about the combination of:
I think the error scenario is:
|
That said, I do think this is a valid request. We are also facing similar issue about wanting to set release name in helm charts where |
This requests seems especially important when managing helm charts installed from a helm repository, instead of installing the chart from source. As a workaround I removed all references to |
I think it's fine to support releaseName, but we need to detect and error if the helm chart is using For example, this the following situation: Application Spec: apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: foo
spec:
source:
helm:
releaseName: bar Helm template: apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helm-test.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "helm-test.name" . }}
helm.sh/chart: {{ include "helm-test.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "helm-test.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "helm-test.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This feature can help to solve the issue with consistently naming resources across multiple clusters or namespaces, but only for helm applications. And indeed many newer charts do use .Release.name in app.kubernetes.io/instance. A more general fix would be to decouple application resource name from the deployed application name and make the latter scoped with destination server and namespace values. |
@jessesuen I am a little out of the loop on why argocd needs/wants to use |
@jessesuen So will it make sense to use another label, specific to ArgoCD in order to save the application name on the deployment (and other resources)? |
I originally thought this was an issue too, but most Helm Charts actually have the option to override the name of the resources created, generally called something like
Does this maybe solve your problem already? |
@muenchdo If you follow the |
Ok. Reviewing @jessesuen comments, the key thing we need to consider is what to do if the chart uses Options:
(1) is a quick doc-only fix. I expect (3) is only marginally more work than (3). @lcostea @jessesuen - thoughts? |
Only no 3. is safe, the others can lead to big problems. What about: |
I'd considered (4), but I believe would break any existing installation, and we ought to support our users. Thoughts? |
Indeed, it would break current installations, but on the long run seems to be a better choice. |
The label can already be configurable to something other than |
Here is how to do it: NOTE: Once you change the label key, all apps are out of sync until the next sync. |
@jessesuen what do you think of the related PR? |
@jessesuen It's great that we can override the |
The motivation for using On the other hand, I agree there is definitely some friction about the use of these labels and how it is causing issues with other popular deployment tools, namely helm, which is one of the reasons we made this configurable.
I think that may be too heavy handed. The error needs to be chart dependent. There are many legacy charts which do not use
For PR #1682, either we need to add the more sophisticated error logic I described above, or we don't error at all, and leave it to documentation. However this is potential gotcha for anyone using Argo CD with helm. In retrospect, choosing to use |
Also, we have thought about using a different way to detect what is considered a related resource of an applcation, which wouldn't involve label injection. Since v0.11, Argo CD no longer required that the resource association to be a label, and I think we even thought about switching to an annotation, or ownership reference. I believe this was supposed to be: #1482 |
We're using Kustomize to build our projects and have stumbled over an issue where our project names are auto-generated based on various attributes but are > 63 characters and thus break the instance label. Having an option to override the label target doesn't really solve this problem as the label will still be too long. We are creating a workaround where names are hashed and during the construction of the application.yamls but ArgoCD doesn't appear to check that the dynamically inserted values are valid per Kubernetes spec on labels. |
/reopen |
Looks like this is possible using the releaseName? |
how to set releaseName if a plugin is used? |
@makarov-roman since your plugin is in full control of the parameters passed to Helm, you can set the release name however you like. Plugins can accept parameters and pass them to the plugin command as env vars. |
Now the argocd app name is used as release name in the helm templating. It would be great if it is possible to use a seperate app name and release name like this:
argocd create app artifactory-prd --release-name artifactory ....
This way we can create apps for production cluster and test cluster with the same release name.
Reason we need this is that not all helm charts have the possibility to use the nameOverride parameter.
The text was updated successfully, but these errors were encountered: