-
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
Make ordering configurable #4019
Make ordering configurable #4019
Conversation
@yanniszark: This PR has multiple commits, and the default merge method is: merge. 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. |
Hi @yanniszark. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
e2feb0f
to
324895e
Compare
/ok-to-test |
As a note, you can run the command |
/retest |
1 similar comment
/retest |
I might have to unpin some modules for the presubmit to pass. I'll try to make some time to do that tomorrow! |
23d16df
to
431b40e
Compare
@natasha41575 I'm a bit perplexed by what happened.
I pinned it down to the unit tests of the legacy order transformer. |
BTW, I added a test and fixed the behavior of the plugin to follow these rules:
Test failed because I needed to split changes spanning different modules into separate commits. |
We ran into this problem too but didn't know why :) but as long as it works now that's fine. I'm running the workflows now, I'll take a closer look at this PR this week. |
Could you add an e2e test in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I need to read through the issue more carefully actually, you can disregard this comment.
I don't know if having two separate top-level fields is necessary, so I commented on the issue.
431b40e
to
370634b
Compare
370634b
to
bb9e19d
Compare
Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
8f14277
to
e581778
Compare
@KnVerey done! Let's see if it passes now :) |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, yanniszark The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@natasha41575 @KnVerey many thanks for all the help in getting this change in :) |
Thank YOU for all your hard work on this feature! |
I am so happy to see this in! Amazing work and thank you, both of you for seeing this through! |
* api: Add new types for customizeable resource ordering Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Implement SortOrderTransformer plugin Implement the SortOrderTransformer plugin. This plugin allows the user to customize the order that kustomize will output resources in. The API for the plugin is the following: sortOptions: order: legacy | fifo legacySortOptions: orderFirst: - {GVK} orderLast: - {GVK} Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Add boilerplate and generate code for new SortOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * build: Add option to denote if the reorder flag was set by the user We want to take different actions if the reorder flag was set by the user or filled by the default value. Thus, we propagate this information from build to the krusty options. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * api/krusty: Ensure sort ordering works with CLI flag and kustomization Sort order can be defined in two places: - (new) kustomization file - (old) CLI flag We want the kustomization file to take precedence over the CLI flag. Eventually, we may want to move away from having a CLI flag altogether: kubernetes-sigs#3947 Case 1: Sort order set in kustomization file AND in CLI flag. Print a warning and let the kustomization file take precedence. Case 2: Sort order set in CLI flag only or not at all. Follow the CLI flag (defaults to legacy) and reorder at the end. Case 3: Sort order set in kustomization file only. Simply build the kustomization. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * krusty: Add e2e test for SortOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Purge LegacyOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * Update go.work.sum Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * review: Make review changes Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
@yanniszark Do you have time to write up some docs before this feature is released next Friday 12/16? The docs live here: https://github.com/kubernetes-sigs/cli-experimental/tree/master/site/content/en/references/kustomize/kustomization If you are unable to, just let us know and we can try to write something up ourselves. |
@natasha41575 yes I will make sure to do so! I will try to parse the current structure and infer the necessary docs to write, but please feel free to tell me what you would expect as a good set of documentation for this feature. |
Kustomize has a new field called "sortOptions" to sort resources: kubernetes-sigs/kustomize#3913 kubernetes-sigs/kustomize#4019 Document what it does and how to use it. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Kustomize has a new field called "sortOptions" to sort resources: kubernetes-sigs/kustomize#3913 kubernetes-sigs/kustomize#4019 Document what it does and how to use it. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Kustomize has a new field called "sortOptions" to sort resources: kubernetes-sigs/kustomize#3913 kubernetes-sigs/kustomize#4019 Document what it does and how to use it. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Kustomize has a new field called "sortOptions" to sort resources: kubernetes-sigs/kustomize#3913 kubernetes-sigs/kustomize#4019 Document what it does and how to use it. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
Kustomize has a new field called "sortOptions" to sort resources: kubernetes-sigs/kustomize#3913 kubernetes-sigs/kustomize#4019 Document what it does and how to use it. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
* api: Add new types for customizeable resource ordering Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Implement SortOrderTransformer plugin Implement the SortOrderTransformer plugin. This plugin allows the user to customize the order that kustomize will output resources in. The API for the plugin is the following: sortOptions: order: legacy | fifo legacySortOptions: orderFirst: - {GVK} orderLast: - {GVK} Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Add boilerplate and generate code for new SortOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * build: Add option to denote if the reorder flag was set by the user We want to take different actions if the reorder flag was set by the user or filled by the default value. Thus, we propagate this information from build to the krusty options. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * api/krusty: Ensure sort ordering works with CLI flag and kustomization Sort order can be defined in two places: - (new) kustomization file - (old) CLI flag We want the kustomization file to take precedence over the CLI flag. Eventually, we may want to move away from having a CLI flag altogether: kubernetes-sigs#3947 Case 1: Sort order set in kustomization file AND in CLI flag. Print a warning and let the kustomization file take precedence. Case 2: Sort order set in CLI flag only or not at all. Follow the CLI flag (defaults to legacy) and reorder at the end. Case 3: Sort order set in kustomization file only. Simply build the kustomization. Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * krusty: Add e2e test for SortOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> * plugins: Purge LegacyOrderTransformer Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * Update go.work.sum Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> * review: Make review changes Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com> Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com> Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
In generell, we like this approach. We have only one exception the the 'legacy' order: Node isn't in the legacy list and comes at least. |
It says in the documentation:
It is a bit unclear to me if that just means that it is the endorsed way to set the ordering options (instead of the Can someone please clarify this to me? |
Resolves #3913
Make kustomize's ordering of resources customizable from the kustomization.yaml file.
My changes in a nutshell:
LegacyResourceOrderingPlugin
to be configurable in its ordering.We may also want to delete the now unused
IdSlice
code, but I've leaven it up to the reviewer to guide me on this.cc @KnVerey @monopole
ALLOW_MODULE_SPAN