kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

[Question] Order of different kind of patches?

Open cconnert opened this issue 3 years ago • 7 comments

Question #727 explains well how patches are applied in regards to overlays. But it falls short of explaining:

  • How patches & components interact with one and another. E.g I got several partial patches within components which are applied at some level. As far as I figured those are applied in declaration order. Is that correct (basically same as for resource)?
  • Second when applying different kind of patches (e.g patches and patchesStrategicMerge) to the same resource how are they order? For now I figured that e.g. patchesStrategicMerge seems to be applied before patches. The declaration order does not matter. So in which order are patchesStrategicMerge, patchesJson6902 and patches applied?

A in depth explanation with examples would be a great addition as documentation.

cconnert avatar Mar 30 '22 12:03 cconnert

I believe the order of transformers is determined here: https://github.com/kubernetes-sigs/kustomize/blob/e5041bae6f3b536b764f96c1cf72d332a9c68c43/api/internal/plugins/builtinhelpers/builtins.go#L14-L34

which suggests that the order is patchesJson6902, patchesStrategicMerge and then patches.

If you would like to control the order of transformers, you can invoke them via the transformers field. There's an example of that here: https://github.com/kubernetes-sigs/kustomize/issues/4476

natasha41575 avatar Apr 13 '22 16:04 natasha41575

Btw, feel free to contribute documentation. Kustomize docs live here: https://kubectl.docs.kubernetes.io/references/kustomize/, it could probably use an extra "Transformers" section. The repo that hosts this site is here: https://github.com/kubernetes-sigs/cli-experimental

/kind documentation /kind question /triage accepted

natasha41575 avatar Apr 13 '22 16:04 natasha41575

@natasha41575: The label(s) kind/question cannot be applied, because the repository doesn't have them.

In response to this:

Btw, feel free to contribute documentation. Kustomize docs live here: https://kubectl.docs.kubernetes.io/references/kustomize/, it could probably use an extra "Transformers" section. The repo that hosts this site is here: https://github.com/kubernetes-sigs/cli-experimental

/kind documentation /kind question /triage accepted

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.

k8s-ci-robot avatar Apr 13 '22 16:04 k8s-ci-robot

/kind support

natasha41575 avatar Apr 13 '22 16:04 natasha41575

Thanks for the detailed explanation. I'll try to find some time to contribute and enhance the documenation

cconnert avatar Apr 15 '22 08:04 cconnert

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 14 '22 09:07 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Aug 13 '22 10:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Sep 12 '22 10:09 k8s-triage-robot

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

k8s-ci-robot avatar Sep 12 '22 10:09 k8s-ci-robot