cluster-api-provider-aws
cluster-api-provider-aws copied to clipboard
✨ Refactor to consolidate into LaunchTemplateNeedsUpdate
What type of PR is this?
/kind design
What this PR does / why we need it:
We have a function called LaunchTemplateNeedsUpdate that checks different LaunchTemplate fields in the existing Launch Template and the incoming one, to decide whether or not we need a new version of the Launch Template. Outside of this function, we are also checking other fields, making code a bit confusing, and requiring some extra variables that we need to always check together to finally decide if a new Launch Template version is needed.
With these changes, we move as much code as possible into LaunchTemplateNeedsUpdate so that everything is in the same place.
Special notes for your reviewer:
I also renamed some variables to make the code easier to read.
Checklist:
- [ ] squashed commits
- [ ] includes documentation
- [ ] includes emoji in title
- [ ] adds unit tests
- [ ] adds or updates e2e tests
Release note:
Refactor to consolidate into LaunchTemplateNeedsUpdate