-
Notifications
You must be signed in to change notification settings - Fork 579
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
[WIP] Use availabilityZones provided in AWSMachinePool when creating ASG #3245
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import ( | |
"context" | ||
"fmt" | ||
"reflect" | ||
"sort" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/pkg/errors" | ||
|
@@ -531,11 +532,26 @@ func asgNeedsUpdates(machinePoolScope *scope.MachinePoolScope, existingASG *expi | |
return true | ||
} | ||
|
||
if checkAZsNeedsUpdate(machinePoolScope.AvailabilityZones(), existingASG.AvailabilityZones) { | ||
return true | ||
} | ||
|
||
// todo subnet diff | ||
|
||
return false | ||
} | ||
|
||
func checkAZsNeedsUpdate(input, existing []string) bool { | ||
sort.Slice(input, func(i, j int) bool { | ||
return input[i] < input[j] | ||
}) | ||
sort.Slice(existing, func(i, j int) bool { | ||
return existing[i] < existing[j] | ||
}) | ||
|
||
return reflect.DeepEqual(input, existing) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we have a PR in place to replace this with gocmp, it would be good to follow that for new PRs, wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we should change this to use cmp.Equal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good spot @Ankitasw |
||
} | ||
|
||
// getOwnerMachinePool returns the MachinePool object owning the current resource. | ||
func getOwnerMachinePool(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*expclusterv1.MachinePool, error) { | ||
for _, ref := range obj.OwnerReferences { | ||
|
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.
Do we see this situation?