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
Add patchMergeKey annotations to allow Kustomize overrides of list element fields #6147
Comments
Sounds good to me. I ran into this issue before and had to switch to JSON patching (IIRC). P.S. Not 100% sure, but I think it can be also useful for |
/kind api-change I'm generally +1, just wondering if:
/milestone v1.2 |
I think it depends on how/if it changes things like |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
/lifecycle frozen |
/triage accepted |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
/priority important-longterm |
This should be part of the next API iteration |
User Story
As a developer I would like to be able to override fields of list elements in CAPI types using Kustomize so that I can leverage Kustomize for keeping workload cluster templates DRY.
Detailed Description
Kustomize is used by CAPI providers to keep cluster templates DRY. Example: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/blob/4b535f6befba3b08dee7250d7dd83590757709ad/test/e2e/data/infrastructure-vsphere/kustomization/conformance/kustomization.yaml#L1
Assume I want to use Kustomize to override the
permissions
field of thefiles
entry above (but keep thecontent
and any other field intact). At the moment, patching the list element using Kustomize replaces the list element rather than patch it.As far as I can tell, this is caused by the fact that the
File
type doesn't have apatchMergeKey
annotation (which should probably be on thepath
field):cluster-api/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go
Line 211 in 8059056
Relevant info: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#merge-individual-elements-of-a-list-of-complex-elements
I'm wondering if adding a
patchMergeKey
annotation for all the CAPI types makes sense. Looking at the repo, it seems there is only one annotated type:cluster-api/api/v1alpha3/common_types.go
Line 189 in 58905fb
Anything else you would like to add:
None
/kind feature
The text was updated successfully, but these errors were encountered: