-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support generateName for application resources #1639
Comments
What are reasons My use case for it: Alternatively I can run this in Concourse to update Concourse pipelines ;) The border of where it should be done is abstractive ;) |
You can read the discussion here: kubernetes/kubernetes#44501 The resolution was to document this limitation, rather than have |
@kwladyka I think you can achieve your use case even today, by specifying a single Job with the Sync hook annotation, and no "normal" application resources. |
Another important point for users interested in this feature, is that if you are using kustomize to manage configs, kustomize does not support generateName well. See: |
I've been able to workaround this behavior, at least in Kustomize v1, by patching in # kustomization.yaml
resources:
- job.yaml
patchesJson6902:
- path: patches/job-generate-name.yaml
target:
group: batch
version: v1
kind: Job
name: foo # job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: foo
spec: ... # patches/job-generate-name.yaml
- op: move
from: /metadata/name
path: /metadata/generateName and finally the compiled manifests: $ kustomize build
apiVersion: batch/v1
kind: Job
metadata:
generateName: foo
spec: ... Works like a charm so long as you don't try to modify the Job spec after the patch. |
Great tip! I'm going to reference your workaround in the original kustomize bug I filed |
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. |
as far as I can tell, ArgoCD supports jobs with |
For anybody stumbling across this and wondering which annotation you have to set refere to this: https://argoproj.github.io/argo-cd/user-guide/resource_hooks/ |
This doesn't seem to work for me, I still get I verified that my config is similar with yours. |
@jessesuen Is there any updates on this issue? I just tried to create a deployment using
I see Argo CD is able to correctly using Instead of the above annotation, I've also tried the following pair
The deployed was created in the cluster, but Argo CD was treating these as separate entities so the |
The workaround above works in kustomize 3.8.6 but not in the latest version 4.4.1, so I guess something changed in kustomize to break this. |
We have a workaround that we are using with relatively good success that works on all versions of kustomize that support |
Any progress on this? |
A common request is to support generateName in resources. Although
kubectl apply
does not work with generateName, Argo CD could have behavior that when it sees a resource withgenerateName
instead ofname
, it could decide to perform create instead.Note that resources created in this manner, would immediately cause the application to be OutOfSync, since Argo CD would consider these as "extra" resources that need to be pruned. To mitigate this, the user could use this feature to prevent the extra resource from contributing to the overall OutOfSync condition of the application as a whole.
With this feature, Argo CD could be used to trigger job runs by simply performing a sync.
Some areas of concern:
Also to note: it is already possible to have Argo CD create resources using
generateName
, but those resources need to use theargocd.argoproj.io/hook
annotation. e.g.:However, using resource hooks has the following limitations:
argocd app sync
from occurring. This would be undesirable for someone who just wants to kick off the job asynchronouslyThe text was updated successfully, but these errors were encountered: