-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
fix the random order of block_device_mappings render #17180
fix the random order of block_device_mappings render #17180
Conversation
|
Welcome @AldoFusterTurpin! |
Hi @AldoFusterTurpin. Thanks for your PR. I'm waiting for a kubernetes 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-sigs/prow repository. |
/ok-to-test |
/retest |
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.
Thanks for the PR @AldoFusterTurpin. There are a few nits that should be addressed before merging the PR.
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
upup/pkg/fi/cloudup/awstasks/launchtemplate_target_terraform.go
Outdated
Show resolved
Hide resolved
Thanks for the review! Checking now. 👌 |
abf65db
to
90b1027
Compare
Include a new function to get the keys of the map used for block_device_mappings to access elements in deterministic order.
90b1027
to
ba0a94f
Compare
Thanks @AldoFusterTurpin! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rifelpet 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 |
What this PR does
Includes a new function to get the keys of the map used for block_device_mappings to access elements in deterministic order to avoid false changes in terraform diff.
Why we need it ?
When we render the terraform in kops, sometimes we get a diff like this
stating that there are changes in the block_device_mappings, but the only thing that changes is the order of those devices, and this happens randomly because we use a map to store those here, here and here.
The solution
Simply sort the keys of the map and always access the maps using a deterministic order to avoid getting false changes shown in the terraform diff.
Additional notes
I have used generics for simplicity and included a unit test for the new function.
The only thing that changes is that now we do not iterate the maps directly using a "for" construct but instead iterate over the keys of the map in order and access the values of the maps using the keys. This change does not affect the behavior, just ensures that we always iterate over the devices in the same order.