Select one subnet for AZs where multiple are present and no VPC config provided #6814
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Internally, we store subnets as a map, where the key can be either the subnet name of the subnet AZ. As we populate this map when importing a VPC config, if there are multiple subnets in the same availability zone, they will conflict with each other. This happens because, when we find the second subnet, we already have the first one stored by AZ in the map, and the existing validation will see this as a conflict between local state provided in the config file, and the remote state we are trying to import. However, if the user defined this mapping in the config file and chooses to use subnet name as key, the 2 subnets in same AZ won't generate a conflict.
With this PR, we aim to correctly validate config file against remote config, if one is provided. Moreover, if no config file is provided, only one subnet from each AZ will be picked, as this is enforced by the AZSubnetMapping that's being populated using AZs as keys.
Closes #6702
Checklist
README.md
, or theuserdocs
directory)area/nodegroup
) and kind (e.g.kind/improvement
)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯