-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Kustomize doesn't support metadata.generateName #641
Comments
#627 is about names, but currently i see it as a feature request. This bug and #586 are noting that kustomize doesn't recognize the kubernetes API directive This directive is a kustomize-like feature introduced before kustomize... (complicating our life). We might try to allow it and work with it - or disallow it and provide an alternative mechanism. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten I wanted to use generateName with kustomize but I can't :( |
I wanted to use generateName with kustomize too. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This issue should be reopened unless it has been solved and the docs don't show it. |
Agreed, let's re-open and solve the issue. |
anybody can open with @k8s-ci-robot robot command. I've already opened, I don't want to flood it :) |
/reopen I've just stumbled across this issue as well, and would appreciate a fix or an alternative mechanism (as mentioned by monopole above). |
@haimberger: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen sigh. |
@Datamance: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can someone with The Power reopen this? Still outstanding AFAICT. |
/remove-lifecycle rotten |
Still no work around yet for this. I find myself moving from kustomize to helm charts just because of this 🤦🏿 |
I don't want to get anyone's hopes up, but here's a PR that works in local testing: #4981. I don't understand |
Looks like these questions on #4838 need answering and comprehensive tests need implementing. It's not just a case of changing the validation to allow it. |
Indeed, my PR was too naive there, oh well. I closed it and hope #4838 moves forward. |
I also have just run into this issue while attempting to use |
I am pasting my comment from #4838 (comment) for visibility:
I think to move this issue forward we would need a mini in-repo KEP to fully flesh out all of these details. |
this leads to: I'm using kustomize v5 |
/assign |
Sorry, the issue is a bit too complicated for me. I may come back later, but please take it if anyone else can 🙇 |
I also ran into same issue with argocd |
this same issue is happening if you try to kustomize the knative-operator as it requires a job
this does limit the usability of kustomize for this usecase unfortunately, and with this being a built in for kubectl i would expect it to at least match the current rules defined for the builtin spec's is there anything "chop wood, carry water" that i can do to help move this forwards? |
it should be able to interact with namePrefix but I'm 100% ok with being ignored by both if we can get the functionally working.
This ^
This is also a valid usecase
we should be able to modify the /metadata/generateName field in the same way we could the /metadata/name field using patches
we should be able to modify the /metadata/generateName field in the same way we could the /metadata/name field using replacements.
kustomize should not allow multiple like-kind resources example
I don't know enough to state my opinion on this ^ |
Also ran into this issue. |
And 5 years later we have no solution. |
Not sure what's the best way to get developer's attention to this... Maybe opening a discussion? Is there an official slack? |
We also just ran into this. All related PR's got closed so what's the plan now? What exactly can we do to bring this forward? |
I'm working on a project where Kustomize was selected for ArgoCD. We were hoping to extend its use to our Argo Workflows but this is a significant impediment. Deleting previous workflow instances as was suggested in one comment does not align with our operational requirements. I'm sure there are plenty of usecases outside of Argo Workflow that are also affected by this issue. |
Please provide a solution or how we can support the kustomize team closing this issue - it is blocking our pipeline development in Argo Workflow at this moment as we want to kustomize pipelines. |
I ran into this. I want found the solution but failed. I tried like below and be OK!
|
Oh. No, it just ok for |
Kubectl kustomize is literally kustomize. And the one in argocd as well. There is no difference, except for the version that is used. |
Repeating what I wrote in #641 (comment): To move this issue forward we would need a mini in-repo KEP to fully flesh out all the design and implementation details of how this feature would be handled. |
The interesting part is, who writes that proposal. And why would, for example, the community write this one and the maintainers some other? |
For people looking for a solution- this utilizes an exec krm plugin. Folder structure
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: []
# The job is added by the generator
# - job.yaml
generators:
- job-name-generator.yaml
apiVersion: batch/v1
kind: Job
metadata:
generateName: schema-migrate-
spec:
template:
spec: {}
apiVersion: kustomize.example.com/v1
kind: JobNameGenerator
metadata:
name: schema-migrate
annotations:
config.kubernetes.io/function: |
exec:
path: ../plugins/job-name-generator.sh
spec:
resourcePath: ./job.yaml
#!/usr/bin/env bash
# read the `kind: ResourceList` from stdin
resourceList=$(cat)
# extract the resource path
export resourcePath=$(echo "${resourceList}" | yq e '.functionConfig.spec.resourcePath' - )
# generate the job hash
export job_hash=$(openssl rand -hex 3 | cut -c 1-5)
# dump the job into the output ResourceList, add name from generateName + the job hash, and delete generateName
echo "
kind: ResourceList
items: []
" | yq e 'load(env(resourcePath)) as $resource | .items += $resource | .items[0].metadata.name = .items[0].metadata.generateName + env(job_hash) | del(.items[0].metadata.generateName)' - |
I am trying to use
kustomize
with https://github.com/argoproj/argo.Example spec:
Argo Workflow CRDs don't require or use
metadata.name
, but I am getting the following error when I try to runkustomize build
on an Argo Workflow resource:Is there a way for me to override where
kustomize
looks for a name tometadata.generateName
?The text was updated successfully, but these errors were encountered: